Notebook

# Plot XIV 'bars to fill'Â¶

This is to get an idea of the number of bars it would take, on average, to fill a $5000 order for XIV. In [3]: day_pricing = get_pricing("xiv", fields=['volume','price'], start_date='2010-12-01', end_date='2016-12-01') day_pricing.plot()  Out[3]: <matplotlib.axes._subplots.AxesSubplot at 0x7fe166db8a50> In [5]: day_pricing['price_vol'] = day_pricing.price * day_pricing.volume day_pricing  Out[5]: volume price price_vol 2010-12-01 00:00:00+00:00 491360.0 9.787 4.808940e+06 2010-12-02 00:00:00+00:00 66000.0 10.429 6.883140e+05 2010-12-03 00:00:00+00:00 164100.0 11.041 1.811828e+06 2010-12-06 00:00:00+00:00 239130.0 11.252 2.690691e+06 2010-12-07 00:00:00+00:00 438000.0 11.358 4.974804e+06 2010-12-08 00:00:00+00:00 759160.0 11.555 8.772094e+06 2010-12-09 00:00:00+00:00 149000.0 11.785 1.755965e+06 2010-12-10 00:00:00+00:00 37750.0 11.917 4.498668e+05 2010-12-13 00:00:00+00:00 53500.0 11.748 6.285180e+05 2010-12-14 00:00:00+00:00 69000.0 11.669 8.051610e+05 2010-12-15 00:00:00+00:00 232650.0 11.415 2.655700e+06 2010-12-16 00:00:00+00:00 81480.0 11.568 9.425606e+05 2010-12-17 00:00:00+00:00 165550.0 11.822 1.957132e+06 2010-12-20 00:00:00+00:00 36500.0 12.135 4.429275e+05 2010-12-21 00:00:00+00:00 93260.0 12.334 1.150269e+06 2010-12-22 00:00:00+00:00 55000.0 12.366 6.801300e+05 2010-12-23 00:00:00+00:00 120500.0 11.969 1.442264e+06 2010-12-27 00:00:00+00:00 12000.0 11.650 1.398000e+05 2010-12-28 00:00:00+00:00 27000.0 11.537 3.114990e+05 2010-12-29 00:00:00+00:00 98000.0 11.780 1.154440e+06 2010-12-30 00:00:00+00:00 32700.0 11.847 3.873969e+05 2010-12-31 00:00:00+00:00 87680.0 11.954 1.048127e+06 2011-01-03 00:00:00+00:00 106600.0 12.380 1.319708e+06 2011-01-04 00:00:00+00:00 31020.0 12.135 3.764277e+05 2011-01-05 00:00:00+00:00 65400.0 12.599 8.239746e+05 2011-01-06 00:00:00+00:00 89000.0 12.526 1.114814e+06 2011-01-07 00:00:00+00:00 103500.0 12.508 1.294578e+06 2011-01-10 00:00:00+00:00 152000.0 12.546 1.906992e+06 2011-01-11 00:00:00+00:00 266300.0 12.916 3.439531e+06 2011-01-12 00:00:00+00:00 56500.0 13.492 7.622980e+05 ... ... ... ... 2016-10-20 00:00:00+00:00 18893526.0 39.300 7.425156e+08 2016-10-21 00:00:00+00:00 14413303.0 40.110 5.781176e+08 2016-10-24 00:00:00+00:00 10029437.0 41.526 4.164824e+08 2016-10-25 00:00:00+00:00 15072277.0 41.085 6.192445e+08 2016-10-26 00:00:00+00:00 18687628.0 40.070 7.488133e+08 2016-10-27 00:00:00+00:00 18365175.0 39.350 7.226696e+08 2016-10-28 00:00:00+00:00 34300832.0 37.660 1.291769e+09 2016-10-31 00:00:00+00:00 16567272.0 36.880 6.110010e+08 2016-11-01 00:00:00+00:00 32568777.0 35.820 1.166614e+09 2016-11-02 00:00:00+00:00 26666113.0 35.011 9.336073e+08 2016-11-03 00:00:00+00:00 25741762.0 33.120 8.525672e+08 2016-11-04 00:00:00+00:00 26158230.0 33.049 8.645033e+08 2016-11-07 00:00:00+00:00 26160009.0 37.190 9.728907e+08 2016-11-08 00:00:00+00:00 28698741.0 38.140 1.094570e+09 2016-11-09 00:00:00+00:00 48300373.0 39.080 1.887579e+09 2016-11-10 00:00:00+00:00 52147620.0 38.010 1.982131e+09 2016-11-11 00:00:00+00:00 22392277.0 38.880 8.706117e+08 2016-11-14 00:00:00+00:00 20269349.0 39.090 7.923289e+08 2016-11-15 00:00:00+00:00 16797263.0 40.770 6.848244e+08 2016-11-16 00:00:00+00:00 15803226.0 40.490 6.398726e+08 2016-11-17 00:00:00+00:00 12964033.0 41.660 5.400816e+08 2016-11-18 00:00:00+00:00 15362823.0 41.860 6.430878e+08 2016-11-21 00:00:00+00:00 12070076.0 43.750 5.280658e+08 2016-11-22 00:00:00+00:00 13744185.0 43.510 5.980095e+08 2016-11-23 00:00:00+00:00 12461259.0 43.420 5.410679e+08 2016-11-25 00:00:00+00:00 4917206.0 43.680 2.147836e+08 2016-11-28 00:00:00+00:00 13022534.0 43.290 5.637455e+08 2016-11-29 00:00:00+00:00 10421701.0 43.600 4.543862e+08 2016-11-30 00:00:00+00:00 15462470.0 43.560 6.735452e+08 2016-12-01 00:00:00+00:00 23709422.0 41.910 9.936619e+08 1512 rows × 3 columns In [7]: day_pricing['mean_minute_dollar_vol'] = day_pricing.price_vol/390 day_pricing  Out[7]: volume price price_vol mean_minute_dollar_vol 2010-12-01 00:00:00+00:00 491360.0 9.787 4.808940e+06 1.233062e+04 2010-12-02 00:00:00+00:00 66000.0 10.429 6.883140e+05 1.764908e+03 2010-12-03 00:00:00+00:00 164100.0 11.041 1.811828e+06 4.645713e+03 2010-12-06 00:00:00+00:00 239130.0 11.252 2.690691e+06 6.899207e+03 2010-12-07 00:00:00+00:00 438000.0 11.358 4.974804e+06 1.275591e+04 2010-12-08 00:00:00+00:00 759160.0 11.555 8.772094e+06 2.249255e+04 2010-12-09 00:00:00+00:00 149000.0 11.785 1.755965e+06 4.502474e+03 2010-12-10 00:00:00+00:00 37750.0 11.917 4.498668e+05 1.153504e+03 2010-12-13 00:00:00+00:00 53500.0 11.748 6.285180e+05 1.611585e+03 2010-12-14 00:00:00+00:00 69000.0 11.669 8.051610e+05 2.064515e+03 2010-12-15 00:00:00+00:00 232650.0 11.415 2.655700e+06 6.809487e+03 2010-12-16 00:00:00+00:00 81480.0 11.568 9.425606e+05 2.416822e+03 2010-12-17 00:00:00+00:00 165550.0 11.822 1.957132e+06 5.018287e+03 2010-12-20 00:00:00+00:00 36500.0 12.135 4.429275e+05 1.135712e+03 2010-12-21 00:00:00+00:00 93260.0 12.334 1.150269e+06 2.949407e+03 2010-12-22 00:00:00+00:00 55000.0 12.366 6.801300e+05 1.743923e+03 2010-12-23 00:00:00+00:00 120500.0 11.969 1.442264e+06 3.698114e+03 2010-12-27 00:00:00+00:00 12000.0 11.650 1.398000e+05 3.584615e+02 2010-12-28 00:00:00+00:00 27000.0 11.537 3.114990e+05 7.987154e+02 2010-12-29 00:00:00+00:00 98000.0 11.780 1.154440e+06 2.960103e+03 2010-12-30 00:00:00+00:00 32700.0 11.847 3.873969e+05 9.933254e+02 2010-12-31 00:00:00+00:00 87680.0 11.954 1.048127e+06 2.687504e+03 2011-01-03 00:00:00+00:00 106600.0 12.380 1.319708e+06 3.383867e+03 2011-01-04 00:00:00+00:00 31020.0 12.135 3.764277e+05 9.651992e+02 2011-01-05 00:00:00+00:00 65400.0 12.599 8.239746e+05 2.112755e+03 2011-01-06 00:00:00+00:00 89000.0 12.526 1.114814e+06 2.858497e+03 2011-01-07 00:00:00+00:00 103500.0 12.508 1.294578e+06 3.319431e+03 2011-01-10 00:00:00+00:00 152000.0 12.546 1.906992e+06 4.889723e+03 2011-01-11 00:00:00+00:00 266300.0 12.916 3.439531e+06 8.819310e+03 2011-01-12 00:00:00+00:00 56500.0 13.492 7.622980e+05 1.954610e+03 ... ... ... ... ... 2016-10-20 00:00:00+00:00 18893526.0 39.300 7.425156e+08 1.903886e+06 2016-10-21 00:00:00+00:00 14413303.0 40.110 5.781176e+08 1.482353e+06 2016-10-24 00:00:00+00:00 10029437.0 41.526 4.164824e+08 1.067904e+06 2016-10-25 00:00:00+00:00 15072277.0 41.085 6.192445e+08 1.587806e+06 2016-10-26 00:00:00+00:00 18687628.0 40.070 7.488133e+08 1.920034e+06 2016-10-27 00:00:00+00:00 18365175.0 39.350 7.226696e+08 1.852999e+06 2016-10-28 00:00:00+00:00 34300832.0 37.660 1.291769e+09 3.312229e+06 2016-10-31 00:00:00+00:00 16567272.0 36.880 6.110010e+08 1.566669e+06 2016-11-01 00:00:00+00:00 32568777.0 35.820 1.166614e+09 2.991317e+06 2016-11-02 00:00:00+00:00 26666113.0 35.011 9.336073e+08 2.393865e+06 2016-11-03 00:00:00+00:00 25741762.0 33.120 8.525672e+08 2.186070e+06 2016-11-04 00:00:00+00:00 26158230.0 33.049 8.645033e+08 2.216675e+06 2016-11-07 00:00:00+00:00 26160009.0 37.190 9.728907e+08 2.494592e+06 2016-11-08 00:00:00+00:00 28698741.0 38.140 1.094570e+09 2.806590e+06 2016-11-09 00:00:00+00:00 48300373.0 39.080 1.887579e+09 4.839945e+06 2016-11-10 00:00:00+00:00 52147620.0 38.010 1.982131e+09 5.082387e+06 2016-11-11 00:00:00+00:00 22392277.0 38.880 8.706117e+08 2.232338e+06 2016-11-14 00:00:00+00:00 20269349.0 39.090 7.923289e+08 2.031612e+06 2016-11-15 00:00:00+00:00 16797263.0 40.770 6.848244e+08 1.755960e+06 2016-11-16 00:00:00+00:00 15803226.0 40.490 6.398726e+08 1.640699e+06 2016-11-17 00:00:00+00:00 12964033.0 41.660 5.400816e+08 1.384825e+06 2016-11-18 00:00:00+00:00 15362823.0 41.860 6.430878e+08 1.648943e+06 2016-11-21 00:00:00+00:00 12070076.0 43.750 5.280658e+08 1.354015e+06 2016-11-22 00:00:00+00:00 13744185.0 43.510 5.980095e+08 1.533358e+06 2016-11-23 00:00:00+00:00 12461259.0 43.420 5.410679e+08 1.387354e+06 2016-11-25 00:00:00+00:00 4917206.0 43.680 2.147836e+08 5.507271e+05 2016-11-28 00:00:00+00:00 13022534.0 43.290 5.637455e+08 1.445501e+06 2016-11-29 00:00:00+00:00 10421701.0 43.600 4.543862e+08 1.165093e+06 2016-11-30 00:00:00+00:00 15462470.0 43.560 6.735452e+08 1.727039e+06 2016-12-01 00:00:00+00:00 23709422.0 41.910 9.936619e+08 2.547851e+06 1512 rows × 4 columns In [8]: minutes_to_trade = 5000 / (day_pricing.mean_minute_dollar_vol * .025) minutes_to_trade  Out[8]: 2010-12-01 00:00:00+00:00 16.219790 2010-12-02 00:00:00+00:00 113.320374 2010-12-03 00:00:00+00:00 43.050442 2010-12-06 00:00:00+00:00 28.988839 2010-12-07 00:00:00+00:00 15.679010 2010-12-08 00:00:00+00:00 8.891834 2010-12-09 00:00:00+00:00 44.420020 2010-12-10 00:00:00+00:00 173.384674 2010-12-13 00:00:00+00:00 124.101458 2010-12-14 00:00:00+00:00 96.875035 2010-12-15 00:00:00+00:00 29.370790 2010-12-16 00:00:00+00:00 82.753296 2010-12-17 00:00:00+00:00 39.854234 2010-12-20 00:00:00+00:00 176.101055 2010-12-21 00:00:00+00:00 67.810235 2010-12-22 00:00:00+00:00 114.683957 2010-12-23 00:00:00+00:00 54.081620 2010-12-27 00:00:00+00:00 557.939914 2010-12-28 00:00:00+00:00 250.402088 2010-12-29 00:00:00+00:00 67.565226 2010-12-30 00:00:00+00:00 201.343893 2010-12-31 00:00:00+00:00 74.418483 2011-01-03 00:00:00+00:00 59.103984 2011-01-04 00:00:00+00:00 207.211106 2011-01-05 00:00:00+00:00 94.663112 2011-01-06 00:00:00+00:00 69.966829 2011-01-07 00:00:00+00:00 60.251294 2011-01-10 00:00:00+00:00 40.902112 2011-01-11 00:00:00+00:00 22.677512 2011-01-12 00:00:00+00:00 102.322189 ... 2016-10-20 00:00:00+00:00 0.105048 2016-10-21 00:00:00+00:00 0.134921 2016-10-24 00:00:00+00:00 0.187283 2016-10-25 00:00:00+00:00 0.125960 2016-10-26 00:00:00+00:00 0.104165 2016-10-27 00:00:00+00:00 0.107933 2016-10-28 00:00:00+00:00 0.060382 2016-10-31 00:00:00+00:00 0.127659 2016-11-01 00:00:00+00:00 0.066860 2016-11-02 00:00:00+00:00 0.083547 2016-11-03 00:00:00+00:00 0.091488 2016-11-04 00:00:00+00:00 0.090225 2016-11-07 00:00:00+00:00 0.080173 2016-11-08 00:00:00+00:00 0.071261 2016-11-09 00:00:00+00:00 0.041323 2016-11-10 00:00:00+00:00 0.039352 2016-11-11 00:00:00+00:00 0.089592 2016-11-14 00:00:00+00:00 0.098444 2016-11-15 00:00:00+00:00 0.113898 2016-11-16 00:00:00+00:00 0.121899 2016-11-17 00:00:00+00:00 0.144423 2016-11-18 00:00:00+00:00 0.121290 2016-11-21 00:00:00+00:00 0.147709 2016-11-22 00:00:00+00:00 0.130433 2016-11-23 00:00:00+00:00 0.144159 2016-11-25 00:00:00+00:00 0.363156 2016-11-28 00:00:00+00:00 0.138360 2016-11-29 00:00:00+00:00 0.171660 2016-11-30 00:00:00+00:00 0.115805 2016-12-01 00:00:00+00:00 0.078498 Freq: C, Name: mean_minute_dollar_vol, dtype: float64 In [12]: minutes_to_trade.plot(ylim=(0, 5))  Out[12]: <matplotlib.axes._subplots.AxesSubplot at 0x7fe167dcc810> Looks like much of the time during 2011 and 2012 it would take more than 1 bar to fill a$5000 dollar order of XIV. This would be a market order. Add a limit price constraint and this value could be much higher.

In [ ]: