All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.konfigthis.client.api.TradingApiGenerated Maven / Gradle / Ivy

Go to download

Connect brokerage accounts to your app for live positions and trading This library was generated by https://konfigthis.com

There is a newer version: 5.0.55
Show newest version
/*
 * 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.ManualTradeAndImpact;
import com.konfigthis.client.model.ManualTradeForm;
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;
        UUID brokerageOrderId;

        public CancelUserAccountOrderRequestBuilderGenerated(String userId, String userSecret, UUID accountId) {
            this.userId = userId;
            this.userSecret = userSecret;
            this.accountId = accountId;
        }

        /**
         * Set brokerageOrderId
         * @param brokerageOrderId  (optional)
         * @return TradingApi.CancelUserAccountOrderRequestBuilder
         */
        public TradingApi.CancelUserAccountOrderRequestBuilder brokerageOrderId(UUID 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 open order in account * Sends a signal to the brokerage to cancel the specified order. This will only work if the order has not yet been executed. * @param userId (required) * @param userSecret (required) * @param accountId The ID of the account to cancel the order in. (required) * @param tradingCancelUserAccountOrderRequest The Order ID to be canceled (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 String userId; final String userSecret; UUID accountId; ActionStrict action; OrderTypeStrict orderType; Double price; Double stop; TimeInForceStrict timeInForce; Double units; UUID universalSymbolId; Object notionalValue; public GetOrderImpactRequestBuilderGenerated(String userId, String userSecret) { this.userId = userId; this.userSecret = userSecret; } /** * Set accountId * @param accountId (optional) * @return TradingApi.GetOrderImpactRequestBuilder */ public TradingApi.GetOrderImpactRequestBuilder accountId(UUID accountId) { this.accountId = accountId; return (TradingApi.GetOrderImpactRequestBuilder) this; } /** * Set action * @param action (optional) * @return TradingApi.GetOrderImpactRequestBuilder */ public TradingApi.GetOrderImpactRequestBuilder action(ActionStrict action) { this.action = action; return (TradingApi.GetOrderImpactRequestBuilder) this; } /** * Set orderType * @param orderType (optional) * @return TradingApi.GetOrderImpactRequestBuilder */ public TradingApi.GetOrderImpactRequestBuilder orderType(OrderTypeStrict orderType) { this.orderType = orderType; return (TradingApi.GetOrderImpactRequestBuilder) this; } /** * Set price * @param price Trade Price if limit or stop limit order (optional) * @return TradingApi.GetOrderImpactRequestBuilder */ public TradingApi.GetOrderImpactRequestBuilder price(Double price) { this.price = price; return (TradingApi.GetOrderImpactRequestBuilder) this; } /** * Set price * @param price Trade Price if limit or stop limit order (optional) * @return TradingApi.GetOrderImpactRequestBuilder */ public TradingApi.GetOrderImpactRequestBuilder price(Integer price) { this.price = price.doubleValue(); return (TradingApi.GetOrderImpactRequestBuilder) this; } /** * Set stop * @param stop Stop Price. If stop loss or stop limit order, the price to trigger the stop (optional) * @return TradingApi.GetOrderImpactRequestBuilder */ public TradingApi.GetOrderImpactRequestBuilder stop(Double stop) { this.stop = stop; return (TradingApi.GetOrderImpactRequestBuilder) this; } /** * Set stop * @param stop Stop Price. If stop loss or stop limit order, the price to trigger the stop (optional) * @return TradingApi.GetOrderImpactRequestBuilder */ public TradingApi.GetOrderImpactRequestBuilder stop(Integer stop) { this.stop = stop.doubleValue(); return (TradingApi.GetOrderImpactRequestBuilder) this; } /** * Set timeInForce * @param timeInForce (optional) * @return TradingApi.GetOrderImpactRequestBuilder */ public TradingApi.GetOrderImpactRequestBuilder timeInForce(TimeInForceStrict timeInForce) { this.timeInForce = timeInForce; return (TradingApi.GetOrderImpactRequestBuilder) this; } /** * Set units * @param units Trade Units. Cannot work with notional value. (optional) * @return TradingApi.GetOrderImpactRequestBuilder */ public TradingApi.GetOrderImpactRequestBuilder units(Double units) { this.units = units; return (TradingApi.GetOrderImpactRequestBuilder) this; } /** * Set units * @param units Trade Units. Cannot work with notional value. (optional) * @return TradingApi.GetOrderImpactRequestBuilder */ public TradingApi.GetOrderImpactRequestBuilder units(Integer units) { this.units = units.doubleValue(); return (TradingApi.GetOrderImpactRequestBuilder) this; } /** * Set universalSymbolId * @param universalSymbolId (optional) * @return TradingApi.GetOrderImpactRequestBuilder */ public TradingApi.GetOrderImpactRequestBuilder universalSymbolId(UUID universalSymbolId) { this.universalSymbolId = universalSymbolId; 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 Return trade object and it's impact on the account -
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.orderType(this.orderType); manualTradeForm.price(this.price); manualTradeForm.stop(this.stop); manualTradeForm.timeInForce(this.timeInForce); manualTradeForm.units(this.units); manualTradeForm.universalSymbolId(this.universalSymbolId); 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 Return trade object and it's impact on the account -
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 Return trade object and it's impact on the account -
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 Return trade object and it's impact on the account -
500 Unexpected Error -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { ManualTradeForm manualTradeForm = buildBodyParams(); return getOrderImpactAsync(userId, userSecret, manualTradeForm, _callback); } } /** * Check the impact of a trade on an account * Return the trade object and it's impact on the account for the specified order. * @param userId (required) * @param userSecret (required) * @param manualTradeForm (required) * @return GetOrderImpactRequestBuilder * @http.response.details
Status Code Description Response Headers
200 Return trade object and it's impact on the account -
500 Unexpected Error -
*/ public TradingApi.GetOrderImpactRequestBuilder getOrderImpact(String userId, String userSecret) throws IllegalArgumentException { if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); return ((TradingApi) this).new GetOrderImpactRequestBuilder(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 providing tickers. (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 Returns quotes object with different prices -
*/ 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 Returns quotes object with different prices -
*/ 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 Returns quotes object with different prices -
*/ 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 Returns quotes object with different prices -
*/ public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { return getUserAccountQuotesAsync(userId, userSecret, symbols, accountId, useTicker, _callback); } } /** * Get symbol quotes * Returns quote(s) from the brokerage for the specified symbol(s). * @param userId (required) * @param userSecret (required) * @param symbols List of universal_symbol_id or tickers to get quotes for. (required) * @param accountId The ID of the account to get quotes. (required) * @return GetUserAccountQuotesRequestBuilder * @http.response.details
Status Code Description Response Headers
200 Returns quotes object with different prices -
*/ 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, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = manualTradeForm; // create path and map variables String localVarPath = "/trade/place"; List 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, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException { // verify the required parameter 'userId' is set if (userId == null) { throw new ApiException("Missing the required parameter 'userId' when calling placeForceOrder(Async)"); } // verify the required parameter 'userSecret' is set if (userSecret == null) { throw new ApiException("Missing the required parameter 'userSecret' when calling placeForceOrder(Async)"); } // verify the required parameter 'manualTradeForm' is set if (manualTradeForm == null) { throw new ApiException("Missing the required parameter 'manualTradeForm' when calling placeForceOrder(Async)"); } return placeForceOrderCall(userId, userSecret, manualTradeForm, _callback); } private ApiResponse placeForceOrderWithHttpInfo(String userId, String userSecret, ManualTradeForm manualTradeForm) throws ApiException { okhttp3.Call localVarCall = placeForceOrderValidateBeforeCall(userId, userSecret, manualTradeForm, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } private okhttp3.Call placeForceOrderAsync(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = placeForceOrderValidateBeforeCall(userId, userSecret, manualTradeForm, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } public abstract class PlaceForceOrderRequestBuilderGenerated { final String userId; final String userSecret; UUID accountId; ActionStrict action; OrderTypeStrict orderType; Double price; Double stop; TimeInForceStrict timeInForce; Double units; UUID universalSymbolId; Object notionalValue; public PlaceForceOrderRequestBuilderGenerated(String userId, String userSecret) { this.userId = userId; this.userSecret = userSecret; } /** * Set accountId * @param accountId (optional) * @return TradingApi.PlaceForceOrderRequestBuilder */ public TradingApi.PlaceForceOrderRequestBuilder accountId(UUID accountId) { this.accountId = accountId; return (TradingApi.PlaceForceOrderRequestBuilder) this; } /** * Set action * @param action (optional) * @return TradingApi.PlaceForceOrderRequestBuilder */ public TradingApi.PlaceForceOrderRequestBuilder action(ActionStrict action) { this.action = action; return (TradingApi.PlaceForceOrderRequestBuilder) this; } /** * Set orderType * @param orderType (optional) * @return TradingApi.PlaceForceOrderRequestBuilder */ public TradingApi.PlaceForceOrderRequestBuilder orderType(OrderTypeStrict orderType) { this.orderType = orderType; return (TradingApi.PlaceForceOrderRequestBuilder) this; } /** * Set price * @param price Trade Price if limit or stop limit order (optional) * @return TradingApi.PlaceForceOrderRequestBuilder */ public TradingApi.PlaceForceOrderRequestBuilder price(Double price) { this.price = price; return (TradingApi.PlaceForceOrderRequestBuilder) this; } /** * Set price * @param price Trade Price if limit or stop limit order (optional) * @return TradingApi.PlaceForceOrderRequestBuilder */ public TradingApi.PlaceForceOrderRequestBuilder price(Integer price) { this.price = price.doubleValue(); return (TradingApi.PlaceForceOrderRequestBuilder) this; } /** * Set stop * @param stop Stop Price. If stop loss or stop limit order, the price to trigger the stop (optional) * @return TradingApi.PlaceForceOrderRequestBuilder */ public TradingApi.PlaceForceOrderRequestBuilder stop(Double stop) { this.stop = stop; return (TradingApi.PlaceForceOrderRequestBuilder) this; } /** * Set stop * @param stop Stop Price. If stop loss or stop limit order, the price to trigger the stop (optional) * @return TradingApi.PlaceForceOrderRequestBuilder */ public TradingApi.PlaceForceOrderRequestBuilder stop(Integer stop) { this.stop = stop.doubleValue(); return (TradingApi.PlaceForceOrderRequestBuilder) this; } /** * Set timeInForce * @param timeInForce (optional) * @return TradingApi.PlaceForceOrderRequestBuilder */ public TradingApi.PlaceForceOrderRequestBuilder timeInForce(TimeInForceStrict timeInForce) { this.timeInForce = timeInForce; return (TradingApi.PlaceForceOrderRequestBuilder) this; } /** * Set units * @param units Trade Units. Cannot work with notional value. (optional) * @return TradingApi.PlaceForceOrderRequestBuilder */ public TradingApi.PlaceForceOrderRequestBuilder units(Double units) { this.units = units; return (TradingApi.PlaceForceOrderRequestBuilder) this; } /** * Set units * @param units Trade Units. Cannot work with notional value. (optional) * @return TradingApi.PlaceForceOrderRequestBuilder */ public TradingApi.PlaceForceOrderRequestBuilder units(Integer units) { this.units = units.doubleValue(); return (TradingApi.PlaceForceOrderRequestBuilder) this; } /** * Set universalSymbolId * @param universalSymbolId (optional) * @return TradingApi.PlaceForceOrderRequestBuilder */ public TradingApi.PlaceForceOrderRequestBuilder universalSymbolId(UUID universalSymbolId) { this.universalSymbolId = universalSymbolId; 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 Trade sucessfully placed -
500 Unexpected Error -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { ManualTradeForm manualTradeForm = buildBodyParams(); return placeForceOrderCall(userId, userSecret, manualTradeForm, _callback); } private ManualTradeForm buildBodyParams() { ManualTradeForm manualTradeForm = new ManualTradeForm(); manualTradeForm.accountId(this.accountId); manualTradeForm.action(this.action); manualTradeForm.orderType(this.orderType); manualTradeForm.price(this.price); manualTradeForm.stop(this.stop); manualTradeForm.timeInForce(this.timeInForce); manualTradeForm.units(this.units); manualTradeForm.universalSymbolId(this.universalSymbolId); manualTradeForm.notionalValue(this.notionalValue); return manualTradeForm; } /** * Execute placeForceOrder request * @return AccountOrderRecord * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Trade sucessfully placed -
500 Unexpected Error -
*/ public AccountOrderRecord execute() throws ApiException { ManualTradeForm manualTradeForm = buildBodyParams(); ApiResponse localVarResp = placeForceOrderWithHttpInfo(userId, userSecret, manualTradeForm); 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 Trade sucessfully placed -
500 Unexpected Error -
*/ public ApiResponse executeWithHttpInfo() throws ApiException { ManualTradeForm manualTradeForm = buildBodyParams(); return placeForceOrderWithHttpInfo(userId, userSecret, manualTradeForm); } /** * Execute placeForceOrder request (asynchronously) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 Trade sucessfully placed -
500 Unexpected Error -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { ManualTradeForm manualTradeForm = buildBodyParams(); return placeForceOrderAsync(userId, userSecret, manualTradeForm, _callback); } } /** * Place a trade with NO validation. * Places a specified trade in the specified account. * @param userId (required) * @param userSecret (required) * @param manualTradeForm (required) * @return PlaceForceOrderRequestBuilder * @http.response.details
Status Code Description Response Headers
200 Trade sucessfully placed -
500 Unexpected Error -
*/ public TradingApi.PlaceForceOrderRequestBuilder placeForceOrder(String userId, String userSecret) throws IllegalArgumentException { if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); return ((TradingApi) this).new PlaceForceOrderRequestBuilder(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 order * Places the specified trade object. This places the order in the account and returns the status of the order from the brokerage. * @param tradeId The ID of trade object obtained from trade/impact endpoint (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); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy