Skip to content

finance ochl->ohlc #1920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Aug 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2c4727a
Update of finance.py to (O,H,L,C) instead of (O,C,H,L)
kramer650 Feb 25, 2013
8745e3a
implemented the wrappers discussed in #1783.
tacaswell Apr 18, 2013
f16dc47
import and pep8 changes
tacaswell Apr 24, 2013
ffb2074
tweaked wording of documentation
tacaswell May 11, 2013
35d70d8
wrapped candlestick2 to have new argument order
tacaswell May 11, 2013
4ab6b95
minor documentation tweak
tacaswell May 11, 2013
4ee6d2e
added depreciation warning + fixed error is function call argument
tacaswell May 11, 2013
428333d
converted all the docstrings numpydoc format
tacaswell May 13, 2013
e509cd2
wrapped and depreciated parse_yahoo_historical
tacaswell May 30, 2013
9c5e1c3
commented out unused line
tacaswell May 30, 2013
ca8845e
fixed pep8, updated depreciation messages because this missed 1.3
tacaswell May 30, 2013
45eea6e
fixed documentation
tacaswell May 30, 2013
10adeb2
wrapped and deprecated plot_day_summary
tacaswell May 30, 2013
96b859f
fixed documentation
tacaswell May 30, 2013
f4dcc2f
re-factored to actually raise depreciation warnings
tacaswell May 30, 2013
c8fcc1a
wrapped and deprecated quotes_historical_yahoo
tacaswell May 30, 2013
a92039b
fixed naming bugs
tacaswell May 30, 2013
1def459
fixed a collection of stupid bugs (like not returning from
tacaswell May 30, 2013
e4fab5d
added note to api_change.rst
tacaswell May 30, 2013
469e267
documentation corrections
tacaswell May 30, 2013
007754c
minor pep8 fix
tacaswell May 31, 2013
58d741f
minor formatting changes to doc-strings
tacaswell Jul 16, 2013
62f4e19
spelling + formatting fixes
tacaswell Jul 21, 2013
4ef8ac9
Added Examples section to `parse_yahoo_historical*`.
tacaswell Aug 4, 2013
4c76044
fixed typos
tacaswell Aug 4, 2013
1e39c0c
updated `finance_demo.py` code to use new api
tacaswell Aug 4, 2013
ca81f16
added the finance module to api list so the documentation gets
tacaswell Aug 4, 2013
e772ac4
added depreciation warning to module doc-string
tacaswell Aug 5, 2013
c4819c2
cleaned up usage of `quotes_historical_yahoo` in demos
tacaswell Aug 5, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions doc/api/api_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,16 @@ original location:
- mstream -> `from matplotlib import stream as mstream`
- mtable -> `from matplotlib import table as mtable`


* In :module:`~matplotlib.finance`, almost all functions have been deprecated and
replaced with a pair of functions name `*_ochl` and `*_ohlc`. The former is
'open-close-high-low' order of quotes, and what the module used and the later
is 'open-high-low-close' order of quotes, which is the standard in finance.


.. _changes_in_1_3:


Changes in 1.3.x
================

Expand Down
12 changes: 12 additions & 0 deletions doc/api/finance_api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*******
finance
*******


:mod:`matplotlib.finance`
=========================

.. automodule:: matplotlib.finance
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions doc/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
colors_api.rst
dates_api.rst
figure_api.rst
finance_api.rst
font_manager_api.rst
gridspec_api.rst
legend_api.rst
Expand Down
12 changes: 6 additions & 6 deletions examples/pylab_examples/date_demo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"""

import matplotlib.pyplot as plt
from matplotlib.finance import quotes_historical_yahoo
from matplotlib.finance import quotes_historical_yahoo_ochl
from matplotlib.dates import YearLocator, MonthLocator, DateFormatter
import datetime
date1 = datetime.date( 1995, 1, 1 )
date2 = datetime.date( 2004, 4, 12 )
date1 = datetime.date(1995, 1, 1)
date2 = datetime.date(2004, 4, 12)

years = YearLocator() # every year
months = MonthLocator() # every month
years = YearLocator() # every year
months = MonthLocator() # every month
yearsFmt = DateFormatter('%Y')

quotes = quotes_historical_yahoo(
quotes = quotes_historical_yahoo_ochl(
'INTC', date1, date2)
if len(quotes) == 0:
raise SystemExit
Expand Down
12 changes: 6 additions & 6 deletions examples/pylab_examples/date_demo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
import datetime
import matplotlib.pyplot as plt
from matplotlib.dates import MONDAY
from matplotlib.finance import quotes_historical_yahoo
from matplotlib.finance import quotes_historical_yahoo_ochl
from matplotlib.dates import MonthLocator, WeekdayLocator, DateFormatter


date1 = datetime.date( 2002, 1, 5 )
date2 = datetime.date( 2003, 12, 1 )
date1 = datetime.date(2002, 1, 5)
date2 = datetime.date(2003, 12, 1)

# every monday
mondays = WeekdayLocator(MONDAY)
mondays = WeekdayLocator(MONDAY)

# every 3rd month
months = MonthLocator(range(1,13), bymonthday=1, interval=3)
months = MonthLocator(range(1, 13), bymonthday=1, interval=3)
monthsFmt = DateFormatter("%b '%y")


quotes = quotes_historical_yahoo('INTC', date1, date2)
quotes = quotes_historical_yahoo_ochl('INTC', date1, date2)
if len(quotes) == 0:
print ('Found no quotes')
raise SystemExit
Expand Down
19 changes: 9 additions & 10 deletions examples/pylab_examples/finance_demo.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#!/usr/bin/env python
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter, WeekdayLocator, HourLocator, \
from matplotlib.dates import DateFormatter, WeekdayLocator,\
DayLocator, MONDAY
from matplotlib.finance import quotes_historical_yahoo, candlestick,\
plot_day_summary, candlestick2
from matplotlib.finance import quotes_historical_yahoo_ohlc, candlestick_ohlc


# (Year, month, day) tuples suffice as args for quotes_historical_yahoo
date1 = ( 2004, 2, 1)
date2 = ( 2004, 4, 12 )
date1 = (2004, 2, 1)
date2 = (2004, 4, 12)


mondays = WeekdayLocator(MONDAY) # major ticks on the mondays
alldays = DayLocator() # minor ticks on the days
alldays = DayLocator() # minor ticks on the days
weekFormatter = DateFormatter('%b %d') # e.g., Jan 12
dayFormatter = DateFormatter('%d') # e.g., 12

quotes = quotes_historical_yahoo('INTC', date1, date2)
quotes = quotes_historical_yahoo_ohlc('INTC', date1, date2)
if len(quotes) == 0:
raise SystemExit

Expand All @@ -27,11 +27,10 @@
#ax.xaxis.set_minor_formatter(dayFormatter)

#plot_day_summary(ax, quotes, ticksize=3)
candlestick(ax, quotes, width=0.6)
candlestick_ohlc(ax, quotes, width=0.6)

ax.xaxis_date()
ax.autoscale_view()
plt.setp( plt.gca().get_xticklabels(), rotation=45, horizontalalignment='right')
plt.setp(plt.gca().get_xticklabels(), rotation=45, horizontalalignment='right')

plt.show()

Loading