https://github.com/malcolmstill/racket-quandl
Grab data from Quandl with racket for fun and profit
https://github.com/malcolmstill/racket-quandl
Last synced: 5 months ago
JSON representation
Grab data from Quandl with racket for fun and profit
- Host: GitHub
- URL: https://github.com/malcolmstill/racket-quandl
- Owner: malcolmstill
- License: other
- Created: 2016-02-29T16:33:53.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-03T15:55:00.000Z (over 10 years ago)
- Last Synced: 2025-06-20T10:55:07.246Z (about 1 year ago)
- Language: Racket
- Size: 359 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# racket-quandl
Grab data from Quandl with racket for fun and profit
# Installation
```
raco pkg install racket-quandl
```
# Example usage
```
#lang racket
(require racket-quandl)
(require plot)
(require plot/utils)
; Set Quandl auth token from file
(set-auth-token (string-normalize-spaces (file->string "quandlkey.txt")))
; Grab daily spot prices from Quandl (EIA dataset)
(define crude (get "EIA/PET_RWTC_D")) ; WTI crude
(define gasoline (get "EIA/PET_EER_EPMRU_PF4_Y35NY_DPG_D")) ; gasoline
(define nat-gas (get "EIA/NG_RNGWHHD_D")) ; Henry hub natural gas
; Plot the historic price
(parameterize
([plot-x-ticks (date-ticks)]
[plot-x-label "Date"]
[plot-y-label "Price ($/unit)"])
(plot (list
(lines
(map vector (map datetime->real (map car crude)) (map cadr crude))
#:color 6 #:label "WTI crude")
(lines
(map vector (map datetime->real (map car gasoline)) (map cadr gasoline))
#:color 7 #:label "RBOB gasoline")
(lines
(map vector (map datetime->real (map car nat-gas)) (map cadr nat-gas))
#:color 8 #:label "Natural gas"))))
```