The Trader Workstation, by design, is intended as a real-time trading platform and it does not contain historical trade, position or account balance information. As the API is intended to provide only the data available within the TWS, this historical information is not available via the API as well.
Historical trade, position and account balances is provided via the Activity Statements in HTML and PDF format and are also downloadable via flex queries all in Client Portal.
More information on Flex Queries can be found in our Users' Guide.