A collection of functions for collecting, analyzing and plotting financial data. User contributions welcome!
This module is deprecated in 1.4 and will be moved to mpl_toolkits or it’s own project in the future.
Plot the time, open, close, high, low as a vertical line ranging from low to high. Use a rectangular bar to represent the open-close span. If close >= open, use colorup to color the bar, otherwise use colordown
This function has been deprecated in 1.4 in favor of candlestick_ochl, which maintains the original argument order, or candlestick_ohlc, which uses the open-high-low-close order. This function will be removed in 1.5
Parameters: | ax : Axes
quotes : sequence of (time, open, close, high, low, ...) sequences
width : float
colorup : color
colordown : color
alpha : float
|
---|---|
Returns: | ret : tuple
|
Represent the open, close as a bar line and high low range as a vertical line.
This function has been deprecated in 1.4 in favor of candlestick2_ochl, which maintains the original argument order, or candlestick2_ohlc, which uses the open-high-low-close order. This function will be removed in 1.5
Parameters: | ax : Axes
opens : sequence
closes : sequence
highs : sequence
lows : sequence
ticksize : int
colorup : color
colordown : color
alpha : float
|
---|---|
Returns: | ret : tuple
|
Represent the open, close as a bar line and high low range as a vertical line.
Preserves the original argument order.
Parameters: | ax : Axes
opens : sequence
closes : sequence
highs : sequence
lows : sequence
ticksize : int
colorup : color
colordown : color
alpha : float
|
---|---|
Returns: | ret : tuple
|
Represent the open, close as a bar line and high low range as a vertical line.
Parameters: | ax : Axes
opens : sequence
highs : sequence
lows : sequence
closes : sequence
ticksize : int
colorup : color
colordown : color
alpha : float
|
---|---|
Returns: | ret : tuple
|
Plot the time, open, close, high, low as a vertical line ranging from low to high. Use a rectangular bar to represent the open-close span. If close >= open, use colorup to color the bar, otherwise use colordown
Parameters: | ax : Axes
quotes : sequence of (time, open, close, high, low, ...) sequences
width : float
colorup : color
colordown : color
alpha : float
|
---|---|
Returns: | ret : tuple
|
Plot the time, open, high, low, close as a vertical line ranging from low to high. Use a rectangular bar to represent the open-close span. If close >= open, use colorup to color the bar, otherwise use colordown
Parameters: | ax : Axes
quotes : sequence of (time, open, high, low, close, ...) sequences
width : float
colorup : color
colordown : color
alpha : float
|
---|---|
Returns: | ret : tuple
|
Fetch historical data for ticker between date1 and date2. date1 and date2 are date or datetime instances, or (year, month, day) sequences.
Parameters: | ticker : str
date1 : sequence of form (year, month, day), datetime, or date
date2 : sequence of form (year, month, day), datetime, or date
cachename : str
dividends : bool
|
---|---|
Returns: | file_handle : file handle
|
Examples
>>> fh = fetch_historical_yahoo('^GSPC', (2000, 1, 1), (2001, 12, 31))
Add a bar collection graph with height vals (-1 is missing).
Parameters: | ax : Axes
vals : sequence
facecolor : color
edgecolor : color
width : int
alpha : float
|
---|---|
Returns: | ret : barCollection
|
Parse the historical data in file handle fh from yahoo finance.
This function has been deprecated in 1.4 in favor of parse_yahoo_historical_ochl, which maintains the original argument order, or parse_yahoo_historical_ohlc, which uses the open-high-low-close order. This function will be removed in 1.5
Parameters: | adjusted : bool
asobject : bool or None
ochl : bool
|
---|
Parse the historical data in file handle fh from yahoo finance.
Parameters: | adjusted : bool
asobject : bool or None
|
---|
Parse the historical data in file handle fh from yahoo finance.
Parameters: | adjusted : bool
asobject : bool or None
|
---|
Plots day summary
Represent the time, open, close, high, low as a vertical line ranging from low to high. The left tick is the open and the right tick is the close.
This function has been deprecated in 1.4 in favor of plot_day_summary_ochl, which maintains the original argument order, or plot_day_summary_ohlc, which uses the open-high-low-close order. This function will be removed in 1.5
Parameters: | ax : Axes
quotes : sequence of (time, open, close, high, low, ...) sequences
ticksize : int
colorup : color
colordown : color
|
---|---|
Returns: | lines : list
|
Represent the time, open, close, high, low, as a vertical line ranging from low to high. The left tick is the open and the right tick is the close.
This function has been deprecated in 1.4 in favor of plot_day_summary2_ochl, which maintains the original argument order, or plot_day_summary2_ohlc, which uses the open-high-low-close order. This function will be removed in 1.5
Parameters: | ax : Axes
opens : sequence
closes : sequence
highs : sequence
lows : sequence
ticksize : int
colorup : color
colordown : color
|
---|---|
Returns: | ret : list
|
Represent the time, open, close, high, low, as a vertical line ranging from low to high. The left tick is the open and the right tick is the close.
Parameters: | ax : Axes
opens : sequence
closes : sequence
highs : sequence
lows : sequence
ticksize : int
colorup : color
colordown : color
|
---|---|
Returns: | ret : list
|
Represent the time, open, high, low, close as a vertical line ranging from low to high. The left tick is the open and the right tick is the close.
Parameters: | ax : Axes
opens : sequence
highs : sequence
lows : sequence
closes : sequence
ticksize : int
colorup : color
colordown : color
|
---|---|
Returns: | ret : list
|
Plots day summary
Represent the time, open, close, high, low as a vertical line ranging from low to high. The left tick is the open and the right tick is the close.
Parameters: | ax : Axes
quotes : sequence of (time, open, close, high, low, ...) sequences
ticksize : int
colorup : color
colordown : color
|
---|---|
Returns: | lines : list
|
Plots day summary
Represent the time, open, high, low, close as a vertical line ranging from low to high. The left tick is the open and the right tick is the close.
Parameters: | ax : Axes
quotes : sequence of (time, open, high, low, close, ...) sequences
ticksize : int
colorup : color
colordown : color
|
---|---|
Returns: | lines : list
|
Get historical data for ticker between date1 and date2.
This function has been deprecated in 1.4 in favor of quotes_yahoo_historical_ochl, which maintains the original argument order, or quotes_yahoo_historical_ohlc, which uses the open-high-low-close order. This function will be removed in 1.5
See parse_yahoo_historical() for explanation of output formats and the asobject and adjusted kwargs.
Parameters: | ticker : str
date1 : sequence of form (year, month, day), datetime, or date
date2 : sequence of form (year, month, day), datetime, or date
cachename : str or None
|
---|
Examples
>>> sp = f.quotes_historical_yahoo('^GSPC', d1, d2,
asobject=True, adjusted=True)
>>> returns = (sp.open[1:] - sp.open[:-1])/sp.open[1:]
>>> [n,bins,patches] = hist(returns, 100)
>>> mu = mean(returns)
>>> sigma = std(returns)
>>> x = normpdf(bins, mu, sigma)
>>> plot(bins, x, color='red', lw=2)
Get historical data for ticker between date1 and date2.
See parse_yahoo_historical() for explanation of output formats and the asobject and adjusted kwargs.
Parameters: | ticker : str
date1 : sequence of form (year, month, day), datetime, or date
date2 : sequence of form (year, month, day), datetime, or date
cachename : str or None
|
---|
Examples
>>> sp = f.quotes_historical_yahoo_ochl('^GSPC', d1, d2,
asobject=True, adjusted=True)
>>> returns = (sp.open[1:] - sp.open[:-1])/sp.open[1:]
>>> [n,bins,patches] = hist(returns, 100)
>>> mu = mean(returns)
>>> sigma = std(returns)
>>> x = normpdf(bins, mu, sigma)
>>> plot(bins, x, color='red', lw=2)
Get historical data for ticker between date1 and date2.
See parse_yahoo_historical() for explanation of output formats and the asobject and adjusted kwargs.
Parameters: | ticker : str
date1 : sequence of form (year, month, day), datetime, or date
date2 : sequence of form (year, month, day), datetime, or date
cachename : str or None
|
---|
Examples
>>> sp = f.quotes_historical_yahoo_ohlc('^GSPC', d1, d2,
asobject=True, adjusted=True)
>>> returns = (sp.open[1:] - sp.open[:-1])/sp.open[1:]
>>> [n,bins,patches] = hist(returns, 100)
>>> mu = mean(returns)
>>> sigma = std(returns)
>>> x = normpdf(bins, mu, sigma)
>>> plot(bins, x, color='red', lw=2)
Add a volume overlay to the current axes. The opens and closes are used to determine the color of the bar. -1 is missing. If a value is missing on one it must be missing on all
Parameters: | ax : Axes
opens : sequence
closes : sequence
volumes : sequence
width : int
colorup : color
colordown : color
alpha : float
|
---|---|
Returns: | ret : barCollection
|
Add a volume overlay to the current axes. The closes are used to determine the color of the bar. -1 is missing. If a value is missing on one it must be missing on all
nb: first point is not displayed - it is used only for choosing the right color
Parameters: | ax : Axes
closes : sequence
volumes : sequence
width : int
colorup : color
colordown : color
alpha : float
|
---|---|
Returns: | ret : barCollection
|
Add a volume overlay to the current axes. quotes is a list of (d, open, high, low, close, volume) and close-open is used to determine the color of the bar
Parameters: | ax : Axes
quotes : sequence of (time, open, high, low, close, ...) sequences
width : int
colorup : color
colordown : color
alpha : float
|
---|---|
Returns: | ret : barCollection
|