woheller69 / spritpreise

A privacy friendly app for gas prices in Germany
GNU General Public License v3.0
104 stars 6 forks source link

[Feature request] Price history #7

Closed BluePixel4k closed 1 year ago

BluePixel4k commented 2 years ago

If the Tankerkönig API allows it, a price history of the single gas stations would be a practical function to be able to estimate how the price could still change on the day and how the trend looked like over the last day/weeks.

For example, like this:

woheller69 commented 2 years ago

not possible with free Tankerkönig API

BluePixel4k commented 2 years ago

Okay sad, do you have any idea how expensive the Pro version is? At least I can't find anything concrete on their website. Such costs are of course not so great for an open source app, unless the users who want it pay for it.

woheller69 commented 2 years ago

no idea, probably only for large customers

FlRedder commented 2 years ago

I'm not an Android expert, but wouldn't it be possible to configure a background task running e.g. every 5...15mins, accessing the Tankerkönig API and storing the history for a selected station locally on your phone? To limit required storage space you could limit the history length to a certain interval and show the approximately required space.

woheller69 commented 2 years ago

"Regelmäßige, nicht explizit vom User initiierte Requests sind zu vermeiden"

https://creativecommons.tankerkoenig.de/ -> Terms

FlRedder commented 2 years ago

@woheller69 Thanks for the quick response. I understand the need for limiting reoccurring server requests as stated in the terms. However I feel the server load should not increase too much if you limit the number of stations "subscribed to" to e.g. 1...3 per API key and request intervals to 15mins.

Nevertheless, I'm aware that the number of requests scales with the number of users.

Anyway, I just realized they added a GIT repo for daily historic data here. Would it be an option to include this in the app?

woheller69 commented 2 years ago

the download is 50 GB ...

FlRedder commented 2 years ago

@woheller69 Sure, for the whole repo. But one day data for all the stations is about 28MB. That's still quite some data and you'd have to download first and then filter by station id. So in theory historic data is available. However, I feel without a proper api to the data, the overhead is significant.

RedCommander735 commented 1 year ago

Another idea for this would be to store the prices whenever you get them anyway for displaying in app. Maybe averaging them with already stored prices for that time +-15min/30min from the last week or so and using that for an "average price history".