Plot Trading History

Analyze trading histories stored in S3 with this Jupyter Notebook

Plot a Trading History dataset using seaborn and matplotlib

analysis_engine.plot_trading_history.plot_trading_history(title, df, red=None, red_color=None, red_label=None, blue=None, blue_color=None, blue_label=None, green=None, green_color=None, green_label=None, orange=None, orange_color=None, orange_label=None, date_col='minute', xlabel='Minutes', ylabel='Algo Trading History Values', linestyle='-', width=9.0, height=9.0, date_format='%d\n%b', df_filter=None, start_date=None, footnote_text=None, footnote_xpos=0.7, footnote_ypos=0.01, footnote_color='#888888', footnote_fontsize=8, scale_y=False, show_plot=True, dropna_for_all=False, verbose=False, send_plots_to_slack=False)[source]

Plot columns up to 4 lines from the Trading History dataset

Parameters:
  • title – title of the plot
  • df – dataset which is pandas.DataFrame
  • red – string - column name to plot in red_color (or default ae_consts.PLOT_COLORS[red]) where the column is in the df and accessible with:df[red] (default is high)
  • red_color – hex color code to plot the data in the df[red] (default is ae_consts.PLOT_COLORS['red'])
  • red_label – optional - string for the label used to identify the red line in the legend
  • blue – string - column name to plot in blue_color (or default ae_consts.PLOT_COLORS['blue']) where the column is in the df and accessible with:df[blue] (default is close)
  • blue_color – hex color code to plot the data in the df[blue] (default is ae_consts.PLOT_COLORS['blue'])
  • blue_label – optional - string for the label used to identify the blue line in the legend
  • green – string - column name to plot in green_color (or default ae_consts.PLOT_COLORS['darkgreen']) where the column is in the df and accessible with:df[green]
  • green_color – hex color code to plot the data in the df[green] (default is ae_consts.PLOT_COLORS['darkgreen'])
  • green_label – optional - string for the label used to identify the green line in the legend
  • orange – string - column name to plot in orange_color (or default ae_consts.PLOT_COLORS['orange']) where the column is in the df and accessible with:df[orange]
  • orange_color – hex color code to plot the data in the df[orange] (default is ae_consts.PLOT_COLORS['orange'])
  • orange_label – optional - string for the label used to identify the orange line in the legend
  • date_col – string - date column name (default is minute)
  • xlabel – x-axis label
  • ylabel – y-axis label
  • linestyle – style of the plot line
  • width – float - width of the image
  • height – float - height of the image
  • date_format – string - format for dates
  • df_filter – optional - initialized pandas.DataFrame query for reducing the df records before plotting. As an eaxmple df_filter=(df['close'] > 0.01) would find only records in the df with a close value greater than 0.01
  • start_date – optional - string datetime for plotting only from a date formatted as YYYY-MM-DD HH\:MM\:SS
  • footnote_text – optional - string footnote text (default is algotraders <DATE>)
  • footnote_xpos – optional - float for footnote position on the x-axies (default is 0.75)
  • footnote_ypos – optional - float for footnote position on the y-axies (default is 0.01)
  • footnote_color – optional - string hex color code for the footnote text (default is #888888)
  • footnote_fontsize – optional - float footnote font size (default is 8)
  • scale_y

    optional - bool to scale the y-axis with .. code-block:: python

    use_ax.set_ylim(
    [0, use_ax.get_ylim()[1] * 3])
  • show_plot – bool to show the plot
  • dropna_for_all – optional - bool to toggle keep None’s in the plot df (default is drop them for display purposes)
  • verbose – optional - bool to show logs for debugging a dataset
  • send_plots_to_slack – optional - bool to send the dnn plot to slack