Hi,
sorry, I was not clear on this. I created my own plugin, it depends on
an environment variable ALPHAVANTAGE_API_KEY and only supports latest price
from beancount.prices import source
import datetime
from dateutil import tz
from dateutil.parser import parse
from beancount.core.number import D
import requests
from os import environ
from time import sleep
class Source(source.Source):
def get_latest_price(self, ticker):
params = {
'function': 'GLOBAL_QUOTE',
'symbol': ticker,
'apikey': environ['ALPHAVANTAGE_API_KEY'],
}
resp = requests.get(url='https://www.alphavantage.co/query',
params=params)
data = resp.json()
if 'Note' in data:
sleep(60)
resp =
requests.get(url='https://www.alphavantage.co/query', params=params)
data = resp.json()
priceData = data['Global Quote']
price = D(priceData['05. price'])
date = parse(priceData['07. latest trading day'])
us_timezone = tz.gettz("Europe/Zurich")
time = date.astimezone(us_timezone)
return source.SourcePrice(price, time, 'USD')
def get_historical_price(self, ticker, time):
return None
On 19.06.2019 01:56, [email protected] wrote:
I don't see that in `beancount.prices.sources`. I only see `iex`,
`oanda`, `quandl`, and `yahoo`. I'm on 2.2.1.
On Monday, June 17, 2019 at 2:10:03 PM UTC-4, Patrick Ruckstuhl wrote:
Hi,
On 17.06.2019 19:20, [email protected] <javascript:> wrote:
>
> What's the go-to price sources these days? I'm guessing that
Yahoo and
> Google sources don't work anymore. What should I migrate to?
I'm using https://www.alphavantage.co/ they have a free offering
and has
also data from different countries.
Regards,
Patrick
--
You received this message because you are subscribed to the Google
Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/807e2284-fc44-4531-a4fd-5c0999d29b18%40googlegroups.com
<https://groups.google.com/d/msgid/beancount/807e2284-fc44-4531-a4fd-5c0999d29b18%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/158c0a6b-5fec-54e6-2ae5-7672ad08ee29%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.