Is there a module that would give me the average (or high) stock price for any given day on any stock symbol? Example: module.get_price('google','some date') result: 532.40 I've tried ystockquote but they only give range values and the interface is difficult to use.
Asked
Active
Viewed 551 times
1 Answers
3
You might take a look at yahoo-finance
which seems to be really straight forward.
Just quoting from the examples:
>>> from yahoo_finance import Share >>> yahoo = Share('YHOO') >>> print yahoo.get_open() '36.60' >>> print yahoo.get_price() '36.84' >>> print yahoo.get_trade_datetime() '2014-02-05 20:50:00 UTC+0000'
In order to calculate an average you might think about which time span you want to take into account. Basically the API delivers you both max and min values as well as open and close values. You could use this in order to calculate the average or you could refresh the data manually every 15 minutes (or so) and use those manually caught prices as a basis for calculating the average.

albert
- 8,027
- 10
- 48
- 84