mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
Fix SDK - openbb.ta.ma_chart - Command fails if index column is not labeled: "date". (#3556)
* fix date error * add examples
This commit is contained in:
@@ -56,9 +56,21 @@ def view_ma(
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.Axes]], optional
|
||||
External axes (1 axis is expected in the list), by default None
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> from openbb_terminal.sdk import openbb
|
||||
>>> df = openbb.stocks.load("AAPL")
|
||||
>>> openbb.ta.ma_chart(data=df["Adj Close"], symbol="AAPL", ma_type="EMA", window=[20, 50, 100])
|
||||
|
||||
|
||||
>>> from openbb_terminal.sdk import openbb
|
||||
>>> spuk_index = openbb.economy.index(indices = ["^SPUK"])
|
||||
>>> openbb.ta.ma_chart(data = spuk_index["^SPUK"], symbol = "S&P UK Index", ma_type = "EMA", window = [20, 50, 100])
|
||||
"""
|
||||
# Define a dataframe for adding EMA series to it
|
||||
price_df = pd.DataFrame(data)
|
||||
price_df.index.name = "date"
|
||||
|
||||
l_legend = [symbol]
|
||||
if not window:
|
||||
|
||||
Reference in New Issue
Block a user