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

io.swagger.client.api.TradeProfitAndLossApi Maven / Gradle / Ivy

/*
 * Upstox Developer API
 * Build your App on the Upstox platform  ![Banner](https://api-v2.upstox.com/api-docs/images/banner.jpg \"banner\")  # Introduction  Upstox API is a set of rest APIs that provide data required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (using Websocket), and more, with the easy to understand API collection.  All requests are over HTTPS and the requests are sent with the content-type ‘application/json’. Developers have the option of choosing the response type as JSON or CSV for a few API calls.  To be able to use these APIs you need to create an App in the Developer Console and generate your **apiKey** and **apiSecret**. You can use a redirect URL which will be called after the login flow.  If you are a **trader**, you can directly create apps from Upstox mobile app or the desktop platform itself from **Apps** sections inside the **Account** Tab. Head over to account.upstox.com/developer/apps.
If you are a **business** looking to integrate Upstox APIs, reach out to us and we will get a custom app created for you in no time. It is highly recommended that you do not embed the **apiSecret** in your frontend app. Create a remote backend which does the handshake on behalf of the frontend app. Marking the apiSecret in the frontend app will make your app vulnerable to threats and potential issues. * * OpenAPI spec version: v2 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package io.swagger.client.api; import com.upstox.ApiCallback; import com.upstox.ApiClient; import com.upstox.ApiException; import com.upstox.ApiResponse; import com.upstox.Configuration; import com.upstox.Pair; import com.upstox.ProgressRequestBody; import com.upstox.ProgressResponseBody; import com.google.gson.reflect.TypeToken; import java.io.IOException; import com.upstox.api.ApiGatewayErrorResponse; import com.upstox.api.GetProfitAndLossChargesResponse; import com.upstox.api.GetTradeWiseProfitAndLossDataResponse; import com.upstox.api.GetTradeWiseProfitAndLossMetaDataResponse; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class TradeProfitAndLossApi { private ApiClient apiClient; public TradeProfitAndLossApi() { this(Configuration.getDefaultApiClient()); } public TradeProfitAndLossApi(ApiClient apiClient) { this.apiClient = apiClient; } public ApiClient getApiClient() { return apiClient; } public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /** * Build call for getProfitAndLossCharges * @param segment Segment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives (required) * @param financialYear Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 (required) * @param apiVersion API Version Header (required) * @param fromDate Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param toDate Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getProfitAndLossChargesCall(String segment, String financialYear, String apiVersion, String fromDate, String toDate, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/v2/trade/profit-loss/charges"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (fromDate != null) localVarQueryParams.addAll(apiClient.parameterToPair("from_date", fromDate)); if (toDate != null) localVarQueryParams.addAll(apiClient.parameterToPair("to_date", toDate)); if (segment != null) localVarQueryParams.addAll(apiClient.parameterToPair("segment", segment)); if (financialYear != null) localVarQueryParams.addAll(apiClient.parameterToPair("financial_year", financialYear)); Map localVarHeaderParams = new HashMap(); if (apiVersion != null) localVarHeaderParams.put("Api-Version", apiClient.parameterToString(apiVersion)); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json", "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "OAUTH2" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call getProfitAndLossChargesValidateBeforeCall(String segment, String financialYear, String apiVersion, String fromDate, String toDate, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'segment' is set if (segment == null) { throw new ApiException("Missing the required parameter 'segment' when calling getProfitAndLossCharges(Async)"); } // verify the required parameter 'financialYear' is set if (financialYear == null) { throw new ApiException("Missing the required parameter 'financialYear' when calling getProfitAndLossCharges(Async)"); } // verify the required parameter 'apiVersion' is set if (apiVersion == null) { throw new ApiException("Missing the required parameter 'apiVersion' when calling getProfitAndLossCharges(Async)"); } com.squareup.okhttp.Call call = getProfitAndLossChargesCall(segment, financialYear, apiVersion, fromDate, toDate, progressListener, progressRequestListener); return call; } /** * Get profit and loss on trades * This API gives the charges incurred by users for their trades * @param segment Segment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives (required) * @param financialYear Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 (required) * @param apiVersion API Version Header (required) * @param fromDate Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param toDate Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @return GetProfitAndLossChargesResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public GetProfitAndLossChargesResponse getProfitAndLossCharges(String segment, String financialYear, String apiVersion, String fromDate, String toDate) throws ApiException { ApiResponse resp = getProfitAndLossChargesWithHttpInfo(segment, financialYear, apiVersion, fromDate, toDate); return resp.getData(); } /** * Get profit and loss on trades * This API gives the charges incurred by users for their trades * @param segment Segment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives (required) * @param financialYear Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 (required) * @param apiVersion API Version Header (required) * @param fromDate Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param toDate Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @return ApiResponse<GetProfitAndLossChargesResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getProfitAndLossChargesWithHttpInfo(String segment, String financialYear, String apiVersion, String fromDate, String toDate) throws ApiException { com.squareup.okhttp.Call call = getProfitAndLossChargesValidateBeforeCall(segment, financialYear, apiVersion, fromDate, toDate, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Get profit and loss on trades (asynchronously) * This API gives the charges incurred by users for their trades * @param segment Segment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives (required) * @param financialYear Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 (required) * @param apiVersion API Version Header (required) * @param fromDate Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param toDate Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @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 */ public com.squareup.okhttp.Call getProfitAndLossChargesAsync(String segment, String financialYear, String apiVersion, String fromDate, String toDate, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getProfitAndLossChargesValidateBeforeCall(segment, financialYear, apiVersion, fromDate, toDate, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for getTradeWiseProfitAndLossData * @param segment Segment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives (required) * @param financialYear Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 (required) * @param pageNumber Page Number, the pages are starting from 1 (required) * @param pageSize Page size for pagination. The maximum page size value is obtained from P and L report metadata API. (required) * @param apiVersion API Version Header (required) * @param fromDate Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param toDate Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getTradeWiseProfitAndLossDataCall(String segment, String financialYear, Integer pageNumber, Integer pageSize, String apiVersion, String fromDate, String toDate, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/v2/trade/profit-loss/data"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (fromDate != null) localVarQueryParams.addAll(apiClient.parameterToPair("from_date", fromDate)); if (toDate != null) localVarQueryParams.addAll(apiClient.parameterToPair("to_date", toDate)); if (segment != null) localVarQueryParams.addAll(apiClient.parameterToPair("segment", segment)); if (financialYear != null) localVarQueryParams.addAll(apiClient.parameterToPair("financial_year", financialYear)); if (pageNumber != null) localVarQueryParams.addAll(apiClient.parameterToPair("page_number", pageNumber)); if (pageSize != null) localVarQueryParams.addAll(apiClient.parameterToPair("page_size", pageSize)); Map localVarHeaderParams = new HashMap(); if (apiVersion != null) localVarHeaderParams.put("Api-Version", apiClient.parameterToString(apiVersion)); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json", "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "OAUTH2" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call getTradeWiseProfitAndLossDataValidateBeforeCall(String segment, String financialYear, Integer pageNumber, Integer pageSize, String apiVersion, String fromDate, String toDate, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'segment' is set if (segment == null) { throw new ApiException("Missing the required parameter 'segment' when calling getTradeWiseProfitAndLossData(Async)"); } // verify the required parameter 'financialYear' is set if (financialYear == null) { throw new ApiException("Missing the required parameter 'financialYear' when calling getTradeWiseProfitAndLossData(Async)"); } // verify the required parameter 'pageNumber' is set if (pageNumber == null) { throw new ApiException("Missing the required parameter 'pageNumber' when calling getTradeWiseProfitAndLossData(Async)"); } // verify the required parameter 'pageSize' is set if (pageSize == null) { throw new ApiException("Missing the required parameter 'pageSize' when calling getTradeWiseProfitAndLossData(Async)"); } // verify the required parameter 'apiVersion' is set if (apiVersion == null) { throw new ApiException("Missing the required parameter 'apiVersion' when calling getTradeWiseProfitAndLossData(Async)"); } com.squareup.okhttp.Call call = getTradeWiseProfitAndLossDataCall(segment, financialYear, pageNumber, pageSize, apiVersion, fromDate, toDate, progressListener, progressRequestListener); return call; } /** * Get Trade-wise Profit and Loss Report Data * This API gives the data of the realised Profit and Loss report requested by a user * @param segment Segment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives (required) * @param financialYear Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 (required) * @param pageNumber Page Number, the pages are starting from 1 (required) * @param pageSize Page size for pagination. The maximum page size value is obtained from P and L report metadata API. (required) * @param apiVersion API Version Header (required) * @param fromDate Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param toDate Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @return GetTradeWiseProfitAndLossDataResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public GetTradeWiseProfitAndLossDataResponse getTradeWiseProfitAndLossData(String segment, String financialYear, Integer pageNumber, Integer pageSize, String apiVersion, String fromDate, String toDate) throws ApiException { ApiResponse resp = getTradeWiseProfitAndLossDataWithHttpInfo(segment, financialYear, pageNumber, pageSize, apiVersion, fromDate, toDate); return resp.getData(); } /** * Get Trade-wise Profit and Loss Report Data * This API gives the data of the realised Profit and Loss report requested by a user * @param segment Segment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives (required) * @param financialYear Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 (required) * @param pageNumber Page Number, the pages are starting from 1 (required) * @param pageSize Page size for pagination. The maximum page size value is obtained from P and L report metadata API. (required) * @param apiVersion API Version Header (required) * @param fromDate Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param toDate Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @return ApiResponse<GetTradeWiseProfitAndLossDataResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getTradeWiseProfitAndLossDataWithHttpInfo(String segment, String financialYear, Integer pageNumber, Integer pageSize, String apiVersion, String fromDate, String toDate) throws ApiException { com.squareup.okhttp.Call call = getTradeWiseProfitAndLossDataValidateBeforeCall(segment, financialYear, pageNumber, pageSize, apiVersion, fromDate, toDate, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Get Trade-wise Profit and Loss Report Data (asynchronously) * This API gives the data of the realised Profit and Loss report requested by a user * @param segment Segment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives (required) * @param financialYear Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 (required) * @param pageNumber Page Number, the pages are starting from 1 (required) * @param pageSize Page size for pagination. The maximum page size value is obtained from P and L report metadata API. (required) * @param apiVersion API Version Header (required) * @param fromDate Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param toDate Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @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 */ public com.squareup.okhttp.Call getTradeWiseProfitAndLossDataAsync(String segment, String financialYear, Integer pageNumber, Integer pageSize, String apiVersion, String fromDate, String toDate, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getTradeWiseProfitAndLossDataValidateBeforeCall(segment, financialYear, pageNumber, pageSize, apiVersion, fromDate, toDate, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for getTradeWiseProfitAndLossMetaData * @param segment Segment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives (required) * @param financialYear Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 (required) * @param apiVersion API Version Header (required) * @param fromDate Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param toDate Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getTradeWiseProfitAndLossMetaDataCall(String segment, String financialYear, String apiVersion, String fromDate, String toDate, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/v2/trade/profit-loss/metadata"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (fromDate != null) localVarQueryParams.addAll(apiClient.parameterToPair("from_date", fromDate)); if (toDate != null) localVarQueryParams.addAll(apiClient.parameterToPair("to_date", toDate)); if (segment != null) localVarQueryParams.addAll(apiClient.parameterToPair("segment", segment)); if (financialYear != null) localVarQueryParams.addAll(apiClient.parameterToPair("financial_year", financialYear)); Map localVarHeaderParams = new HashMap(); if (apiVersion != null) localVarHeaderParams.put("Api-Version", apiClient.parameterToString(apiVersion)); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json", "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "OAUTH2" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call getTradeWiseProfitAndLossMetaDataValidateBeforeCall(String segment, String financialYear, String apiVersion, String fromDate, String toDate, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'segment' is set if (segment == null) { throw new ApiException("Missing the required parameter 'segment' when calling getTradeWiseProfitAndLossMetaData(Async)"); } // verify the required parameter 'financialYear' is set if (financialYear == null) { throw new ApiException("Missing the required parameter 'financialYear' when calling getTradeWiseProfitAndLossMetaData(Async)"); } // verify the required parameter 'apiVersion' is set if (apiVersion == null) { throw new ApiException("Missing the required parameter 'apiVersion' when calling getTradeWiseProfitAndLossMetaData(Async)"); } com.squareup.okhttp.Call call = getTradeWiseProfitAndLossMetaDataCall(segment, financialYear, apiVersion, fromDate, toDate, progressListener, progressRequestListener); return call; } /** * Get profit and loss meta data on trades * This API gives the data of the realised Profit and Loss report requested by a user * @param segment Segment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives (required) * @param financialYear Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 (required) * @param apiVersion API Version Header (required) * @param fromDate Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param toDate Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @return GetTradeWiseProfitAndLossMetaDataResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public GetTradeWiseProfitAndLossMetaDataResponse getTradeWiseProfitAndLossMetaData(String segment, String financialYear, String apiVersion, String fromDate, String toDate) throws ApiException { ApiResponse resp = getTradeWiseProfitAndLossMetaDataWithHttpInfo(segment, financialYear, apiVersion, fromDate, toDate); return resp.getData(); } /** * Get profit and loss meta data on trades * This API gives the data of the realised Profit and Loss report requested by a user * @param segment Segment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives (required) * @param financialYear Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 (required) * @param apiVersion API Version Header (required) * @param fromDate Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param toDate Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @return ApiResponse<GetTradeWiseProfitAndLossMetaDataResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getTradeWiseProfitAndLossMetaDataWithHttpInfo(String segment, String financialYear, String apiVersion, String fromDate, String toDate) throws ApiException { com.squareup.okhttp.Call call = getTradeWiseProfitAndLossMetaDataValidateBeforeCall(segment, financialYear, apiVersion, fromDate, toDate, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Get profit and loss meta data on trades (asynchronously) * This API gives the data of the realised Profit and Loss report requested by a user * @param segment Segment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives (required) * @param financialYear Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 (required) * @param apiVersion API Version Header (required) * @param fromDate Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @param toDate Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) * @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 */ public com.squareup.okhttp.Call getTradeWiseProfitAndLossMetaDataAsync(String segment, String financialYear, String apiVersion, String fromDate, String toDate, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getTradeWiseProfitAndLossMetaDataValidateBeforeCall(segment, financialYear, apiVersion, fromDate, toDate, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy