I ask for help, because I can not understand what is wrong. There is a chart, you need to draw 2 horizontal lines on it, but for some reason I encounter a validator error Code:
df.set_index("Time", inplace=True)
df.index = pd.DatetimeIndex(df.index)
mpf.plot(df, type='candle', style='yahoo', title="Stock Price", ylabel='Price',
alines=dict(alines=[line_1, line_2], colors="r", linestyle="-"))
mpf.show()
Error:
TypeError: kwarg "alines" validator returned False for value: "{'alines': [[('189', 0.06682), ('999', 0.06682)], [('191', 0.06954), ('999' , 0.06954)]], 'colors': 'r', 'linestyle': '-'}"
'Validator' : lambda value: _alines_validator(value) },
The experience is not the first one already, and earlier the norms were created, the ** mplfinance ** library is used, but now for some reason it does not skip. Maybe my eyes are blurred. Please help. Thank you in advance! Have a nice day and clean working code everyone!
as a result, I need to get a graph like this, only yellow lines, but I can't do it: enter image description here
I believe the problem is that your "date/price" pairs do not contain dates. In place of the dates, you seem to be entering strings that represent integers.
For example, you have
[
[('189', 0.06682), ('999', 0.06682)],
[('191', 0.06954), ('999' , 0.06954)]
]
Perhaps this should be something more like:
[
[('2023-08-01', 0.06682), ('2023-09-01', 0.06682)],
[('2023-08-05', 0.06954), ('2023-09-01' , 0.06954)]
]