Skip to content

Handle IG instrument navigation API update - #379

Merged
bug-or-feature merged 7 commits into
ig-python:masterfrom
SteveHussey:ig_api_update
Sep 2, 2026
Merged

Handle IG instrument navigation API update#379
bug-or-feature merged 7 commits into
ig-python:masterfrom
SteveHussey:ig_api_update

Conversation

@SteveHussey

@SteveHussey SteveHussey commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Primarily this PR addresses the not so recent change that IG made to their REST API, replacing fetch_top_level_navigation_nodes and fetch_sub_nodes_by_node with fetch_categories and fetch_category_instruments. This is not a like for like change as they have removed the concept of Node ID from their public API.

There are also a number of more minor improvements and fixes.

No LLMs were used for this change.

Allows easy running of unit tests with or without integration tests
Also included in unit tests.
Avoids "too many API requests" errors
…is False

The resolution value passed was ignored previously when return_dateframe is true, which it is by default when Pandas is present.
@bug-or-feature

Copy link
Copy Markdown
Member

@SteveHussey thanks for contributing. can you check the integration tests for the category stuff please?

FAILED tests/test_integration.py::TestIntegration::test_fetch_categories[v2 session] - ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
FAILED tests/test_integration.py::TestIntegration::test_fetch_category_instruments[v2 session] - KeyError: 8

I tried with python 3.10 and 3.13

fetch_top_level_navigation_nodes and fetch_sub_nodes_by_node have been replaced by fetch_categories and fetch_category_instruments. The main differences here is that IG appear to have removed the Node ID concept from their public API. Instrument discovery for all instruments is now: call fetch_category_instruments(category) with all categories from fetch_categories().
This library is only used by sample code.
@SteveHussey

Copy link
Copy Markdown
Contributor Author

The integration test should be good now, I had some difficulties getting them to run locally. Gotta love Pandas sometimes! Thanks.

@bug-or-feature
bug-or-feature merged commit 1f307f0 into ig-python:master Sep 2, 2026
4 checks passed
@SteveHussey
SteveHussey deleted the ig_api_update branch September 2, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants