ApiSettingsConfig

View as MarkdownOpen in Claude

totalQuantityForMutualFundsBoolean – Enables the display of total quantity instead of monetary value for mutual fund positions.

downloadOpenOrdersOnConnectionBoolean – Automatically downloads all open orders when the API client establishes a connection to TWS.

includeVirtualFxPositionsBoolean – Includes virtual foreign exchange positions in position updates sent to the API client.

prepareDailyPnLBoolean – Enables the calculation and delivery of daily profit and loss data to the API client.

sendStatusUpdatesForVolatilityOrdersBoolean – Configures the system to send status updates for orders with volatility-based parameters.

encodeApiMessagesString – Specifies the character encoding format used for API message transmission (e.g., “osCodePage”).

socketPortInteger – Defines the TCP socket port number on which the API listens for incoming client connections.

useNegativeAutoRangeBoolean – Allows the use of negative values in automatic range calculations for order parameters.

createApiMessageLogFileBoolean – Enables the creation of a log file that records all API message traffic.

includeMarketDataInLogFileBoolean – Controls whether market data messages are included in the API message log file.

exposeTradingScheduleToApiBoolean – Makes trading schedule information available to API clients for contract and exchange queries.

splitInsuredDepositFromCashBalanceBoolean – Separates insured deposit amounts from the total cash balance in account value reports.

sendZeroPositionsForTodayOnlyBoolean – Limits the transmission of zero-quantity positions to only those closed during the current trading day.

useAccountGroupsWithAllocationMethodsBoolean – Enables the use of account groups when applying order allocation methods across multiple accounts.

loggingLevelString – Sets the verbosity level for API logging output (e.g., “error”, “warning”, “info”, “debug”).

masterClientIdInteger – Designates a specific client ID as the master client with elevated privileges for API operations.

bulkDataTimeoutInteger – Specifies the timeout duration in seconds for bulk data request operations.

componentExchSeparatorString – Defines the character used to separate component exchange identifiers in composite contract symbols.

roundAccountValuesToNearestWholeNumberBoolean – Rounds all account value figures to the nearest whole number for simplified display.

showAdvancedOrderRejectInUiBoolean – Displays detailed order rejection messages in the TWS user interface for troubleshooting purposes.

rejectMessagesAboveMaxRateBoolean – Automatically rejects API messages that exceed the configured maximum message rate threshold.

maintainConnectionOnIncorrectFieldsBoolean – Preserves the API connection even when requests contain incorrect or invalid field values.

compatibilityModeNasdaqStocksBoolean – Enables legacy compatibility mode for NASDAQ stock symbol formatting and handling.

sendInstrumentTimezoneString – Specifies the timezone format for instrument trading hours and schedule data (e.g., “utc”, “exchange”).

sendForexDataInCompatibilityModeBoolean – Transmits foreign exchange market data using legacy format for backward compatibility with older API clients.

maintainAndResubmitOrdersOnReconnectBoolean – Automatically preserves and resubmits active orders when the API client reconnects after a disconnection.

historicalDataMaxSizeInteger – Sets the maximum size level for historical data requests to control bandwidth and processing requirements.

autoReportNettingEventContractTradesBoolean – Automatically reports trades generated by netting events for contract position reconciliation.

optionExerciseRequestTypeString – Determines the type of option exercise requests accepted by the system (e.g., “final”, “preliminary”).

trustedIPsList<String> – Contains a collection of IP addresses that are authorized to establish API connections without additional authentication.

apiSettingsConfigProto = ApiSettingsConfigProto()
apiSettingsConfigProto.totalQuantityForMutualFunds = True
apiSettingsConfigProto.downloadOpenOrdersOnConnection = True
apiSettingsConfigProto.includeVirtualFxPositions = True
apiSettingsConfigProto.prepareDailyPnL = True
apiSettingsConfigProto.sendStatusUpdatesForVolatilityOrders = True
apiSettingsConfigProto.encodeApiMessages = "osCodePage"
apiSettingsConfigProto.socketPort = 7497
apiSettingsConfigProto.useNegativeAutoRange = True
apiSettingsConfigProto.createApiMessageLogFile = True
apiSettingsConfigProto.includeMarketDataInLogFile = True
apiSettingsConfigProto.exposeTradingScheduleToApi = True
apiSettingsConfigProto.splitInsuredDepositFromCashBalance = True
apiSettingsConfigProto.sendZeroPositionsForTodayOnly = True
apiSettingsConfigProto.useAccountGroupsWithAllocationMethods = True
apiSettingsConfigProto.loggingLevel = "error"
apiSettingsConfigProto.masterClientId = 3
apiSettingsConfigProto.bulkDataTimeout = 25
apiSettingsConfigProto.componentExchSeparator = "#"
apiSettingsConfigProto.roundAccountValuesToNearestWholeNumber = True
apiSettingsConfigProto.showAdvancedOrderRejectInUi = True
apiSettingsConfigProto.rejectMessagesAboveMaxRate = True
apiSettingsConfigProto.maintainConnectionOnIncorrectFields = True
apiSettingsConfigProto.compatibilityModeNasdaqStocks = True
apiSettingsConfigProto.sendInstrumentTimezone = "utc"
apiSettingsConfigProto.sendForexDataInCompatibilityMode = True
apiSettingsConfigProto.maintainAndResubmitOrdersOnReconnect = True
apiSettingsConfigProto.historicalDataMaxSize = 4
apiSettingsConfigProto.autoReportNettingEventContractTrades = True
apiSettingsConfigProto.optionExerciseRequestType = "final"
apiSettingsConfigProto.trustedIPs.append("127.0.0.1")