ig-python / trading-ig

A lightweight Python wrapper for the IG Markets API
https://trading-ig.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
308 stars 196 forks source link

Different return for fetch_historical_prices_by_epic_and_date_range() #334

Open breitdom opened 1 month ago

breitdom commented 1 month ago

Hi all!

Why is it that when I run the function 'fetch_historical_prices_by_epic_and_date_range()' I sometimes get a return that looks like this:

MultiIndex([( 'bid', 'Open'), ( 'bid', 'High'), ( 'bid', 'Low'), ( 'bid', 'Close'), ( 'ask', 'Open'), ( 'ask', 'High'), ( 'ask', 'Low'), ( 'ask', 'Close'), ('last', 'Open'), ('last', 'High'), ('last', 'Low'), ('last', 'Close'), ('last', 'Volume')], )

And sometimes like this:

MultiIndex([('bid', 'Open'), ('bid', 'High'), ('bid', 'Low'), ('bid', 'Close'), ('ask', 'Open'), ('ask', 'High'), ('ask', 'Low'), ('ask', 'Close')], )

I always call this function the same way in my code. It seems to be a random principle. What could be the reason for this?

This example doesn't provide Volume. I have tried version=1 and version=2. epic = 'IX.D.DAX.IFMM.IP' resolution = '30MIN' current_date_str = '2024-02-23T22:30:00' next_date_str = '2024-02-26T17:30:00' response = ig_service.fetch_historical_prices_by_epic_and_date_range(epic=epic, resolution=resolution, start_date=current_date_str, end_date=next_date_str, version='1')

But when i try the same request with https://labs.ig.com/sample-apps/api-companion/index.html, the response is correct.

Many thanks for any help :-)

Best regards Dominik

bug-or-feature commented 1 month ago

You haven't provided enough information for the issue to be reproduced, which is always the first step in fixing an issue. See this FAQ item for the list of required info:

https://trading-ig.readthedocs.io/en/latest/faq.html#what-if-i-have-a-problem

And please learn how to use Markdown syntax for formatting code