Makes boxplot trace for increasing candlesticks _make_increasing_candle() and _make_decreasing_candle separate the increasing traces from the decreasing traces so kwargs (such as color) can be passed separately to increasing or decreasing traces when direction is set to 'increa
(open, high, low, close, dates, **kwargs)
| 8 | |
| 9 | |
| 10 | def make_increasing_candle(open, high, low, close, dates, **kwargs): |
| 11 | """ |
| 12 | Makes boxplot trace for increasing candlesticks |
| 13 | |
| 14 | _make_increasing_candle() and _make_decreasing_candle separate the |
| 15 | increasing traces from the decreasing traces so kwargs (such as |
| 16 | color) can be passed separately to increasing or decreasing traces |
| 17 | when direction is set to 'increasing' or 'decreasing' in |
| 18 | FigureFactory.create_candlestick() |
| 19 | |
| 20 | :param (list) open: opening values |
| 21 | :param (list) high: high values |
| 22 | :param (list) low: low values |
| 23 | :param (list) close: closing values |
| 24 | :param (list) dates: list of datetime objects. Default: None |
| 25 | :param kwargs: kwargs to be passed to increasing trace via |
| 26 | plotly.graph_objs.Scatter. |
| 27 | |
| 28 | :rtype (list) candle_incr_data: list of the box trace for |
| 29 | increasing candlesticks. |
| 30 | """ |
| 31 | increase_x, increase_y = _Candlestick( |
| 32 | open, high, low, close, dates, **kwargs |
| 33 | ).get_candle_increase() |
| 34 | |
| 35 | if "line" in kwargs: |
| 36 | kwargs.setdefault("fillcolor", kwargs["line"]["color"]) |
| 37 | else: |
| 38 | kwargs.setdefault("fillcolor", _DEFAULT_INCREASING_COLOR) |
| 39 | if "name" in kwargs: |
| 40 | kwargs.setdefault("showlegend", True) |
| 41 | else: |
| 42 | kwargs.setdefault("showlegend", False) |
| 43 | kwargs.setdefault("name", "Increasing") |
| 44 | kwargs.setdefault("line", dict(color=_DEFAULT_INCREASING_COLOR)) |
| 45 | |
| 46 | candle_incr_data = dict( |
| 47 | type="box", |
| 48 | x=increase_x, |
| 49 | y=increase_y, |
| 50 | whiskerwidth=0, |
| 51 | boxpoints=False, |
| 52 | **kwargs, |
| 53 | ) |
| 54 | |
| 55 | return [candle_incr_data] |
| 56 | |
| 57 | |
| 58 | def make_decreasing_candle(open, high, low, close, dates, **kwargs): |
no test coverage detected