Skip to content

Finance fixes #270

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 9 commits into from
Jul 29, 2015
Merged
Changes from 1 commit
Commits
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
more explicit dates argument check
so that you can pass in `dates=df.index` and nothing will fail with the
`datetimeindex isn’t a bool`
  • Loading branch information
chriddyp committed Jul 29, 2015
commit f08b7120c748376629911974077e80ad74c87f0c
14 changes: 6 additions & 8 deletions plotly/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2355,7 +2355,7 @@ def create_ohlc(open, high, low, close,
py.iplot(fig, filename='finance/simple-ohlc', validate=False)
```
"""
if dates:
if dates is not None:
TraceFactory.validate_equal_length(open, high, low, close, dates)
else:
TraceFactory.validate_equal_length(open, high, low, close)
Expand Down Expand Up @@ -2628,7 +2628,7 @@ def create_candlestick(open, high, low, close,
"""
FigureFactory.validate_ohlc(open, high, low, close, direction,
**kwargs)
if dates:
if dates is not None:
TraceFactory.validate_equal_length(open, high, low, close, dates)
else:
TraceFactory.validate_equal_length(open, high, low, close)
Expand Down Expand Up @@ -2683,10 +2683,8 @@ def __init__(self, open, high, low, close, dates, **kwargs):
self.low = low
self.close = close
self.empty = [None] * len(open)
if dates:
self.dates = dates
else:
self.dates = None
self.dates = dates

self.all_x = []
self.all_y = []
self.increase_x = []
Expand All @@ -2709,7 +2707,7 @@ def get_all_xy(self):
"""
self.all_y = list(zip(self.open, self.open, self.high,
self.low, self.close, self.close, self.empty))
if self.dates:
if self.dates is not None:
date_dif = []
for i in range(len(self.dates) - 1):
date_dif.append(self.dates[i + 1] - self.dates[i])
Expand Down Expand Up @@ -2780,7 +2778,7 @@ def __init__(self, open, high, low, close, dates, **kwargs):
self.high = high
self.low = low
self.close = close
if dates:
if dates is not None:
self.x = dates
else:
self.x = [x for x in range(len(self.open))]
Expand Down