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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
implemented the wrappers discussed in #1783.
Added deprecation warning to `plot_day_summary2` and returned call
signature to what it was.

Added alias `plot_day_summary_ochl` with same call signature as
`plot_day_summary2`.

renamed the modified function to `plot_day_summary_ohlc`.

The first two functions simply call the third with the arguments
re-ordered.
  • Loading branch information
tacaswell committed Jul 21, 2013
commit 8745e3afb8ae40ccb1c4ae62d64f024fba26141c
54 changes: 53 additions & 1 deletion lib/matplotlib/finance.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from matplotlib.patches import Rectangle
from matplotlib.transforms import Affine2D

from matplotlib import MatplotlibDeprecationWarning as mplDeprecation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is best to import this from the cbook module.


cachedir = get_cachedir()
# cachedir will be None if there is no writable directory.
Expand Down Expand Up @@ -374,11 +375,62 @@ def candlestick(ax, quotes, width=0.2, colorup='k', colordown='r',
return lines, patches


def plot_day_summary2(ax, opens, highs, lows, closes ticksize=4,
def plot_day_summary2(ax, opens, closes, highs, lows, ticksize=4,
colorup='k', colordown='r',
):
"""

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.

ax : an Axes instance to plot to
ticksize : size of open and close ticks in points
colorup : the color of the lines where close >= open
colordown : the color of the lines where close < open

return value is a list of lines added
"""

warnings.warn("This function has been deprecated in 1.3 in favor"
"of `plot_day_summary_ochl`,"
"which maintains the natural argument order,"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it confusing to call this the "natural argument order", when everything is being converted to the standard financial industry order (if I understand correctly)? Maybe just call it the "original matplotlib argument order"? Or is there some larger rationale or citation for calling it "natural"? (To me, as a non-financial person, it does seem quite natural--but since this is a function for financial people, what seems natural to me is completely irrelevant.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take the editorial comment out.

"or `plot_day_summary_ohlc`,"
"which uses the open-high-low-close order."
"This function will be removed in 1.4", mplDeprecation)
return plot_day_summary_ohlc(ax, opens, highs, lows, closes, ticksize,
colorup, colordown)


def plot_day_summary_ochl(ax, opens, closes, highs, lows, ticksize=4,
colorup='k', colordown='r',
):

"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as possible, try using the new MEP10 conventions for the documentation. It corresponds to numpydoc's formatting.

More detail can be found here: https://github.com/matplotlib/matplotlib/wiki/Mep10


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.

ax : an Axes instance to plot to
ticksize : size of open and close ticks in points
colorup : the color of the lines where close >= open
colordown : the color of the lines where close < open

return value is a list of lines added
"""

return plot_day_summary_ohlc(ax, opens, highs, lows, closes, ticksize,
colorup, colordown)



def plot_day_summary_ohlc(ax, opens, highs, lows, closes, ticksize=4,
colorup='k', colordown='r',
):

"""

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.
Expand Down