/* tslint:disable */
/* eslint-disable */
/**
 * Kalshi Trade API Manual Endpoints
 * Manually defined OpenAPI spec for endpoints being migrated to spec-first approach
 *
 * The version of the OpenAPI document: 3.11.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// URLSearchParams not necessarily used
// @ts-ignore
import { URL, URLSearchParams } from 'url';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError } from '../base';
// @ts-ignore
import type { ApplySubaccountTransferRequest } from '../models';
// @ts-ignore
import type { CreateSubaccountResponse } from '../models';
// @ts-ignore
import type { ErrorResponse } from '../models';
// @ts-ignore
import type { GetBalanceResponse } from '../models';
// @ts-ignore
import type { GetFillsResponse } from '../models';
// @ts-ignore
import type { GetPortfolioRestingOrderTotalValueResponse } from '../models';
// @ts-ignore
import type { GetPositionsResponse } from '../models';
// @ts-ignore
import type { GetSettlementsResponse } from '../models';
// @ts-ignore
import type { GetSubaccountBalancesResponse } from '../models';
// @ts-ignore
import type { GetSubaccountNettingResponse } from '../models';
// @ts-ignore
import type { GetSubaccountTransfersResponse } from '../models';
// @ts-ignore
import type { UpdateSubaccountNettingRequest } from '../models';
/**
 * PortfolioApi - axios parameter creator
 */
export const PortfolioApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Transfers funds between the authenticated user\'s subaccounts. Use 0 for the primary account, or 1-32 for numbered subaccounts.
         * @summary Transfer Between Subaccounts
         * @param {ApplySubaccountTransferRequest} applySubaccountTransferRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        applySubaccountTransfer: async (applySubaccountTransferRequest: ApplySubaccountTransferRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'applySubaccountTransferRequest' is not null or undefined
            assertParamExists('applySubaccountTransfer', 'applySubaccountTransferRequest', applySubaccountTransferRequest)
            const localVarPath = `/portfolio/subaccounts/transfer`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication kalshiAccessSignature required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration)

            // authentication kalshiAccessKey required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration)

            // authentication kalshiAccessTimestamp required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(applySubaccountTransferRequest, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Creates a new subaccount for the authenticated user. Subaccounts are numbered sequentially starting from 1. Maximum 32 subaccounts per user.
         * @summary Create Subaccount
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createSubaccount: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/portfolio/subaccounts`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication kalshiAccessSignature required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration)

            // authentication kalshiAccessKey required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration)

            // authentication kalshiAccessTimestamp required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         *  Endpoint for getting the balance and portfolio value of a member. Both values are returned in cents.
         * @summary Get Balance
         * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getBalance: async (subaccount?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/portfolio/balance`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication kalshiAccessSignature required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration)

            // authentication kalshiAccessKey required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration)

            // authentication kalshiAccessTimestamp required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration)

            if (subaccount !== undefined) {
                localVarQueryParameter['subaccount'] = subaccount;
            }


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Endpoint for getting all fills for the member. A fill is when a trade you have is matched. Fills that occurred before the historical cutoff are only available via `GET /historical/fills`. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details. 
         * @summary Get Fills
         * @param {string} [ticker] Filter by market ticker
         * @param {string} [orderId] Filter by order ID
         * @param {number} [minTs] Filter items after this Unix timestamp
         * @param {number} [maxTs] Filter items before this Unix timestamp
         * @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 200.
         * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
         * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getFills: async (ticker?: string, orderId?: string, minTs?: number, maxTs?: number, limit?: number, cursor?: string, subaccount?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/portfolio/fills`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication kalshiAccessSignature required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration)

            // authentication kalshiAccessKey required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration)

            // authentication kalshiAccessTimestamp required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration)

            if (ticker !== undefined) {
                localVarQueryParameter['ticker'] = ticker;
            }

            if (orderId !== undefined) {
                localVarQueryParameter['order_id'] = orderId;
            }

            if (minTs !== undefined) {
                localVarQueryParameter['min_ts'] = minTs;
            }

            if (maxTs !== undefined) {
                localVarQueryParameter['max_ts'] = maxTs;
            }

            if (limit !== undefined) {
                localVarQueryParameter['limit'] = limit;
            }

            if (cursor !== undefined) {
                localVarQueryParameter['cursor'] = cursor;
            }

            if (subaccount !== undefined) {
                localVarQueryParameter['subaccount'] = subaccount;
            }


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         *  Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended for use by FCM members (rare). Note: If you\'re uncertain about this endpoint, it likely does not apply to you.
         * @summary Get Total Resting Order Value
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getPortfolioRestingOrderTotalValue: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/portfolio/summary/total_resting_order_value`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication kalshiAccessSignature required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration)

            // authentication kalshiAccessKey required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration)

            // authentication kalshiAccessTimestamp required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted: position, total_traded
         * @summary Get Positions
         * @param {string} [cursor] The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.
         * @param {number} [limit] Parameter to specify the number of results per page. Defaults to 100.
         * @param {string} [countFilter] Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted - position, total_traded
         * @param {string} [ticker] Filter by market ticker
         * @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
         * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getPositions: async (cursor?: string, limit?: number, countFilter?: string, ticker?: string, eventTicker?: string, subaccount?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/portfolio/positions`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication kalshiAccessSignature required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration)

            // authentication kalshiAccessKey required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration)

            // authentication kalshiAccessTimestamp required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration)

            if (cursor !== undefined) {
                localVarQueryParameter['cursor'] = cursor;
            }

            if (limit !== undefined) {
                localVarQueryParameter['limit'] = limit;
            }

            if (countFilter !== undefined) {
                localVarQueryParameter['count_filter'] = countFilter;
            }

            if (ticker !== undefined) {
                localVarQueryParameter['ticker'] = ticker;
            }

            if (eventTicker !== undefined) {
                localVarQueryParameter['event_ticker'] = eventTicker;
            }

            if (subaccount !== undefined) {
                localVarQueryParameter['subaccount'] = subaccount;
            }


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         *  Endpoint for getting the member\'s settlements historical track.
         * @summary Get Settlements
         * @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 200.
         * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
         * @param {string} [ticker] Filter by market ticker
         * @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
         * @param {number} [minTs] Filter items after this Unix timestamp
         * @param {number} [maxTs] Filter items before this Unix timestamp
         * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSettlements: async (limit?: number, cursor?: string, ticker?: string, eventTicker?: string, minTs?: number, maxTs?: number, subaccount?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/portfolio/settlements`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication kalshiAccessSignature required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration)

            // authentication kalshiAccessKey required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration)

            // authentication kalshiAccessTimestamp required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration)

            if (limit !== undefined) {
                localVarQueryParameter['limit'] = limit;
            }

            if (cursor !== undefined) {
                localVarQueryParameter['cursor'] = cursor;
            }

            if (ticker !== undefined) {
                localVarQueryParameter['ticker'] = ticker;
            }

            if (eventTicker !== undefined) {
                localVarQueryParameter['event_ticker'] = eventTicker;
            }

            if (minTs !== undefined) {
                localVarQueryParameter['min_ts'] = minTs;
            }

            if (maxTs !== undefined) {
                localVarQueryParameter['max_ts'] = maxTs;
            }

            if (subaccount !== undefined) {
                localVarQueryParameter['subaccount'] = subaccount;
            }


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Gets balances for all subaccounts including the primary account.
         * @summary Get All Subaccount Balances
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSubaccountBalances: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/portfolio/subaccounts/balances`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication kalshiAccessSignature required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration)

            // authentication kalshiAccessKey required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration)

            // authentication kalshiAccessTimestamp required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Gets the netting enabled settings for all subaccounts.
         * @summary Get Subaccount Netting
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSubaccountNetting: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/portfolio/subaccounts/netting`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication kalshiAccessSignature required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration)

            // authentication kalshiAccessKey required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration)

            // authentication kalshiAccessTimestamp required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Gets a paginated list of all transfers between subaccounts for the authenticated user.
         * @summary Get Subaccount Transfers
         * @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 200.
         * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSubaccountTransfers: async (limit?: number, cursor?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/portfolio/subaccounts/transfers`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication kalshiAccessSignature required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration)

            // authentication kalshiAccessKey required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration)

            // authentication kalshiAccessTimestamp required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration)

            if (limit !== undefined) {
                localVarQueryParameter['limit'] = limit;
            }

            if (cursor !== undefined) {
                localVarQueryParameter['cursor'] = cursor;
            }


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Updates the netting enabled setting for a specific subaccount. Use 0 for the primary account, or 1-32 for numbered subaccounts.
         * @summary Update Subaccount Netting
         * @param {UpdateSubaccountNettingRequest} updateSubaccountNettingRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateSubaccountNetting: async (updateSubaccountNettingRequest: UpdateSubaccountNettingRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'updateSubaccountNettingRequest' is not null or undefined
            assertParamExists('updateSubaccountNetting', 'updateSubaccountNettingRequest', updateSubaccountNettingRequest)
            const localVarPath = `/portfolio/subaccounts/netting`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication kalshiAccessSignature required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration)

            // authentication kalshiAccessKey required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration)

            // authentication kalshiAccessTimestamp required
            await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(updateSubaccountNettingRequest, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

/**
 * PortfolioApi - functional programming interface
 */
export const PortfolioApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = PortfolioApiAxiosParamCreator(configuration)
    return {
        /**
         * Transfers funds between the authenticated user\'s subaccounts. Use 0 for the primary account, or 1-32 for numbered subaccounts.
         * @summary Transfer Between Subaccounts
         * @param {ApplySubaccountTransferRequest} applySubaccountTransferRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async applySubaccountTransfer(applySubaccountTransferRequest: ApplySubaccountTransferRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.applySubaccountTransfer(applySubaccountTransferRequest, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath: string | undefined = undefined;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Creates a new subaccount for the authenticated user. Subaccounts are numbered sequentially starting from 1. Maximum 32 subaccounts per user.
         * @summary Create Subaccount
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createSubaccount(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateSubaccountResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createSubaccount(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath: string | undefined = undefined;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         *  Endpoint for getting the balance and portfolio value of a member. Both values are returned in cents.
         * @summary Get Balance
         * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getBalance(subaccount?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetBalanceResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getBalance(subaccount, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath: string | undefined = undefined;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Endpoint for getting all fills for the member. A fill is when a trade you have is matched. Fills that occurred before the historical cutoff are only available via `GET /historical/fills`. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details. 
         * @summary Get Fills
         * @param {string} [ticker] Filter by market ticker
         * @param {string} [orderId] Filter by order ID
         * @param {number} [minTs] Filter items after this Unix timestamp
         * @param {number} [maxTs] Filter items before this Unix timestamp
         * @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 200.
         * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
         * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getFills(ticker?: string, orderId?: string, minTs?: number, maxTs?: number, limit?: number, cursor?: string, subaccount?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetFillsResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getFills(ticker, orderId, minTs, maxTs, limit, cursor, subaccount, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath: string | undefined = undefined;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         *  Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended for use by FCM members (rare). Note: If you\'re uncertain about this endpoint, it likely does not apply to you.
         * @summary Get Total Resting Order Value
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getPortfolioRestingOrderTotalValue(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetPortfolioRestingOrderTotalValueResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getPortfolioRestingOrderTotalValue(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath: string | undefined = undefined;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted: position, total_traded
         * @summary Get Positions
         * @param {string} [cursor] The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.
         * @param {number} [limit] Parameter to specify the number of results per page. Defaults to 100.
         * @param {string} [countFilter] Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted - position, total_traded
         * @param {string} [ticker] Filter by market ticker
         * @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
         * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getPositions(cursor?: string, limit?: number, countFilter?: string, ticker?: string, eventTicker?: string, subaccount?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetPositionsResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getPositions(cursor, limit, countFilter, ticker, eventTicker, subaccount, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath: string | undefined = undefined;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         *  Endpoint for getting the member\'s settlements historical track.
         * @summary Get Settlements
         * @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 200.
         * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
         * @param {string} [ticker] Filter by market ticker
         * @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
         * @param {number} [minTs] Filter items after this Unix timestamp
         * @param {number} [maxTs] Filter items before this Unix timestamp
         * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getSettlements(limit?: number, cursor?: string, ticker?: string, eventTicker?: string, minTs?: number, maxTs?: number, subaccount?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetSettlementsResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getSettlements(limit, cursor, ticker, eventTicker, minTs, maxTs, subaccount, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath: string | undefined = undefined;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Gets balances for all subaccounts including the primary account.
         * @summary Get All Subaccount Balances
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getSubaccountBalances(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetSubaccountBalancesResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getSubaccountBalances(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath: string | undefined = undefined;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Gets the netting enabled settings for all subaccounts.
         * @summary Get Subaccount Netting
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getSubaccountNetting(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetSubaccountNettingResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getSubaccountNetting(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath: string | undefined = undefined;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Gets a paginated list of all transfers between subaccounts for the authenticated user.
         * @summary Get Subaccount Transfers
         * @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 200.
         * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getSubaccountTransfers(limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetSubaccountTransfersResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getSubaccountTransfers(limit, cursor, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath: string | undefined = undefined;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Updates the netting enabled setting for a specific subaccount. Use 0 for the primary account, or 1-32 for numbered subaccounts.
         * @summary Update Subaccount Netting
         * @param {UpdateSubaccountNettingRequest} updateSubaccountNettingRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateSubaccountNetting(updateSubaccountNettingRequest: UpdateSubaccountNettingRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateSubaccountNetting(updateSubaccountNettingRequest, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath: string | undefined = undefined;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * PortfolioApi - factory interface
 */
export const PortfolioApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = PortfolioApiFp(configuration)
    return {
        /**
         * Transfers funds between the authenticated user\'s subaccounts. Use 0 for the primary account, or 1-32 for numbered subaccounts.
         * @summary Transfer Between Subaccounts
         * @param {ApplySubaccountTransferRequest} applySubaccountTransferRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        applySubaccountTransfer(applySubaccountTransferRequest: ApplySubaccountTransferRequest, options?: RawAxiosRequestConfig): AxiosPromise<object> {
            return localVarFp.applySubaccountTransfer(applySubaccountTransferRequest, options).then((request) => request(axios, basePath));
        },
        /**
         * Creates a new subaccount for the authenticated user. Subaccounts are numbered sequentially starting from 1. Maximum 32 subaccounts per user.
         * @summary Create Subaccount
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createSubaccount(options?: RawAxiosRequestConfig): AxiosPromise<CreateSubaccountResponse> {
            return localVarFp.createSubaccount(options).then((request) => request(axios, basePath));
        },
        /**
         *  Endpoint for getting the balance and portfolio value of a member. Both values are returned in cents.
         * @summary Get Balance
         * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getBalance(subaccount?: number, options?: RawAxiosRequestConfig): AxiosPromise<GetBalanceResponse> {
            return localVarFp.getBalance(subaccount, options).then((request) => request(axios, basePath));
        },
        /**
         * Endpoint for getting all fills for the member. A fill is when a trade you have is matched. Fills that occurred before the historical cutoff are only available via `GET /historical/fills`. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details. 
         * @summary Get Fills
         * @param {string} [ticker] Filter by market ticker
         * @param {string} [orderId] Filter by order ID
         * @param {number} [minTs] Filter items after this Unix timestamp
         * @param {number} [maxTs] Filter items before this Unix timestamp
         * @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 200.
         * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
         * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getFills(ticker?: string, orderId?: string, minTs?: number, maxTs?: number, limit?: number, cursor?: string, subaccount?: number, options?: RawAxiosRequestConfig): AxiosPromise<GetFillsResponse> {
            return localVarFp.getFills(ticker, orderId, minTs, maxTs, limit, cursor, subaccount, options).then((request) => request(axios, basePath));
        },
        /**
         *  Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended for use by FCM members (rare). Note: If you\'re uncertain about this endpoint, it likely does not apply to you.
         * @summary Get Total Resting Order Value
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getPortfolioRestingOrderTotalValue(options?: RawAxiosRequestConfig): AxiosPromise<GetPortfolioRestingOrderTotalValueResponse> {
            return localVarFp.getPortfolioRestingOrderTotalValue(options).then((request) => request(axios, basePath));
        },
        /**
         * Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted: position, total_traded
         * @summary Get Positions
         * @param {string} [cursor] The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.
         * @param {number} [limit] Parameter to specify the number of results per page. Defaults to 100.
         * @param {string} [countFilter] Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted - position, total_traded
         * @param {string} [ticker] Filter by market ticker
         * @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
         * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getPositions(cursor?: string, limit?: number, countFilter?: string, ticker?: string, eventTicker?: string, subaccount?: number, options?: RawAxiosRequestConfig): AxiosPromise<GetPositionsResponse> {
            return localVarFp.getPositions(cursor, limit, countFilter, ticker, eventTicker, subaccount, options).then((request) => request(axios, basePath));
        },
        /**
         *  Endpoint for getting the member\'s settlements historical track.
         * @summary Get Settlements
         * @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 200.
         * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
         * @param {string} [ticker] Filter by market ticker
         * @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
         * @param {number} [minTs] Filter items after this Unix timestamp
         * @param {number} [maxTs] Filter items before this Unix timestamp
         * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSettlements(limit?: number, cursor?: string, ticker?: string, eventTicker?: string, minTs?: number, maxTs?: number, subaccount?: number, options?: RawAxiosRequestConfig): AxiosPromise<GetSettlementsResponse> {
            return localVarFp.getSettlements(limit, cursor, ticker, eventTicker, minTs, maxTs, subaccount, options).then((request) => request(axios, basePath));
        },
        /**
         * Gets balances for all subaccounts including the primary account.
         * @summary Get All Subaccount Balances
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSubaccountBalances(options?: RawAxiosRequestConfig): AxiosPromise<GetSubaccountBalancesResponse> {
            return localVarFp.getSubaccountBalances(options).then((request) => request(axios, basePath));
        },
        /**
         * Gets the netting enabled settings for all subaccounts.
         * @summary Get Subaccount Netting
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSubaccountNetting(options?: RawAxiosRequestConfig): AxiosPromise<GetSubaccountNettingResponse> {
            return localVarFp.getSubaccountNetting(options).then((request) => request(axios, basePath));
        },
        /**
         * Gets a paginated list of all transfers between subaccounts for the authenticated user.
         * @summary Get Subaccount Transfers
         * @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 200.
         * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSubaccountTransfers(limit?: number, cursor?: string, options?: RawAxiosRequestConfig): AxiosPromise<GetSubaccountTransfersResponse> {
            return localVarFp.getSubaccountTransfers(limit, cursor, options).then((request) => request(axios, basePath));
        },
        /**
         * Updates the netting enabled setting for a specific subaccount. Use 0 for the primary account, or 1-32 for numbered subaccounts.
         * @summary Update Subaccount Netting
         * @param {UpdateSubaccountNettingRequest} updateSubaccountNettingRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateSubaccountNetting(updateSubaccountNettingRequest: UpdateSubaccountNettingRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.updateSubaccountNetting(updateSubaccountNettingRequest, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * PortfolioApi - object-oriented interface
 */
export class PortfolioApi extends BaseAPI {
    /**
     * Transfers funds between the authenticated user\'s subaccounts. Use 0 for the primary account, or 1-32 for numbered subaccounts.
     * @summary Transfer Between Subaccounts
     * @param {ApplySubaccountTransferRequest} applySubaccountTransferRequest 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public applySubaccountTransfer(applySubaccountTransferRequest: ApplySubaccountTransferRequest, options?: RawAxiosRequestConfig) {
        return PortfolioApiFp(this.configuration).applySubaccountTransfer(applySubaccountTransferRequest, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Creates a new subaccount for the authenticated user. Subaccounts are numbered sequentially starting from 1. Maximum 32 subaccounts per user.
     * @summary Create Subaccount
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public createSubaccount(options?: RawAxiosRequestConfig) {
        return PortfolioApiFp(this.configuration).createSubaccount(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     *  Endpoint for getting the balance and portfolio value of a member. Both values are returned in cents.
     * @summary Get Balance
     * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getBalance(subaccount?: number, options?: RawAxiosRequestConfig) {
        return PortfolioApiFp(this.configuration).getBalance(subaccount, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Endpoint for getting all fills for the member. A fill is when a trade you have is matched. Fills that occurred before the historical cutoff are only available via `GET /historical/fills`. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details. 
     * @summary Get Fills
     * @param {string} [ticker] Filter by market ticker
     * @param {string} [orderId] Filter by order ID
     * @param {number} [minTs] Filter items after this Unix timestamp
     * @param {number} [maxTs] Filter items before this Unix timestamp
     * @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 200.
     * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
     * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getFills(ticker?: string, orderId?: string, minTs?: number, maxTs?: number, limit?: number, cursor?: string, subaccount?: number, options?: RawAxiosRequestConfig) {
        return PortfolioApiFp(this.configuration).getFills(ticker, orderId, minTs, maxTs, limit, cursor, subaccount, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     *  Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended for use by FCM members (rare). Note: If you\'re uncertain about this endpoint, it likely does not apply to you.
     * @summary Get Total Resting Order Value
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getPortfolioRestingOrderTotalValue(options?: RawAxiosRequestConfig) {
        return PortfolioApiFp(this.configuration).getPortfolioRestingOrderTotalValue(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted: position, total_traded
     * @summary Get Positions
     * @param {string} [cursor] The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.
     * @param {number} [limit] Parameter to specify the number of results per page. Defaults to 100.
     * @param {string} [countFilter] Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted - position, total_traded
     * @param {string} [ticker] Filter by market ticker
     * @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
     * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getPositions(cursor?: string, limit?: number, countFilter?: string, ticker?: string, eventTicker?: string, subaccount?: number, options?: RawAxiosRequestConfig) {
        return PortfolioApiFp(this.configuration).getPositions(cursor, limit, countFilter, ticker, eventTicker, subaccount, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     *  Endpoint for getting the member\'s settlements historical track.
     * @summary Get Settlements
     * @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 200.
     * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
     * @param {string} [ticker] Filter by market ticker
     * @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
     * @param {number} [minTs] Filter items after this Unix timestamp
     * @param {number} [maxTs] Filter items before this Unix timestamp
     * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getSettlements(limit?: number, cursor?: string, ticker?: string, eventTicker?: string, minTs?: number, maxTs?: number, subaccount?: number, options?: RawAxiosRequestConfig) {
        return PortfolioApiFp(this.configuration).getSettlements(limit, cursor, ticker, eventTicker, minTs, maxTs, subaccount, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Gets balances for all subaccounts including the primary account.
     * @summary Get All Subaccount Balances
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getSubaccountBalances(options?: RawAxiosRequestConfig) {
        return PortfolioApiFp(this.configuration).getSubaccountBalances(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Gets the netting enabled settings for all subaccounts.
     * @summary Get Subaccount Netting
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getSubaccountNetting(options?: RawAxiosRequestConfig) {
        return PortfolioApiFp(this.configuration).getSubaccountNetting(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Gets a paginated list of all transfers between subaccounts for the authenticated user.
     * @summary Get Subaccount Transfers
     * @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 200.
     * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getSubaccountTransfers(limit?: number, cursor?: string, options?: RawAxiosRequestConfig) {
        return PortfolioApiFp(this.configuration).getSubaccountTransfers(limit, cursor, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Updates the netting enabled setting for a specific subaccount. Use 0 for the primary account, or 1-32 for numbered subaccounts.
     * @summary Update Subaccount Netting
     * @param {UpdateSubaccountNettingRequest} updateSubaccountNettingRequest 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public updateSubaccountNetting(updateSubaccountNettingRequest: UpdateSubaccountNettingRequest, options?: RawAxiosRequestConfig) {
        return PortfolioApiFp(this.configuration).updateSubaccountNetting(updateSubaccountNettingRequest, options).then((request) => request(this.axios, this.basePath));
    }
}

