From 58a8b823392cdb9f39b3518bbcc0ee777ef8bae6 Mon Sep 17 00:00:00 2001 From: Ev2geny Date: Wed, 4 Jun 2025 00:27:55 +0200 Subject: [PATCH 1/2] some prints added --- beanprice/price.py | 1 + beanprice/sources/yahoo.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/beanprice/price.py b/beanprice/price.py index 7e75e7a..c3eeaa0 100644 --- a/beanprice/price.py +++ b/beanprice/price.py @@ -980,4 +980,5 @@ def main(): printer.print_entries(price_entries, dcontext=dcontext) if __name__ == '__main__': + # print("Starting main") main() diff --git a/beanprice/sources/yahoo.py b/beanprice/sources/yahoo.py index 93ad2d0..a2340f1 100644 --- a/beanprice/sources/yahoo.py +++ b/beanprice/sources/yahoo.py @@ -51,6 +51,11 @@ def parse_response(response: requests.models.Response) -> Dict: raise YahooError("Error fetching Yahoo data: {}".format(content["error"])) if not content["result"]: raise YahooError("No data returned from Yahoo, ensure that the symbol is correct") + + # print("Yahoo response content:") + + # print(content) + return content["result"][0] @@ -95,6 +100,9 @@ def get_price_series( payload.update(_DEFAULT_PARAMS) response = session.get(url, params=payload) # Use shared session result = parse_response(response) + + # print("Yahoo response:") + # print(result) meta = result["meta"] tzone = timezone( @@ -144,6 +152,8 @@ def __init__(self): self.crumb = self.session.get( "https://query1.finance.yahoo.com/v1/test/getcrumb" ).text + + # print("Source initialized with session and crumb:") def get_latest_price(self, ticker: str) -> Optional[source.SourcePrice]: """See contract in beanprice.source.Source.""" From b28a725f095a3f01ded9a58cafae8a06d23bbe33 Mon Sep 17 00:00:00 2001 From: Ev2geny Date: Wed, 4 Jun 2025 00:36:20 +0200 Subject: [PATCH 2/2] Small update to README.md, which will hopefully help newcomers --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index f31d6ff..2ea4973 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ To fetch the latest prices from your beancount file, first ensure that commoditi 2000-01-01 commodity AAPL price: "USD:yahoo/AAPL" ``` +Note: this is also a minimal viable ledger to use with beanprice Then run: @@ -42,6 +43,12 @@ Then run: bean-price ledger.beancount ``` +To run against the minimal viable ledger example, shown above: + +```shell +bean-price --inactive ledger.beancount +``` + To update prices up to the present day, run: ```shell