Skip to content

Commit

Permalink
docs: update the tutorials.
Browse files Browse the repository at this point in the history
  • Loading branch information
nkaz001 committed Aug 10, 2024
1 parent f8549e0 commit b6e591d
Show file tree
Hide file tree
Showing 23 changed files with 5,545 additions and 3,269 deletions.
203 changes: 94 additions & 109 deletions docs/tutorials/Data Preparation.ipynb

Large diffs are not rendered by default.

93 changes: 48 additions & 45 deletions docs/tutorials/GLFT Market Making Model and Grid Trading.ipynb

Large diffs are not rendered by default.

826 changes: 414 additions & 412 deletions docs/tutorials/Getting Started.ipynb

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions docs/tutorials/High-Frequency Grid Trading.ipynb

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions docs/tutorials/Impact of Order Latency.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@
" trade_price_tick = last_trade.px / tick_size\n",
" \n",
" if last_trade.ev & BUY_EVENT == BUY_EVENT:\n",
" depth = np.nanmax([trade_price_tick - mid_price_tick, depth])\n",
" depth = max(trade_price_tick - mid_price_tick, depth)\n",
" else:\n",
" depth = np.nanmax([mid_price_tick - trade_price_tick, depth])\n",
" depth = max(mid_price_tick - trade_price_tick, depth)\n",
" arrival_depth[t] = depth\n",
" \n",
" hbt.clear_last_trades(asset_no)\n",
Expand Down Expand Up @@ -151,12 +151,13 @@
" # Calibrates A, k\n",
" tmp[:] = 0\n",
" lambda_ = measure_trading_intensity(arrival_depth[t + 1 - 6_000:t + 1], tmp)\n",
" lambda_ = lambda_[:70] / 600\n",
" x = ticks[:len(lambda_)]\n",
" y = np.log(lambda_)\n",
" k_, logA = linear_regression(x, y)\n",
" A = np.exp(logA)\n",
" k = -k_\n",
" if len(lambda_) > 2:\n",
" lambda_ = lambda_[:70] / 600\n",
" x = ticks[:len(lambda_)]\n",
" y = np.log(lambda_)\n",
" k_, logA = linear_regression(x, y)\n",
" A = np.exp(logA)\n",
" k = -k_\n",
" \n",
" # Updates the volatility.\n",
" volatility = np.nanstd(mid_price_chg[t + 1 - 6_000:t + 1]) * np.sqrt(10)\n",
Expand All @@ -171,8 +172,8 @@
" \n",
" reservation_price_tick = mid_price_tick - skew * position\n",
"\n",
" bid_price_tick = np.minimum(np.round(reservation_price_tick - half_spread_tick), best_bid_tick)\n",
" ask_price_tick = np.maximum(np.round(reservation_price_tick + half_spread_tick), best_ask_tick)\n",
" bid_price_tick = min(np.round(reservation_price_tick - half_spread_tick), best_bid_tick)\n",
" ask_price_tick = max(np.round(reservation_price_tick + half_spread_tick), best_ask_tick)\n",
" \n",
" bid_price = bid_price_tick * tick_size\n",
" ask_price = ask_price_tick * tick_size\n",
Expand Down
1,188 changes: 955 additions & 233 deletions docs/tutorials/Integrating Custom Data.ipynb

Large diffs are not rendered by default.

1,096 changes: 601 additions & 495 deletions docs/tutorials/Making Multiple Markets.ipynb

Large diffs are not rendered by default.

285 changes: 152 additions & 133 deletions docs/tutorials/Probability Queue Models.ipynb

Large diffs are not rendered by default.

577 changes: 330 additions & 247 deletions docs/tutorials/Working with Market Depth and Trades.ipynb

Large diffs are not rendered by default.

203 changes: 94 additions & 109 deletions examples/Data Preparation.ipynb

Large diffs are not rendered by default.

93 changes: 48 additions & 45 deletions examples/GLFT Market Making Model and Grid Trading.ipynb

Large diffs are not rendered by default.

826 changes: 414 additions & 412 deletions examples/Getting Started.ipynb

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions examples/High-Frequency Grid Trading.ipynb

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions examples/Impact of Order Latency.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@
" trade_price_tick = last_trade.px / tick_size\n",
" \n",
" if last_trade.ev & BUY_EVENT == BUY_EVENT:\n",
" depth = np.nanmax([trade_price_tick - mid_price_tick, depth])\n",
" depth = max(trade_price_tick - mid_price_tick, depth)\n",
" else:\n",
" depth = np.nanmax([mid_price_tick - trade_price_tick, depth])\n",
" depth = max(mid_price_tick - trade_price_tick, depth)\n",
" arrival_depth[t] = depth\n",
" \n",
" hbt.clear_last_trades(asset_no)\n",
Expand Down Expand Up @@ -151,12 +151,13 @@
" # Calibrates A, k\n",
" tmp[:] = 0\n",
" lambda_ = measure_trading_intensity(arrival_depth[t + 1 - 6_000:t + 1], tmp)\n",
" lambda_ = lambda_[:70] / 600\n",
" x = ticks[:len(lambda_)]\n",
" y = np.log(lambda_)\n",
" k_, logA = linear_regression(x, y)\n",
" A = np.exp(logA)\n",
" k = -k_\n",
" if len(lambda_) > 2:\n",
" lambda_ = lambda_[:70] / 600\n",
" x = ticks[:len(lambda_)]\n",
" y = np.log(lambda_)\n",
" k_, logA = linear_regression(x, y)\n",
" A = np.exp(logA)\n",
" k = -k_\n",
" \n",
" # Updates the volatility.\n",
" volatility = np.nanstd(mid_price_chg[t + 1 - 6_000:t + 1]) * np.sqrt(10)\n",
Expand All @@ -171,8 +172,8 @@
" \n",
" reservation_price_tick = mid_price_tick - skew * position\n",
"\n",
" bid_price_tick = np.minimum(np.round(reservation_price_tick - half_spread_tick), best_bid_tick)\n",
" ask_price_tick = np.maximum(np.round(reservation_price_tick + half_spread_tick), best_ask_tick)\n",
" bid_price_tick = min(np.round(reservation_price_tick - half_spread_tick), best_bid_tick)\n",
" ask_price_tick = max(np.round(reservation_price_tick + half_spread_tick), best_ask_tick)\n",
" \n",
" bid_price = bid_price_tick * tick_size\n",
" ask_price = ask_price_tick * tick_size\n",
Expand Down
Loading

0 comments on commit b6e591d

Please sign in to comment.