Skip to content

Commit

Permalink
Add chapter on rule-based results + fix bug in classical classifier πŸ‘¨β€¦
Browse files Browse the repository at this point in the history
β€¦β€πŸ’» (#402)
  • Loading branch information
KarelZe authored Jun 7, 2023
1 parent f04b70b commit cdf4819
Show file tree
Hide file tree
Showing 13 changed files with 435 additions and 289 deletions.
6 changes: 3 additions & 3 deletions notebooks/6.0a-mb-visualizations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"ax[0].plot(accuracies_over_time_ise[\"tick(all)\"], label=\"$\\operatorname{tick}_{\\mathrm{all}}$\", lw=1)\n",
"ax[0].plot(accuracies_over_time_ise[\"quote(best)\"], label=\"$\\operatorname{quote}_{\\mathrm{nbbo}}$\", lw=1, zorder=20)\n",
"ax[0].plot(accuracies_over_time_ise[\"quote(best)->quote(ex)->rev_tick(all)\"], label=r\"$\\operatorname{quote}_{\\mathrm{nbbo}} \\to \\operatorname{quote}_{\\mathrm{ex}} \\to \\operatorname{rtick}_{\\mathrm{all}}$\", lw=1, zorder=50)\n",
"ax[0].plot(accuracies_over_time_ise[\"trade_size(ex)->quote(best)->quote(ex)->depth(best)->depth(ex)->rev_tick(all)\"], label=r\"$\\operatorname{tsize}_{\\mathrm{ex}} \\to \\operatorname{quote}_{\\mathrm{nbbo}} \\to \\operatorname{quote}_{\\mathrm{ex}} \\to \\operatorname{depth}_{\\mathrm{nbbo}} \\to \\operatorname{depth}_{\\mathrm{ex}} \\to \\operatorname{rtick}_{\\mathrm{all}}$\", lw=1, zorder=100)\n",
"ax[0].plot(accuracies_over_time_ise[\"trade_size(ex)->quote(best)->quote(ex)->depth(best)->depth(ex)->rev_tick(all)\"], label=r\"$\\operatorname{gsu}$\", lw=1, zorder=100)\n",
"\n",
"ax[0].axvline(x=pd.Timestamp('2013-10-24'), linestyle='--', color='grey', linewidth=0.5)\n",
"ax[0].axvline(x=pd.Timestamp('2015-11-05'), linestyle='--', color='grey', linewidth=0.5)\n",
Expand All @@ -113,7 +113,7 @@
"ax[1].plot(accuracies_over_time_cboe[\"tick(all)\"], label=\"$\\operatorname{tick}_{\\mathrm{all}}$\", lw=1)\n",
"ax[1].plot(accuracies_over_time_cboe[\"quote(best)\"], label=\"$\\operatorname{quote}_{\\mathrm{nbbo}}$\", lw=1, zorder=20)\n",
"ax[1].plot(accuracies_over_time_cboe[\"quote(best)->quote(ex)->rev_tick(all)\"], label=r\"$\\operatorname{quote}_{\\mathrm{nbbo}} \\to \\operatorname{quote}_{\\mathrm{ex}} \\to \\operatorname{rtick}_{\\mathrm{all}}$\", lw=1, zorder=50)\n",
"ax[1].plot(accuracies_over_time_cboe[\"trade_size(ex)->quote(best)->quote(ex)->depth(best)->depth(ex)->rev_tick(all)\"], label=r\"$\\operatorname{tsize}_{\\mathrm{ex}} \\to \\operatorname{quote}_{\\mathrm{nbbo}} \\to \\operatorname{quote}_{\\mathrm{ex}} \\to \\newline \\operatorname{depth}_{\\mathrm{nbbo}} \\to \\operatorname{depth}_{\\mathrm{ex}} \\to \\operatorname{rtick}_{\\mathrm{all}}$\", lw=1, zorder=100)\n",
"ax[1].plot(accuracies_over_time_cboe[\"trade_size(ex)->quote(best)->quote(ex)->depth(best)->depth(ex)->rev_tick(all)\"], label=r\"$\\operatorname{gsu}$\", lw=1, zorder=100)\n",
"\n",
"ax[1].axvline(x=pd.Timestamp('2015-11-05'), linestyle='--', color='grey', linewidth=0.5)\n",
"\n",
Expand Down Expand Up @@ -148,7 +148,7 @@
"# plt.ylabel(\"Accuracy\")\n",
"\n",
"plt.tight_layout()\n",
"plt.savefig(\"../reports/Graphs/accuracies_over_time_ise_cboe.pdf\", bbox_inches=\"tight\")"
"plt.savefig(\"../reports/Graphs/accuracies_over_time.pdf\", bbox_inches=\"tight\")"
]
},
{
Expand Down
97 changes: 50 additions & 47 deletions references/obsidian/πŸ“–chapters/πŸ…Results.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion reports/Content/data-preprocessing.tex
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ \subsubsection{Data Preprocessing}\label{sec:data-preprocessing}
Features and feature sets are documented in \cref{tab:feature-sets}.
We aid the models by estimating the change in trade price between the previous and successive distinguishable trades. This is identical to the criterion used in the (reverse) tick rule, but in a non-quantized fashion to enforce a richer decision boundary and to surpass hard cut-off points. Similarly, the proximity of the trade price to the quotes, which is the decisive criterion in the quote rule and hybrids' thereof is added. The feature value ranges from $\left(-\infty,\infty\right)$ and is $-1$ for trades at the bid, 0 for trades at the mid, and 1 for trades at the ask. Quotes and trade prices are also incorporated as-is.

\todo{add reasoning. depth rule and trade size rule yield significant improvements and must be considered state of the art. Thus, extend feature set}
\todo{add reasoning. depth rule and trade size rule yield significant improvements and must be considered state of the art. Thus, extend feature set. See e.g., Savickas p. 889}

Our second feature set extends the first feature set by the trade size and size of the quotes, required to estimate hybrid rules involving the depth rule and trade size rule. Both rules are state-of-the-art when paired with hybrid algorithms and are thus both benchmark and source of features. We model the depth rule as the ratio between ask and bid sizes and the trade size rule as the ratio between the size of the trade and the quoted bid and ask sizes. Since features are not discretized, we obtain a generic formulation of the trade size rule, where part of the quoted size can remain unfilled. The trade price and midspread required for the depth rule are already encompassed in the first feature set.

Expand Down
50 changes: 0 additions & 50 deletions reports/Content/diff-cboe_transfer_test.tex

This file was deleted.

50 changes: 0 additions & 50 deletions reports/Content/diff-ise_supervised_test.tex

This file was deleted.

43 changes: 21 additions & 22 deletions reports/Content/effective-spread.tex
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
\begin{threeparttable}
\begin{tabular}{@{}lSSSS@{}}
{} & \multicolumn{2}{l}{\textbf{Panel A:} \gls{ISE} Dataset} & \multicolumn{2}{l}{\textbf{Panel B:} \gls{CBOE} Dataset} \\
\toprule
{} & {Eff. Spread} & {Eff. Spread} & {Eff. Spread} & {Eff. Spread} \\
{} & {(in \$)} & {(in \%)} & {(in \$)} & {(in \%)} \\ \midrule
Tick Test & 1.556755 & 1.073441 \tnote{*} & 1.398457 & 2.286679 \tnote{*} \\
Quote Rule & 16.333263 & 16.207394 \tnote{*} & 12.538848 & 14.209334 \tnote{*} \\
\gls{LR} Algorithm & 16.333263 & 16.207394 \tnote{*} & 12.538848 & 14.209334 \tnote{*} \\
\gls{EMO} Rule & 4.646510 & 8.443125 \tnote{*} & 4.086547 & 7.418858 \tnote{*} \\
\gls{CLNV} Method & 11.625950 & 13.283967 \tnote{*} & 8.673450 & 11.051837 \tnote{*} \\
\gls{GSU} Method & 1.415065 & 4.292678 \tnote{*} & 5.204582 & 7.027343 \tnote{*} \\ \midrule
\gls{GBRT} (FS1) & 7.413810 & 9.185910 \tnote{*} & 6.107553 & 9.557821 \tnote{*} \\
\gls{GBRT} (FS2) & 4.247477 & 6.982754 \tnote{*} & 3.640036 & 7.152729 \tnote{*} \\
\gls{GBRT} (FS3) & 3.740719 & 6.512824 \tnote{*} & 3.470571 & 6.688818 \tnote{*} \\
FT-Transformer (FS1) & & \tnote{*} & & \tnote{*} \\
FT-Transformer (FS2) & & \tnote{*} & & \tnote{*} \\
FT-Transformer (FS3) & & \tnote{*} & & \tnote{*} \\ \midrule
\gls{GBRT} (FS1) & & \tnote{*} & & \tnote{*} \\
\gls{GBRT} (FS2) & & \tnote{*} & & \tnote{*} \\
\gls{GBRT} (FS3) & & \tnote{*} & & \tnote{*} \\
FT-Transformer (FS1) & & \tnote{*} & & \tnote{*} \\
FT-Transformer (FS2) & & \tnote{*} & & \tnote{*} \\
FT-Transformer (FS3) & & \tnote{*} & & \tnote{*} \\ \midrule
True Effective Spread & 0.492556 & 3.715891 & 1.221870 & 2.512159 \\ \bottomrule
{} & \multicolumn{2}{c}{Effective Spread at \gls{ISE}} & \multicolumn{2}{c}{Effective Spread at \gls{CBOE}} \\ \cmidrule(lr){2-3}\cmidrule(lr){4-5}
{Classifier} & {in \$} & {in \%} & {in \$} & {in \%} \\ \midrule
$\operatorname{tick}_{\mathrm{ex}}$ & 99.99 & 99.99 \tnote{*} & 99.99 & 99.99 \tnote{*} \\
$\operatorname{quote}_{\mathrm{ex}}$ & & \tnote{*} & & \tnote{*} \\
$\operatorname{lr}_{\mathrm{ex}}$ & & \tnote{*} & & \tnote{*} \\
$\operatorname{emo}_{\mathrm{ex}}$ & & \tnote{*} & & \tnote{*} \\
$\operatorname{clnv}_{\mathrm{ex}}$ & & \tnote{*} & & \tnote{*} \\
$\operatorname{gsu}$ & & \tnote{*} & & \tnote{*} \\ \midrule
\gls{GBRT} (FS1) & & \tnote{*} & & \tnote{*} \\
\gls{GBRT} (FS2) & & \tnote{*} & & \tnote{*} \\
\gls{GBRT} (FS3) & & \tnote{*} & & \tnote{*} \\
FT-Transformer (FS1) & & \tnote{*} & & \tnote{*} \\
FT-Transformer (FS2) & & \tnote{*} & & \tnote{*} \\
FT-Transformer (FS3) & & \tnote{*} & & \tnote{*} \\ \midrule
\gls{GBRT} (Semi) (FS1) & & \tnote{*} & & \tnote{*} \\
\gls{GBRT} (Semi) (FS2) & & \tnote{*} & & \tnote{*} \\
\gls{GBRT} (Semi) (FS3) & & \tnote{*} & & \tnote{*} \\
FT-Transformer (Semi) (FS1) & & \tnote{*} & & \tnote{*} \\
FT-Transformer (Semi) (FS2) & & \tnote{*} & & \tnote{*} \\
FT-Transformer (Semi) (FS3) & & \tnote{*} & & \tnote{*} \\ \midrule
True Effective Spread & 0.492556 & 3.715891 & 1.221870 & 2.512159 \\ \bottomrule
%Quoted Spread & & \\ \midrule
\end{tabular}
\begin{tablenotes}\footnotesize
Expand Down
Loading

0 comments on commit cdf4819

Please sign in to comment.