通过help函数看pandas_datareader库,之后便可以尝试相关方法。
如下:
import pandas_datareader as pdr
help(pdr)
Help on package pandas_datareader:
NAME
pandas_datareader
PACKAGE CONTENTS
_testing
_utils
_version
av (package)
bankofcanada
base
compat (package)
conftest
data
enigma
eurostat
exceptions
famafrench
fred
google (package)
iex (package)
io (package)
moex
mstar (package)
nasdaq_trader
oecd
quandl
robinhood
stooq
tests (package)
tiingo
tsp
wb
yahoo (package)
FUNCTIONS
DataReader(name, data_source=None, start=None, end=None, retry_count=3, pause=0.1, session=None, access_key=None)
Imports data from a number of online sources.
Currently supports Google Finance, St. Louis FED (FRED),
and Kenneth French's data library, among others.
Parameters
----------
name : str or list of strs
the name of the dataset. Some data sources (google, fred) will
accept a list of names.
data_source: {str, None}
the data source ("google", "fred", "ff")
start : {datetime, None}
left boundary for range (defaults to 1/1/2010)
end : {datetime, None}
right boundary for range (defaults to today)
retry_count : {int, 3}
Number of times to retry query request.
pause : {numeric, 0.001}
Time, in seconds, to pause between consecutive queries of chunks. If
single value given for symbol, represents the pause between retries.
session : Session, default None
requests.sessions.Session instance to be used
access_key : (str, None)
Optional parameter to specify an API key for certain data sources.
Examples
----------
# Data from Google Finance
aapl = DataReader("AAPL", "google")
# Price and volume data from IEX
tops = DataReader(["GS", "AAPL"], "iex-tops")
# Top of book executions from IEX
gs = DataReader("GS", "iex-last")
# Real-time depth of book data from IEX
gs = DataReader("GS", "iex-book")
# Data from FRED
vix = DataReader("VIXCLS", "fred")
# Data from Fama/French
ff = DataReader("F-F_Research_Data_Factors", "famafrench")
ff = DataReader("F-F_Research_Data_Factors_weekly", "famafrench")
ff = DataReader("6_Portfolios_2x3", "famafrench")
ff = DataReader("F-F_ST_Reversal_Factor", "famafrench")
Options(symbol, data_source=None, session=None)
get_components_yahoo = _get_data(idx_sym)
Returns DataFrame containing list of component information for
index represented in idx_sym from yahoo. Includes component symbol
(ticker), exchange, and name.
Parameters
----------
idx_sym : str
Stock index symbol
Examples:
'^DJI' (Dow Jones Industrial Average)
'^NYA' (NYSE Composite)
'^IXIC' (NASDAQ Composite)
See: http://finance.yahoo.com/indices for other index symbols
Returns
-------
idx_df : DataFrame
get_dailysummary_iex(*args, **kwargs)
Returns a summary of daily market volume statistics. Without parameters,
this will return the most recent trading session by default.
:param start:
A datetime object - the beginning of the date range.
:param end:
A datetime object - the end of the date range.
Reference: https://www.iextrading.com/developer/docs/#historical-daily
:return: DataFrame
get_data_alphavantage(*args, **kwargs)
get_data_enigma(*args, **kwargs)
get_data_famafrench(*args, **kwargs)
get_data_fred(*args, **kwargs)
get_data_google(*args, **kwargs)
get_data_moex(*args, **kwargs)
get_data_morningstar(*args, **kwargs)
get_data_quandl(*args, **kwargs)
get_data_stooq(*args, **kwargs)
get_data_tiingo(*args, **kwargs)
get_data_yahoo(*args, **kwargs)
get_data_yahoo_actions(*args, **kwargs)
get_iex_book(*args, **kwargs)
Returns an array of dictionaries with depth of book data from IEX for up to
10 securities at a time. Returns a dictionary of the bid and ask books.
:param symbols:
A string or list of strings of valid tickers
:param service:
'book': Live depth of book data
'op-halt-status': Checks to see if the exchange has instituted a halt
'security-event': Denotes individual security related event
'ssr-status': Short Sale Price Test restrictions, per reg 201 of SHO
'system-event': Relays current feed status (i.e. market open)
'trades': Retrieves recent executions, trade size/price and flags
'trade-breaks': Lists execution breaks for the current trading session
'trading-status': Returns status and cause codes for securities
:return: Object
get_iex_symbols(*args, **kwargs)
Returns a list of all equity symbols available for trading on IEX. Accepts
no additional parameters.
Reference: https://www.iextrading.com/developer/docs/#symbols
:return: DataFrame
get_last_iex(*args, **kwargs)
get_markets_iex(*args, **kwargs)
Returns near-real time volume data across markets segregated by tape
and including a percentage of overall volume during the session
This endpoint does not accept any parameters.
Reference: https://www.iextrading.com/developer/docs/#markets
:return: DataFrame
get_nasdaq_symbols(retry_count=3, timeout=30, pause=None)
Get the list of all available equity symbols from Nasdaq.
Returns
-------
nasdaq_tickers : pandas.DataFrame
DataFrame with company tickers, names, and other properties.
get_quote_google(*args, **kwargs)
get_quote_yahoo(*args, **kwargs)
get_recent_iex(*args, **kwargs)
Returns market volume and trade routing statistics for recent sessions.
Also reports IEX's relative market share, lit share volume and a boolean
halfday indicator.
Reference: https://www.iextrading.com/developer/docs/#recent
:return: DataFrame
get_records_iex(*args, **kwargs)
Returns the record value, record date, recent value, and 30-day average for
market volume, # of symbols traded, # of routed trades and notional value.
This function accepts no additional parameters.
Reference: https://www.iextrading.com/developer/docs/#records
:return: DataFrame
get_summary_iex(*args, **kwargs)
Returns an aggregated monthly summary of market volume and a variety of
related metrics for trades by lot size, security market cap, and venue.
In the absence of parameters, this will return month-to-date statistics.
For ranges spanning multiple months, this will return one row per month.
:param start:
A datetime object - the beginning of the date range.
:param end:
A datetime object - the end of the date range.
:return: DataFrame
get_tops_iex(*args, **kwargs)
DATA
all = [‘version’, ‘get_components_yahoo’, ‘get_data_enigma’, '…
VERSION
0.7.0
FILE
/Users/bnz/anaconda3/lib/python3.6/site-packages/pandas_datareader/init.py