TIME-SERIES
Make a time-series call
This call gets the WTI Crude Oil Price, which has a code of EIA/PET_RWTC_D
from the US Department of Energy dataset: data = nasdaqdatalink.get("EIA/PET_RWTC_D")
Change formats
You can get the same data in a NumPy array: data = nasdaqdatalink.get("EIA/PET_RWTC_D", returns="numpy")
Make a filtered time-series call
To set start and end dates:
data = nasdaqdatalink.get("FRED/GDP", start_date="2001-12-31", end_date="2005-12-31")
To request specific columns:
data = nasdaqdatalink.get(["USTREASURY/YIELD.2", "FRED/GDP.1"])
This request will return the second column from the Treasury Yield Curve Rates time-series (USTREASURY/YIELD) which is part of the US Treasury dataset. This request will also return the first column from Gross Domestic Product time-series (FRED/GDP) which is part of the FRED dataset.
To request the last 5 rows:
data = nasdaqdatalink.get("USTREASURY/YIELD", rows=5)
This request will return the 5 most recent records.
Preprocess the data
To change the sampling frequency:
data = nasdaqdatalink.get("EIA/PET_RWTC_D", collapse="monthly")
To perform elementary calculations on the data: data = nasdaqdatalink.get("FRED/GDP", transformation="rdiff")
Download an entire time-series dataset
An entire time-series dataset's data can be downloaded.
For example, to download the dataset ZEA: nasdaqdatalink.bulkdownload("ZEA")
This call will download an entire time-series dataset as a ZIP file.
Please note that bulk downloading an entire time-series product is a feature applicable to premium products and may only be used by users with an active subscription.
NOTE:
For a full list of optional query parameters for downloading a time-series dataset, click here.
Updated 6 months ago