-
Notifications
You must be signed in to change notification settings - Fork 7
Home
cl-yahoo-finance provides a thin layer over the Yahoo Finance endpoint.
The current version is 1.1. Any modifications to the existing API will cause a version bump. Any bugfixes will induce a minor revision bump. cl-yahoo-finance is available in the January 2012 Quicklisp distribution.
;; Load me up
(asdf:load-system :cl-yahoo-finance)
;; Pull in the complete details for the big G and big Blue
(cl-yahoo-finance:read-current-data '("GOOG" "IBM"))
;; Get the historical data from TSLA
(cl-yahoo-finance:read-historical-data "TSLA" '(1 1 2011) '(6 1 2011))
Syntax: READ-CURRENT-DATA list-of-symbols|symbol
READ-CURRENT-DATA reads the "most recent" series of datapoints for symbol(s) and returns a list of HASH-TABLEs containing the string keys mapping to the data.
Syntax: READ-HISTORICAL-DATA symbol start-date-triple end-date-triple
READ-HISTORICAL-DATA reads the historical data for symbol(s) and returns a list of lists mapping to the Date, Open, High, Low, Close, Volume, Adj-Close for all days within the range.
start-date-triple and end-date-triple are three-element lists of month day year integers
cl-yahoo-finance is subject to the same availabilities and delays as Yahoo itself.
It requires a number of libraries, all available through Quicklisp
* (cl-yahoo-finance:read-historical-data "TSLA" '(1 1 11) '(6 1 11))
;; one hojillion datapoints
(...
("2011-01-03" 26.84 27.0 25.9 26.62 1283000 26.62))
* (cl-yahoo-finance:read-current-data "TSLA")
(#<HASH-TABLE :TEST EQUAL :COUNT 82 {1002887273}>)
* (cl-yahoo-finance:read-current-data '("TSLA" "GOOG"))
(#<HASH-TABLE :TEST EQUAL :COUNT 82 {10042D7203}>
#<HASH-TABLE :TEST EQUAL :COUNT 82 {10042E7353}>)
* (gethash "symbol" (car (cl-yahoo-finance:read-current-data '("TSLA" "GOOG"))))
"TSLA"
T