traders_copilot_mzza_25.plot_signals
Functions
|
Ensure the DataFrame contains the specified price and time columns. |
|
Ensure the lengths of the price and time columns match. |
|
Ensure both price and time columns are non-empty. |
|
Validate that each date in the time column is in the 'YYYY-MM-DD' format. |
|
Generate a Matplotlib figure for the price vs. time data. |
|
Plot a time series depicting the price at specific timestamps from a DataFrame. |
Module Contents
- traders_copilot_mzza_25.plot_signals.validate_columns(data, price_col, time_col)[source]
Ensure the DataFrame contains the specified price and time columns.
- traders_copilot_mzza_25.plot_signals.validate_lengths(data, price_col, time_col)[source]
Ensure the lengths of the price and time columns match.
- traders_copilot_mzza_25.plot_signals.validate_non_empty(data, price_col, time_col)[source]
Ensure both price and time columns are non-empty.
- traders_copilot_mzza_25.plot_signals.validate_dates(data, time_col)[source]
Validate that each date in the time column is in the ‘YYYY-MM-DD’ format.
- traders_copilot_mzza_25.plot_signals.generate_plot(price, time)[source]
Generate a Matplotlib figure for the price vs. time data.
- traders_copilot_mzza_25.plot_signals.plot_signals(data, price_col='Close', time_col='Date')[source]
Plot a time series depicting the price at specific timestamps from a DataFrame.
- Parameters:
data (pandas.DataFrame) – The input DataFrame containing price and time data.
price_col (str, optional) – The column name for price data (default is “Close”).
time_col (str, optional) – The column name for time data (default is “Date”).
- Returns:
The Matplotlib figure object containing the time series plot.
- Return type:
matplotlib.figure.Figure
- Raises:
ValueError – If the DataFrame does not contain the specified columns. If the lengths of the columns do not match. If the columns are empty. If any date in the time column is not in the ‘YYYY-MM-DD’ format.
Examples
>>> data = pd.DataFrame({"Date": ["2023-01-01", "2023-01-02", "2023-01-03"], >>> "Close": [100, 102, 104]}) >>> fig = plot_signals(data) >>> fig.show()