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.AccountOrderRecord;
import com.konfigthis.client.model.ActionStrict;
import com.konfigthis.client.model.ActionStrictWithOptions;
import com.konfigthis.client.model.ManualTradeAndImpact;
import com.konfigthis.client.model.ManualTradeForm;
import com.konfigthis.client.model.ManualTradeFormWithOptions;
import com.konfigthis.client.model.OrderTypeStrict;
import com.konfigthis.client.model.SymbolsQuotesInner;
import com.konfigthis.client.model.TimeInForceStrict;
import com.konfigthis.client.model.TradingCancelUserAccountOrderRequest;
import java.util.UUID;
import com.konfigthis.client.model.ValidatedTradeBody;
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 TradingApiGenerated {
private ApiClient localVarApiClient;
private int localHostIndex;
private String localCustomBaseUrl;
public TradingApiGenerated() throws IllegalArgumentException {
this(Configuration.getDefaultApiClient());
}
public TradingApiGenerated(ApiClient apiClient) throws IllegalArgumentException {
this.localVarApiClient = apiClient;
}
public ApiClient getApiClient() {
return localVarApiClient;
}
public void setApiClient(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
public int getHostIndex() {
return localHostIndex;
}
public void setHostIndex(int hostIndex) {
this.localHostIndex = hostIndex;
}
public String getCustomBaseUrl() {
return localCustomBaseUrl;
}
public void setCustomBaseUrl(String customBaseUrl) {
this.localCustomBaseUrl = customBaseUrl;
}
private okhttp3.Call cancelUserAccountOrderCall(String userId, String userSecret, UUID accountId, TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = tradingCancelUserAccountOrderRequest;
// create path and map variables
String localVarPath = "/accounts/{accountId}/orders/cancel"
.replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString()));
List 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 cancelUserAccountOrderValidateBeforeCall(String userId, String userSecret, UUID accountId, TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'userId' is set
if (userId == null) {
throw new ApiException("Missing the required parameter 'userId' when calling cancelUserAccountOrder(Async)");
}
// verify the required parameter 'userSecret' is set
if (userSecret == null) {
throw new ApiException("Missing the required parameter 'userSecret' when calling cancelUserAccountOrder(Async)");
}
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException("Missing the required parameter 'accountId' when calling cancelUserAccountOrder(Async)");
}
// verify the required parameter 'tradingCancelUserAccountOrderRequest' is set
if (tradingCancelUserAccountOrderRequest == null) {
throw new ApiException("Missing the required parameter 'tradingCancelUserAccountOrderRequest' when calling cancelUserAccountOrder(Async)");
}
return cancelUserAccountOrderCall(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, _callback);
}
private ApiResponse cancelUserAccountOrderWithHttpInfo(String userId, String userSecret, UUID accountId, TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest) throws ApiException {
okhttp3.Call localVarCall = cancelUserAccountOrderValidateBeforeCall(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
private okhttp3.Call cancelUserAccountOrderAsync(String userId, String userSecret, UUID accountId, TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = cancelUserAccountOrderValidateBeforeCall(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public abstract class CancelUserAccountOrderRequestBuilderGenerated {
final String userId;
final String userSecret;
final UUID accountId;
String brokerageOrderId;
public CancelUserAccountOrderRequestBuilderGenerated(String userId, String userSecret, UUID accountId) {
this.userId = userId;
this.userSecret = userSecret;
this.accountId = accountId;
}
/**
* Set brokerageOrderId
* @param brokerageOrderId Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system. (optional)
* @return TradingApi.CancelUserAccountOrderRequestBuilder
*/
public TradingApi.CancelUserAccountOrderRequestBuilder brokerageOrderId(String brokerageOrderId) {
this.brokerageOrderId = brokerageOrderId;
return (TradingApi.CancelUserAccountOrderRequestBuilder) this;
}
/**
* Build call for cancelUserAccountOrder
* @param _callback ApiCallback API callback
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
Order Record of canceled order
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = buildBodyParams();
return cancelUserAccountOrderCall(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, _callback);
}
private TradingCancelUserAccountOrderRequest buildBodyParams() {
TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = new TradingCancelUserAccountOrderRequest();
tradingCancelUserAccountOrderRequest.brokerageOrderId(this.brokerageOrderId);
return tradingCancelUserAccountOrderRequest;
}
/**
* Execute cancelUserAccountOrder request
* @return AccountOrderRecord
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
Order Record of canceled order
-
*/
public AccountOrderRecord execute() throws ApiException {
TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = buildBodyParams();
ApiResponse localVarResp = cancelUserAccountOrderWithHttpInfo(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest);
return localVarResp.getResponseBody();
}
/**
* Execute cancelUserAccountOrder request with HTTP info returned
* @return ApiResponse<AccountOrderRecord>
* @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 Record of canceled order
-
*/
public ApiResponse executeWithHttpInfo() throws ApiException {
TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = buildBodyParams();
return cancelUserAccountOrderWithHttpInfo(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest);
}
/**
* Execute cancelUserAccountOrder request (asynchronously)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code
Description
Response Headers
200
Order Record of canceled order
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = buildBodyParams();
return cancelUserAccountOrderAsync(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, _callback);
}
}
/**
* Cancel order
* Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
* @param userId (required)
* @param userSecret (required)
* @param accountId (required)
* @param tradingCancelUserAccountOrderRequest (required)
* @return CancelUserAccountOrderRequestBuilder
* @http.response.details
Status Code
Description
Response Headers
200
Order Record of canceled order
-
*/
public TradingApi.CancelUserAccountOrderRequestBuilder cancelUserAccountOrder(String userId, String userSecret, UUID accountId) throws IllegalArgumentException {
if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null");
if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null");
if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null");
return ((TradingApi) this).new CancelUserAccountOrderRequestBuilder(userId, userSecret, accountId);
}
private okhttp3.Call getOrderImpactCall(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = manualTradeForm;
// create path and map variables
String localVarPath = "/trade/impact";
List 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 getOrderImpactValidateBeforeCall(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'userId' is set
if (userId == null) {
throw new ApiException("Missing the required parameter 'userId' when calling getOrderImpact(Async)");
}
// verify the required parameter 'userSecret' is set
if (userSecret == null) {
throw new ApiException("Missing the required parameter 'userSecret' when calling getOrderImpact(Async)");
}
// verify the required parameter 'manualTradeForm' is set
if (manualTradeForm == null) {
throw new ApiException("Missing the required parameter 'manualTradeForm' when calling getOrderImpact(Async)");
}
return getOrderImpactCall(userId, userSecret, manualTradeForm, _callback);
}
private ApiResponse getOrderImpactWithHttpInfo(String userId, String userSecret, ManualTradeForm manualTradeForm) throws ApiException {
okhttp3.Call localVarCall = getOrderImpactValidateBeforeCall(userId, userSecret, manualTradeForm, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
private okhttp3.Call getOrderImpactAsync(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getOrderImpactValidateBeforeCall(userId, userSecret, manualTradeForm, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public abstract class GetOrderImpactRequestBuilderGenerated {
final UUID accountId;
final ActionStrict action;
final UUID universalSymbolId;
final OrderTypeStrict orderType;
final TimeInForceStrict timeInForce;
final String userId;
final String userSecret;
Double price;
Double stop;
Double units;
Object notionalValue;
public GetOrderImpactRequestBuilderGenerated(UUID accountId, ActionStrict action, UUID universalSymbolId, OrderTypeStrict orderType, TimeInForceStrict timeInForce, String userId, String userSecret) {
this.accountId = accountId;
this.action = action;
this.universalSymbolId = universalSymbolId;
this.orderType = orderType;
this.timeInForce = timeInForce;
this.userId = userId;
this.userSecret = userSecret;
}
/**
* Set price
* @param price The limit price for `Limit` and `StopLimit` orders. (optional)
* @return TradingApi.GetOrderImpactRequestBuilder
*/
public TradingApi.GetOrderImpactRequestBuilder price(Double price) {
this.price = price;
return (TradingApi.GetOrderImpactRequestBuilder) this;
}
/**
* Set price
* @param price The limit price for `Limit` and `StopLimit` orders. (optional)
* @return TradingApi.GetOrderImpactRequestBuilder
*/
public TradingApi.GetOrderImpactRequestBuilder price(Integer price) {
this.price = price.doubleValue();
return (TradingApi.GetOrderImpactRequestBuilder) this;
}
/**
* Set stop
* @param stop The price at which a stop order is triggered for `Stop` and `StopLimit` orders. (optional)
* @return TradingApi.GetOrderImpactRequestBuilder
*/
public TradingApi.GetOrderImpactRequestBuilder stop(Double stop) {
this.stop = stop;
return (TradingApi.GetOrderImpactRequestBuilder) this;
}
/**
* Set stop
* @param stop The price at which a stop order is triggered for `Stop` and `StopLimit` orders. (optional)
* @return TradingApi.GetOrderImpactRequestBuilder
*/
public TradingApi.GetOrderImpactRequestBuilder stop(Integer stop) {
this.stop = stop.doubleValue();
return (TradingApi.GetOrderImpactRequestBuilder) this;
}
/**
* Set units
* @param units Number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. (optional)
* @return TradingApi.GetOrderImpactRequestBuilder
*/
public TradingApi.GetOrderImpactRequestBuilder units(Double units) {
this.units = units;
return (TradingApi.GetOrderImpactRequestBuilder) this;
}
/**
* Set units
* @param units Number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. (optional)
* @return TradingApi.GetOrderImpactRequestBuilder
*/
public TradingApi.GetOrderImpactRequestBuilder units(Integer units) {
this.units = units.doubleValue();
return (TradingApi.GetOrderImpactRequestBuilder) this;
}
/**
* Set notionalValue
* @param notionalValue (optional)
* @return TradingApi.GetOrderImpactRequestBuilder
*/
public TradingApi.GetOrderImpactRequestBuilder notionalValue(Object notionalValue) {
this.notionalValue = notionalValue;
return (TradingApi.GetOrderImpactRequestBuilder) this;
}
/**
* Build call for getOrderImpact
* @param _callback ApiCallback API callback
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
500
Unexpected Error
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
ManualTradeForm manualTradeForm = buildBodyParams();
return getOrderImpactCall(userId, userSecret, manualTradeForm, _callback);
}
private ManualTradeForm buildBodyParams() {
ManualTradeForm manualTradeForm = new ManualTradeForm();
manualTradeForm.accountId(this.accountId);
manualTradeForm.action(this.action);
manualTradeForm.universalSymbolId(this.universalSymbolId);
manualTradeForm.orderType(this.orderType);
manualTradeForm.timeInForce(this.timeInForce);
manualTradeForm.price(this.price);
manualTradeForm.stop(this.stop);
manualTradeForm.units(this.units);
manualTradeForm.notionalValue(this.notionalValue);
return manualTradeForm;
}
/**
* Execute getOrderImpact request
* @return ManualTradeAndImpact
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
500
Unexpected Error
-
*/
public ManualTradeAndImpact execute() throws ApiException {
ManualTradeForm manualTradeForm = buildBodyParams();
ApiResponse localVarResp = getOrderImpactWithHttpInfo(userId, userSecret, manualTradeForm);
return localVarResp.getResponseBody();
}
/**
* Execute getOrderImpact request with HTTP info returned
* @return ApiResponse<ManualTradeAndImpact>
* @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
-
500
Unexpected Error
-
*/
public ApiResponse executeWithHttpInfo() throws ApiException {
ManualTradeForm manualTradeForm = buildBodyParams();
return getOrderImpactWithHttpInfo(userId, userSecret, manualTradeForm);
}
/**
* Execute getOrderImpact request (asynchronously)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
500
Unexpected Error
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
ManualTradeForm manualTradeForm = buildBodyParams();
return getOrderImpactAsync(userId, userSecret, manualTradeForm, _callback);
}
}
/**
* Check order impact
* Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
* @param userId (required)
* @param userSecret (required)
* @param manualTradeForm (required)
* @return GetOrderImpactRequestBuilder
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
500
Unexpected Error
-
*/
public TradingApi.GetOrderImpactRequestBuilder getOrderImpact(UUID accountId, ActionStrict action, UUID universalSymbolId, OrderTypeStrict orderType, TimeInForceStrict timeInForce, String userId, String userSecret) throws IllegalArgumentException {
if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null");
if (action == null) throw new IllegalArgumentException("\"action\" is required but got null");
if (universalSymbolId == null) throw new IllegalArgumentException("\"universalSymbolId\" is required but got null");
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");
return ((TradingApi) this).new GetOrderImpactRequestBuilder(accountId, action, universalSymbolId, orderType, timeInForce, userId, userSecret);
}
private okhttp3.Call getUserAccountQuotesCall(String userId, String userSecret, String symbols, UUID accountId, Boolean useTicker, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/accounts/{accountId}/quotes"
.replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString()));
List 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 (symbols != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbols", symbols));
}
if (useTicker != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("use_ticker", useTicker));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" };
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getUserAccountQuotesValidateBeforeCall(String userId, String userSecret, String symbols, UUID accountId, Boolean useTicker, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'userId' is set
if (userId == null) {
throw new ApiException("Missing the required parameter 'userId' when calling getUserAccountQuotes(Async)");
}
// verify the required parameter 'userSecret' is set
if (userSecret == null) {
throw new ApiException("Missing the required parameter 'userSecret' when calling getUserAccountQuotes(Async)");
}
// verify the required parameter 'symbols' is set
if (symbols == null) {
throw new ApiException("Missing the required parameter 'symbols' when calling getUserAccountQuotes(Async)");
}
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException("Missing the required parameter 'accountId' when calling getUserAccountQuotes(Async)");
}
return getUserAccountQuotesCall(userId, userSecret, symbols, accountId, useTicker, _callback);
}
private ApiResponse> getUserAccountQuotesWithHttpInfo(String userId, String userSecret, String symbols, UUID accountId, Boolean useTicker) throws ApiException {
okhttp3.Call localVarCall = getUserAccountQuotesValidateBeforeCall(userId, userSecret, symbols, accountId, useTicker, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
private okhttp3.Call getUserAccountQuotesAsync(String userId, String userSecret, String symbols, UUID accountId, Boolean useTicker, final ApiCallback> _callback) throws ApiException {
okhttp3.Call localVarCall = getUserAccountQuotesValidateBeforeCall(userId, userSecret, symbols, accountId, useTicker, _callback);
Type localVarReturnType = new TypeToken>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public abstract class GetUserAccountQuotesRequestBuilderGenerated {
final String userId;
final String userSecret;
final String symbols;
final UUID accountId;
Boolean useTicker;
public GetUserAccountQuotesRequestBuilderGenerated(String userId, String userSecret, String symbols, UUID accountId) {
this.userId = userId;
this.userSecret = userSecret;
this.symbols = symbols;
this.accountId = accountId;
}
/**
* Set useTicker
* @param useTicker Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided. (optional)
* @return TradingApi.GetUserAccountQuotesRequestBuilder
*/
public TradingApi.GetUserAccountQuotesRequestBuilder useTicker(Boolean useTicker) {
this.useTicker = useTicker;
return (TradingApi.GetUserAccountQuotesRequestBuilder) this;
}
/**
* Build call for getUserAccountQuotes
* @param _callback ApiCallback API callback
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
return getUserAccountQuotesCall(userId, userSecret, symbols, accountId, useTicker, _callback);
}
/**
* Execute getUserAccountQuotes request
* @return List<SymbolsQuotesInner>
* @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 = getUserAccountQuotesWithHttpInfo(userId, userSecret, symbols, accountId, useTicker);
return localVarResp.getResponseBody();
}
/**
* Execute getUserAccountQuotes request with HTTP info returned
* @return ApiResponse<List<SymbolsQuotesInner>>
* @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 getUserAccountQuotesWithHttpInfo(userId, userSecret, symbols, accountId, useTicker);
}
/**
* Execute getUserAccountQuotes request (asynchronously)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
*/
public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException {
return getUserAccountQuotesAsync(userId, userSecret, symbols, accountId, useTicker, _callback);
}
}
/**
* Get symbol quotes
* Returns quotes from the brokerage for the specified symbols and account. The quotes returned can be delayed depending on the brokerage the account belongs to. It is highly recommended that you use your own market data provider for real-time quotes instead of relying on this endpoint. This endpoint does not work for options quotes.
* @param userId (required)
* @param userSecret (required)
* @param symbols List of Universal Symbol IDs or tickers to get quotes for. (required)
* @param accountId (required)
* @return GetUserAccountQuotesRequestBuilder
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
*/
public TradingApi.GetUserAccountQuotesRequestBuilder getUserAccountQuotes(String userId, String userSecret, String symbols, 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 (symbols == null) throw new IllegalArgumentException("\"symbols\" is required but got null");
if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null");
return ((TradingApi) this).new GetUserAccountQuotesRequestBuilder(userId, userSecret, symbols, accountId);
}
private okhttp3.Call placeForceOrderCall(String userId, String userSecret, ManualTradeFormWithOptions manualTradeFormWithOptions, 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 = manualTradeFormWithOptions;
// create path and map variables
String localVarPath = "/trade/place";
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 placeForceOrderValidateBeforeCall(String userId, String userSecret, ManualTradeFormWithOptions manualTradeFormWithOptions, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'userId' is set
if (userId == null) {
throw new ApiException("Missing the required parameter 'userId' when calling placeForceOrder(Async)");
}
// verify the required parameter 'userSecret' is set
if (userSecret == null) {
throw new ApiException("Missing the required parameter 'userSecret' when calling placeForceOrder(Async)");
}
// verify the required parameter 'manualTradeFormWithOptions' is set
if (manualTradeFormWithOptions == null) {
throw new ApiException("Missing the required parameter 'manualTradeFormWithOptions' when calling placeForceOrder(Async)");
}
return placeForceOrderCall(userId, userSecret, manualTradeFormWithOptions, _callback);
}
private ApiResponse placeForceOrderWithHttpInfo(String userId, String userSecret, ManualTradeFormWithOptions manualTradeFormWithOptions) throws ApiException {
okhttp3.Call localVarCall = placeForceOrderValidateBeforeCall(userId, userSecret, manualTradeFormWithOptions, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
private okhttp3.Call placeForceOrderAsync(String userId, String userSecret, ManualTradeFormWithOptions manualTradeFormWithOptions, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = placeForceOrderValidateBeforeCall(userId, userSecret, manualTradeFormWithOptions, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public abstract class PlaceForceOrderRequestBuilderGenerated {
final UUID accountId;
final ActionStrictWithOptions action;
final OrderTypeStrict orderType;
final TimeInForceStrict timeInForce;
final String userId;
final String userSecret;
UUID universalSymbolId;
String symbol;
Double price;
Double stop;
Double units;
Object notionalValue;
public PlaceForceOrderRequestBuilderGenerated(UUID accountId, ActionStrictWithOptions action, OrderTypeStrict orderType, TimeInForceStrict timeInForce, String userId, String userSecret) {
this.accountId = accountId;
this.action = action;
this.orderType = orderType;
this.timeInForce = timeInForce;
this.userId = userId;
this.userSecret = userSecret;
}
/**
* Set universalSymbolId
* @param universalSymbolId Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls. (optional)
* @return TradingApi.PlaceForceOrderRequestBuilder
*/
public TradingApi.PlaceForceOrderRequestBuilder universalSymbolId(UUID universalSymbolId) {
this.universalSymbolId = universalSymbolId;
return (TradingApi.PlaceForceOrderRequestBuilder) this;
}
/**
* Set symbol
* @param symbol The security's trading ticker symbol. This currently only support Options symbols in the 21 character OCC format. For example \\\"AAPL 131124C00240000\\\" represents a call option on AAPL expiring on 2024-11-13 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is provided, then 'universal_symbol_id' must be 'null'. (optional)
* @return TradingApi.PlaceForceOrderRequestBuilder
*/
public TradingApi.PlaceForceOrderRequestBuilder symbol(String symbol) {
this.symbol = symbol;
return (TradingApi.PlaceForceOrderRequestBuilder) this;
}
/**
* Set price
* @param price The limit price for `Limit` and `StopLimit` orders. (optional)
* @return TradingApi.PlaceForceOrderRequestBuilder
*/
public TradingApi.PlaceForceOrderRequestBuilder price(Double price) {
this.price = price;
return (TradingApi.PlaceForceOrderRequestBuilder) this;
}
/**
* Set price
* @param price The limit price for `Limit` and `StopLimit` orders. (optional)
* @return TradingApi.PlaceForceOrderRequestBuilder
*/
public TradingApi.PlaceForceOrderRequestBuilder price(Integer price) {
this.price = price.doubleValue();
return (TradingApi.PlaceForceOrderRequestBuilder) this;
}
/**
* Set stop
* @param stop The price at which a stop order is triggered for `Stop` and `StopLimit` orders. (optional)
* @return TradingApi.PlaceForceOrderRequestBuilder
*/
public TradingApi.PlaceForceOrderRequestBuilder stop(Double stop) {
this.stop = stop;
return (TradingApi.PlaceForceOrderRequestBuilder) this;
}
/**
* Set stop
* @param stop The price at which a stop order is triggered for `Stop` and `StopLimit` orders. (optional)
* @return TradingApi.PlaceForceOrderRequestBuilder
*/
public TradingApi.PlaceForceOrderRequestBuilder stop(Integer stop) {
this.stop = stop.doubleValue();
return (TradingApi.PlaceForceOrderRequestBuilder) this;
}
/**
* Set units
* @param units For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares). (optional)
* @return TradingApi.PlaceForceOrderRequestBuilder
*/
public TradingApi.PlaceForceOrderRequestBuilder units(Double units) {
this.units = units;
return (TradingApi.PlaceForceOrderRequestBuilder) this;
}
/**
* Set notionalValue
* @param notionalValue (optional)
* @return TradingApi.PlaceForceOrderRequestBuilder
*/
public TradingApi.PlaceForceOrderRequestBuilder notionalValue(Object notionalValue) {
this.notionalValue = notionalValue;
return (TradingApi.PlaceForceOrderRequestBuilder) this;
}
/**
* Build call for placeForceOrder
* @param _callback ApiCallback API callback
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
500
Unexpected Error
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
ManualTradeFormWithOptions manualTradeFormWithOptions = buildBodyParams();
return placeForceOrderCall(userId, userSecret, manualTradeFormWithOptions, _callback);
}
private ManualTradeFormWithOptions buildBodyParams() {
ManualTradeFormWithOptions manualTradeFormWithOptions = new ManualTradeFormWithOptions();
manualTradeFormWithOptions.accountId(this.accountId);
manualTradeFormWithOptions.action(this.action);
manualTradeFormWithOptions.universalSymbolId(this.universalSymbolId);
manualTradeFormWithOptions.symbol(this.symbol);
manualTradeFormWithOptions.orderType(this.orderType);
manualTradeFormWithOptions.timeInForce(this.timeInForce);
manualTradeFormWithOptions.price(this.price);
manualTradeFormWithOptions.stop(this.stop);
manualTradeFormWithOptions.units(this.units);
manualTradeFormWithOptions.notionalValue(this.notionalValue);
return manualTradeFormWithOptions;
}
/**
* Execute placeForceOrder request
* @return AccountOrderRecord
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
500
Unexpected Error
-
*/
public AccountOrderRecord execute() throws ApiException {
ManualTradeFormWithOptions manualTradeFormWithOptions = buildBodyParams();
ApiResponse localVarResp = placeForceOrderWithHttpInfo(userId, userSecret, manualTradeFormWithOptions);
return localVarResp.getResponseBody();
}
/**
* Execute placeForceOrder request with HTTP info returned
* @return ApiResponse<AccountOrderRecord>
* @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
-
500
Unexpected Error
-
*/
public ApiResponse executeWithHttpInfo() throws ApiException {
ManualTradeFormWithOptions manualTradeFormWithOptions = buildBodyParams();
return placeForceOrderWithHttpInfo(userId, userSecret, manualTradeFormWithOptions);
}
/**
* Execute placeForceOrder request (asynchronously)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
500
Unexpected Error
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
ManualTradeFormWithOptions manualTradeFormWithOptions = buildBodyParams();
return placeForceOrderAsync(userId, userSecret, manualTradeFormWithOptions, _callback);
}
}
/**
* Place order
* Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds. This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
* @param userId (required)
* @param userSecret (required)
* @param manualTradeFormWithOptions (required)
* @return PlaceForceOrderRequestBuilder
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
500
Unexpected Error
-
*/
public TradingApi.PlaceForceOrderRequestBuilder placeForceOrder(UUID accountId, ActionStrictWithOptions action, OrderTypeStrict orderType, TimeInForceStrict timeInForce, String userId, String userSecret) throws IllegalArgumentException {
if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null");
if (action == null) throw new IllegalArgumentException("\"action\" is required but got null");
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");
return ((TradingApi) this).new PlaceForceOrderRequestBuilder(accountId, action, orderType, timeInForce, userId, userSecret);
}
private okhttp3.Call placeOrderCall(UUID tradeId, String userId, String userSecret, ValidatedTradeBody validatedTradeBody, 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 = validatedTradeBody;
// create path and map variables
String localVarPath = "/trade/{tradeId}"
.replace("{" + "tradeId" + "}", localVarApiClient.escapeString(tradeId.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 placeOrderValidateBeforeCall(UUID tradeId, String userId, String userSecret, ValidatedTradeBody validatedTradeBody, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'tradeId' is set
if (tradeId == null) {
throw new ApiException("Missing the required parameter 'tradeId' when calling placeOrder(Async)");
}
// verify the required parameter 'userId' is set
if (userId == null) {
throw new ApiException("Missing the required parameter 'userId' when calling placeOrder(Async)");
}
// verify the required parameter 'userSecret' is set
if (userSecret == null) {
throw new ApiException("Missing the required parameter 'userSecret' when calling placeOrder(Async)");
}
return placeOrderCall(tradeId, userId, userSecret, validatedTradeBody, _callback);
}
private ApiResponse placeOrderWithHttpInfo(UUID tradeId, String userId, String userSecret, ValidatedTradeBody validatedTradeBody) throws ApiException {
okhttp3.Call localVarCall = placeOrderValidateBeforeCall(tradeId, userId, userSecret, validatedTradeBody, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
private okhttp3.Call placeOrderAsync(UUID tradeId, String userId, String userSecret, ValidatedTradeBody validatedTradeBody, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = placeOrderValidateBeforeCall(tradeId, userId, userSecret, validatedTradeBody, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public abstract class PlaceOrderRequestBuilderGenerated {
final UUID tradeId;
final String userId;
final String userSecret;
Boolean waitToConfirm;
public PlaceOrderRequestBuilderGenerated(UUID tradeId, String userId, String userSecret) {
this.tradeId = tradeId;
this.userId = userId;
this.userSecret = userSecret;
}
/**
* Set waitToConfirm
* @param waitToConfirm Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status `PENDING` as we will not wait to check on the status before responding to the request. (optional)
* @return TradingApi.PlaceOrderRequestBuilder
*/
public TradingApi.PlaceOrderRequestBuilder waitToConfirm(Boolean waitToConfirm) {
this.waitToConfirm = waitToConfirm;
return (TradingApi.PlaceOrderRequestBuilder) this;
}
/**
* Build call for placeOrder
* @param _callback ApiCallback API callback
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
Status of order placed
-
500
Unexpected Error
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
ValidatedTradeBody validatedTradeBody = buildBodyParams();
return placeOrderCall(tradeId, userId, userSecret, validatedTradeBody, _callback);
}
private ValidatedTradeBody buildBodyParams() {
ValidatedTradeBody validatedTradeBody = new ValidatedTradeBody();
validatedTradeBody.waitToConfirm(this.waitToConfirm);
return validatedTradeBody;
}
/**
* Execute placeOrder request
* @return AccountOrderRecord
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
Status of order placed
-
500
Unexpected Error
-
*/
public AccountOrderRecord execute() throws ApiException {
ValidatedTradeBody validatedTradeBody = buildBodyParams();
ApiResponse localVarResp = placeOrderWithHttpInfo(tradeId, userId, userSecret, validatedTradeBody);
return localVarResp.getResponseBody();
}
/**
* Execute placeOrder request with HTTP info returned
* @return ApiResponse<AccountOrderRecord>
* @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 order placed
-
500
Unexpected Error
-
*/
public ApiResponse executeWithHttpInfo() throws ApiException {
ValidatedTradeBody validatedTradeBody = buildBodyParams();
return placeOrderWithHttpInfo(tradeId, userId, userSecret, validatedTradeBody);
}
/**
* Execute placeOrder request (asynchronously)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code
Description
Response Headers
200
Status of order placed
-
500
Unexpected Error
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
ValidatedTradeBody validatedTradeBody = buildBodyParams();
return placeOrderAsync(tradeId, userId, userSecret, validatedTradeBody, _callback);
}
}
/**
* Place checked order
* Places the previously checked order with the brokerage. The `tradeId` is obtained from the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). If you prefer to place the order without checking for impact first, you can use the [place order endpoint](/reference/Trading/Trading_placeForceOrder). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
* @param tradeId Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact) (required)
* @param userId (required)
* @param userSecret (required)
* @return PlaceOrderRequestBuilder
* @http.response.details
Status Code
Description
Response Headers
200
Status of order placed
-
500
Unexpected Error
-
*/
public TradingApi.PlaceOrderRequestBuilder placeOrder(UUID tradeId, String userId, String userSecret) throws IllegalArgumentException {
if (tradeId == null) throw new IllegalArgumentException("\"tradeId\" is required but got null");
if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null");
if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null");
return ((TradingApi) this).new PlaceOrderRequestBuilder(tradeId, userId, userSecret);
}
}