diff mbox series

[bug#64134,03/17] gnu: Add python-yfinance.

Message ID 20230617151840.1748096-3-monego@posteo.net
State New
Headers show
Series Add some Python financial libraries. | expand

Commit Message

Vinicius Monego June 17, 2023, 3:18 p.m. UTC
* gnu/packages/finance.scm (python-yfinance): New variable.
---
 gnu/packages/finance.scm | 43 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index 2a4929ccd0..769742c015 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -19,7 +19,7 @@ 
 ;;; Copyright © 2020 Christine Lemmer-Webber <cwebber@dustycloud.org>
 ;;; Copyright © 2020 Tom Zander <tomz@freedommail.ch>
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
-;;; Copyright © 2020, 2021, 2022 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020, 2021, 2022, 2023 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2020 Carlo Holl <carloholl@gmail.com>
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2021 ZmnSCPxj jxPCSnmZ <ZmnSCPxj@protonmail.com>
@@ -1034,6 +1034,47 @@  (define-public python-mnemonic
 of Bitcoin BIP-0039.")
     (license license:expat)))
 
+(define-public python-yfinance
+  (package
+    (name "python-yfinance")
+    (version "0.2.20")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "yfinance" version))
+              (sha256
+               (base32
+                "0p8m2445vyanpc7dk3fcfqis66217zn5kswh9f0ryjn3c2x5zsdr"))))
+    (build-system python-build-system)
+    (arguments
+     (list #:tests? #f ;no tests in PyPI and they test the online API
+           #:phases #~(modify-phases %standard-phases
+                        ;; we have pytz==2022.1 and it's a core package
+                        (add-after 'unpack 'relax-pytz
+                          (lambda _
+                            (substitute* "setup.py"
+                              (("pytz>=2022.5")
+                               "pytz"))))
+                        ;; yfinance provides a sample script via entry_points
+                        ;; which breaks sanity-check.
+                        (delete 'sanity-check))))
+    (propagated-inputs (list python-appdirs
+                             python-beautifulsoup4
+                             python-cryptography
+                             python-frozendict
+                             python-html5lib
+                             python-lxml
+                             python-multitasking
+                             python-numpy
+                             python-pandas
+                             python-pytz
+                             python-requests))
+    (home-page "https://github.com/ranaroussi/yfinance")
+    (synopsis "Download market data from Yahoo! Finance API")
+    (description
+     "@code{yfinance} offers a threaded and Pythonic way to download market
+ data from Yahoo! finance.")
+    (license license:asl2.0)))
+
 (define-public python-u2flib-host
   ;; The package is obsolete and superseded by python-fido2, but
   ;; needed for python-ledgerblue@0.1.44.