MCPcopy Index your code
hub / github.com/plotly/plotly.py / create_candlestick

Function create_candlestick

plotly/figure_factory/_candlestick.py:98–212  ·  view source on GitHub ↗

**deprecated**, use instead the plotly.graph_objects trace :class:`plotly.graph_objects.Candlestick` :param (list) open: opening values :param (list) high: high values :param (list) low: low values :param (list) close: closing values :param (list) dates: list of datetim

(open, high, low, close, dates=None, direction="both", **kwargs)

Source from the content-addressed store, hash-verified

96
97
98def create_candlestick(open, high, low, close, dates=None, direction="both", **kwargs):
99 """
100 **deprecated**, use instead the plotly.graph_objects trace
101 :class:`plotly.graph_objects.Candlestick`
102
103 :param (list) open: opening values
104 :param (list) high: high values
105 :param (list) low: low values
106 :param (list) close: closing values
107 :param (list) dates: list of datetime objects. Default: None
108 :param (string) direction: direction can be 'increasing', 'decreasing',
109 or 'both'. When the direction is 'increasing', the returned figure
110 consists of all candlesticks where the close value is greater than
111 the corresponding open value, and when the direction is
112 'decreasing', the returned figure consists of all candlesticks
113 where the close value is less than or equal to the corresponding
114 open value. When the direction is 'both', both increasing and
115 decreasing candlesticks are returned. Default: 'both'
116 :param kwargs: kwargs passed through plotly.graph_objs.Scatter.
117 These kwargs describe other attributes about the ohlc Scatter trace
118 such as the color or the legend name. For more information on valid
119 kwargs call help(plotly.graph_objs.Scatter)
120
121 :rtype (dict): returns a representation of candlestick chart figure.
122
123 Example 1: Simple candlestick chart from a Pandas DataFrame
124
125 >>> from plotly.figure_factory import create_candlestick
126 >>> from datetime import datetime
127 >>> import pandas as pd
128
129 >>> df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
130 >>> fig = create_candlestick(df['AAPL.Open'], df['AAPL.High'], df['AAPL.Low'], df['AAPL.Close'],
131 ... dates=df.index)
132 >>> fig.show()
133
134 Example 2: Customize the candlestick colors
135
136 >>> from plotly.figure_factory import create_candlestick
137 >>> from plotly.graph_objs import Line, Marker
138 >>> from datetime import datetime
139
140 >>> import pandas as pd
141 >>> df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
142
143 >>> # Make increasing candlesticks and customize their color and name
144 >>> fig_increasing = create_candlestick(df['AAPL.Open'], df['AAPL.High'], df['AAPL.Low'], df['AAPL.Close'],
145 ... dates=df.index,
146 ... direction='increasing', name='AAPL',
147 ... marker=Marker(color='rgb(150, 200, 250)'),
148 ... line=Line(color='rgb(150, 200, 250)'))
149
150 >>> # Make decreasing candlesticks and customize their color and name
151 >>> fig_decreasing = create_candlestick(df['AAPL.Open'], df['AAPL.High'], df['AAPL.Low'], df['AAPL.Close'],
152 ... dates=df.index,
153 ... direction='decreasing',
154 ... marker=Marker(color='rgb(128, 128, 128)'),
155 ... line=Line(color='rgb(128, 128, 128)'))

Callers 1

create_candlestickMethod · 0.90

Calls 3

validate_ohlcFunction · 0.90
make_increasing_candleFunction · 0.85
make_decreasing_candleFunction · 0.85

Tested by

no test coverage detected