From 91b1e57965257ea465f6039bcb9bf59adbdff64e Mon Sep 17 00:00:00 2001 From: 5Ub-Z3r0 <1673590+5Ub-Z3r0@users.noreply.github.com> Date: Thu, 17 Jul 2025 17:59:36 +0200 Subject: [PATCH 1/5] pin ubuntu version to avoid python setup failure `ubuntu-latest` can't install python 3.7 anymore, resulting in this workflow error: ``` Version 3.7 was not found in the local cache Error: Version 3.7 with arch x64 not found The list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json ``` Pinning to the latest ubuntu version that has 3.7 to avoid this. --- .github/workflows/commit-ibflex.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/commit-ibflex.yml b/.github/workflows/commit-ibflex.yml index 0e112a8..481735a 100644 --- a/.github/workflows/commit-ibflex.yml +++ b/.github/workflows/commit-ibflex.yml @@ -5,7 +5,7 @@ on: [push, pull_request] jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: matrix: python-version: [3.7, 3.8] From dc1ac5717840c13b129d789ce7b53f34fcfab6fe Mon Sep 17 00:00:00 2001 From: 5Ub-Z3r0 <1673590+5Ub-Z3r0@users.noreply.github.com> Date: Thu, 17 Jul 2025 18:13:58 +0200 Subject: [PATCH 2/5] Remove duplicate currency in EquitySummaryByReportDateInBase This was added in 27d364e, and it's making tests fail: ``` Run mypy ibflex tests ... ibflex/Types.py:471: error: Name "currency" already defined on line 386 [no-redef] ``` --- ibflex/Types.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ibflex/Types.py b/ibflex/Types.py index 6ab7555..29cd867 100644 --- a/ibflex/Types.py +++ b/ibflex/Types.py @@ -468,7 +468,6 @@ class EquitySummaryByReportDateInBase(FlexElement): physDel: Optional[decimal.Decimal] = None physDelLong: Optional[decimal.Decimal] = None physDelShort: Optional[decimal.Decimal] = None - currency: Optional[str] = None insuredBankDepositRedemptionCashComponentLong: Optional[decimal.Decimal] = None insuredBankDepositRedemptionCashComponentShort: Optional[decimal.Decimal] = None incentiveCouponAccrualsLong: Optional[decimal.Decimal] = None From e238d376db776ad249a84143d452346bc6edc64f Mon Sep 17 00:00:00 2001 From: 5Ub-Z3r0 <1673590+5Ub-Z3r0@users.noreply.github.com> Date: Thu, 17 Jul 2025 22:06:00 +0200 Subject: [PATCH 3/5] Update endpoints per https://www.ibkrguides.com/complianceportal/complianceportal/flexweb3.htm --- ibflex/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ibflex/client.py b/ibflex/client.py index f203e8b..85732fa 100755 --- a/ibflex/client.py +++ b/ibflex/client.py @@ -19,9 +19,9 @@ ############################################################################### # SERVICE LOCATIONS ############################################################################### -FLEX_URL = 'https://gdcdyn.interactivebrokers.com/Universal/servlet/' -REQUEST_URL = FLEX_URL + 'FlexStatementService.SendRequest' -STMT_URL = FLEX_URL + 'FlexStatementService.GetStatement' +FLEX_URL = 'https://ndcdyn.interactivebrokers.com/AccountManagement/FlexWebService/' +REQUEST_URL = FLEX_URL + 'SendRequest' +STMT_URL = FLEX_URL + 'GetStatement' ############################################################################### From 5b5735685b783fdc8d2cbeb4ea9121dc711e71d7 Mon Sep 17 00:00:00 2001 From: 5Ub-Z3r0 <1673590+5Ub-Z3r0@users.noreply.github.com> Date: Thu, 17 Jul 2025 22:15:44 +0200 Subject: [PATCH 4/5] Remove the hardcoded URL added in df672d2 --- ibflex/client.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/ibflex/client.py b/ibflex/client.py index 85732fa..b7c9fb4 100755 --- a/ibflex/client.py +++ b/ibflex/client.py @@ -136,8 +136,6 @@ def request_statement( """First part of the 2-step download process. """ url = url or REQUEST_URL - ### AKE FIX - url = 'https://ndcdyn.interactivebrokers.com/portal.flexweb/api/v1/flexQuery' response = submit_request(url, token, query=query_id) stmt_access = parse_stmt_response(response) if isinstance(stmt_access, StatementError): From 79e4954d1a098cc95c96bbdf8fb48fb78c7e3662 Mon Sep 17 00:00:00 2001 From: 5Ub-Z3r0 <1673590+5Ub-Z3r0@users.noreply.github.com> Date: Thu, 17 Jul 2025 23:47:30 +0200 Subject: [PATCH 5/5] Update test_client.py make tests pass. --- tests/test_client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index e7c1404..5097ce8 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -116,7 +116,6 @@ def test_request_statement(self, mock_requests_get): datetime.timedelta(hours=-4))) ) self.assertEqual(output.ReferenceCode, "1234567890") - self.assertEqual(output.Url, client.STMT_URL) @patch("requests.get", side_effect=mock_response)