Borsdata-Sweden / API

Börsdata API documentation
57 stars 6 forks source link

Duplicate dates in stock price history #2

Open nicholasasplund opened 5 years ago

nicholasasplund commented 5 years ago

Some instruments have multiple data points for the same date when calling v1/instruments/{insid}/stockprices. Is this a database issue or is there any intent behind? I pull history into my own PowerPivot database and it is easy enough to filter out the duplicate dates on import but it will probably create issues in other use cases.

To reproduce this try for instance v1/instruments/3/stockprices to get ABB's history. This gives the following:

{"instrument":3,"stockPricesList":[{"d":"2009-03-16","h":112.5155,"l":110.5672,"c":112.5155,"o":112.0284,"v":2065694}, ... "d":"2015-02-09","h":172.8000,"l":169.1000,"c":172.3000,"o":169.9000,"v":2151000},{"d":"2015-02-10","h":174.9000,"l":171.7000,"c":172.5000,"o":173.0000,"v":2616000},{"d":"2015-02-10","h":174.9000,"l":171.7000,"c":172.5000,"o":173.0000,"v":2615730},{"d":"2015-02-11","h":174.8000,"l":172.3000,"c":173.7000,"o":172.8000,"v":2265528}, ...

Above history has two occurrences for 2015-02-10 with slightly different volume figures.

larssonandreas commented 5 years ago

@nicholasasplund How did you find out what the instrument id is for a particular stock?

nicholasasplund commented 5 years ago

@nicholasasplund How did you find out what the instrument id is for a particular stock?

Just use the v1/instruments call and you get the complete list.

henrikbergstrom commented 5 years ago

Hi, I will look at this tomorrow. I know we had the problem before and is related to the bulk updates we do. In some cases we get two prices for the same day. We need to check, find and delete duplicates.

henrikbergstrom commented 5 years ago

Hi, This is not a quick fix for us, unfortunately. Takes some investigation and planing how to fix and when this happens. So I will inform when done.

nicholasasplund commented 5 years ago

Thanks for the fast response. I’m managing fine for now as I’m already validating row by row in returned data against my local data and can easily make a duplicate check. But users who use the data raw will get some weird spikes in graphs and such.