mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-25 13:10:33 +08:00
224 KiB
224 KiB
In [1]:
# Register the catalyst magic
%load_ext catalystIn [2]:
# Setup matplotlib to display graphs inline in this Notebook
%matplotlib inlineIn [5]:
%%catalyst --start 2015-3-1 --end 2017-6-28 --capital-base 100000 -x bitfinex -c usd
from catalyst.finance.slippage import VolumeShareSlippage
from catalyst.api import (
order_target_value,
symbol,
record,
cancel_order,
get_open_orders,
)
def initialize(context):
context.ASSET_NAME = 'btc_usd'
context.TARGET_HODL_RATIO = 0.8
context.RESERVE_RATIO = 1.0 - context.TARGET_HODL_RATIO
# For all trading pairs in the poloniex bundle, the default denomination
# currently supported by Catalyst is 1/1000th of a full coin. Use this
# constant to scale the price of up to that of a full coin if desired.
context.TICK_SIZE = 1000.0
context.is_buying = True
context.asset = symbol(context.ASSET_NAME)
context.i = 0
def handle_data(context, data):
context.i += 1
starting_cash = context.portfolio.starting_cash
target_hodl_value = context.TARGET_HODL_RATIO * starting_cash
reserve_value = context.RESERVE_RATIO * starting_cash
# Cancel any outstanding orders
orders = get_open_orders(context.asset) or []
for order in orders:
cancel_order(order)
# Stop buying after passing the reserve threshold
cash = context.portfolio.cash
if cash <= reserve_value:
context.is_buying = False
# Retrieve current asset price from pricing data
price = data.current(context.asset,'price')
# Check if still buying and could (approximately) afford another purchase
if context.is_buying and cash > price:
# Place order to make position in asset equal to target_hodl_value
order_target_value(
context.asset,
target_hodl_value,
limit_price=price*1.1,
)
record(
price=price,
volume=data.current(context.asset,'volume'),
cash=cash,
starting_cash=context.portfolio.starting_cash,
leverage=context.account.leverage,
)
def analyze(context=None, results=None):
import matplotlib.pyplot as plt
# Plot the portfolio and asset data.
ax1 = plt.subplot(611)
results[['portfolio_value']].plot(ax=ax1)
ax1.set_ylabel('Portfolio Value (USD)')
ax2 = plt.subplot(612, sharex=ax1)
ax2.set_ylabel('{asset} (USD)'.format(asset=context.ASSET_NAME))
(context.TICK_SIZE * results[['price']]).plot(ax=ax2)
trans = results.ix[[t != [] for t in results.transactions]]
buys = trans.ix[
[t[0]['amount'] > 0 for t in trans.transactions]
]
ax2.plot(
buys.index,
context.TICK_SIZE * results.price[buys.index],
'^',
markersize=10,
color='g',
)
ax3 = plt.subplot(613, sharex=ax1)
results[['leverage', 'alpha', 'beta']].plot(ax=ax3)
ax3.set_ylabel('Leverage ')
ax4 = plt.subplot(614, sharex=ax1)
results[['starting_cash', 'cash']].plot(ax=ax4)
ax4.set_ylabel('Cash (USD)')
results[[
'treasury',
'algorithm',
'benchmark',
]] = results[[
'treasury_period_return',
'algorithm_period_return',
'benchmark_period_return',
]]
ax5 = plt.subplot(615, sharex=ax1)
results[[
'treasury',
'algorithm',
'benchmark',
]].plot(ax=ax5)
ax5.set_ylabel('Percent Change')
ax6 = plt.subplot(616, sharex=ax1)
results[['volume']].plot(ax=ax6)
ax6.set_ylabel('Volume (mCoins/5min)')
plt.legend(loc=3)
# Show the plot.
plt.gcf().set_size_inches(18, 8)
plt.show()Out [5]:
[2017-12-12 23:24:22.056836] INFO: run_algo: running algo in backtest mode [2017-12-12 23:24:22.138743] INFO: exchange_bundle: pricing data for [u'btc_usdt'] not found in range 2015-03-01 00:00:00+00:00 to 2017-06-27 00:00:00+00:00, updating the bundles.
Ingesting daily price data for btc_usdt on poloniex
[2017-12-12 23:24:23.713668] INFO: exchange_algorithm: initialized trading algorithm in backtest mode [2017-12-12 23:24:27.865042] INFO: Performance: Simulated 851 trading days out of 851. [2017-12-12 23:24:27.865826] INFO: Performance: first open: 2015-03-01 00:00:00+00:00 [2017-12-12 23:24:27.866537] INFO: Performance: last close: 2017-06-28 23:59:00+00:00
| algo_volatility | algorithm_period_return | alpha | benchmark_period_return | benchmark_volatility | beta | capital_used | cash | ending_cash | ending_exposure | ... | starting_cash | starting_exposure | starting_value | trading_days | transactions | treasury_period_return | volume | treasury | algorithm | benchmark | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2015-03-01 23:59:00+00:00 | NaN | 0.000000 | NaN | 0.000000 | NaN | NaN | 0.00000 | 100000.00000 | 100000.00000 | 0.000000 | ... | 100000.0 | 0.000000 | 0.000000 | 1 | [] | 0.0200 | 47597.424668 | 0.0200 | 0.000000 | 0.000000 |
| 2015-03-02 23:59:00+00:00 | 0.024686 | -0.002199 | 0.000000 | 0.071713 | 0.804978 | -0.030667 | -84796.13883 | 15203.86117 | 15203.86117 | 84576.219515 | ... | 100000.0 | 0.000000 | 0.000000 | 2 | [{u'commission': None, u'amount': 304.87804879... | 0.0208 | 67168.440498 | 0.0208 | -0.002199 | 0.071713 |
| 2015-03-03 23:59:00+00:00 | 0.188434 | 0.017130 | 2.396606 | 0.064622 | 0.689588 | -0.174486 | 0.00000 | 15203.86117 | 15203.86117 | 86509.146345 | ... | 100000.0 | 84576.219515 | 84576.219515 | 3 | [] | 0.0212 | 81226.398297 | 0.0212 | 0.017130 | 0.064622 |
| 2015-03-04 23:59:00+00:00 | 0.331241 | -0.014638 | 1.409251 | 0.115538 | 0.600022 | -0.322610 | 0.00000 | 15203.86117 | 15203.86117 | 83332.317076 | ... | 100000.0 | 86509.146345 | 86509.146345 | 4 | [] | 0.0212 | 71521.587766 | 0.0212 | -0.014638 | 0.115538 |
| 2015-03-05 23:59:00+00:00 | 0.311232 | -0.001346 | 0.290119 | 0.023905 | 0.940214 | -0.205552 | 0.00000 | 15203.86117 | 15203.86117 | 84661.585369 | ... | 100000.0 | 83332.317076 | 83332.317076 | 5 | [] | 0.0211 | 66108.884634 | 0.0211 | -0.001346 | 0.023905 |
| 2015-03-06 23:59:00+00:00 | 0.291041 | -0.014547 | -0.205680 | 0.035857 | 0.841712 | -0.209467 | 0.00000 | 15203.86117 | 15203.86117 | 83341.463418 | ... | 100000.0 | 84661.585369 | 84661.585369 | 6 | [] | 0.0224 | 40276.571970 | 0.0224 | -0.014547 | 0.035857 |
| 2015-03-07 23:59:00+00:00 | 0.277698 | -0.003541 | 0.233649 | 0.035857 | 0.769546 | -0.214621 | 0.00000 | 15203.86117 | 15203.86117 | 84442.073174 | ... | 100000.0 | 83341.463418 | 83341.463418 | 7 | [] | 0.0224 | 22856.945604 | 0.0224 | -0.003541 | 0.035857 |
| 2015-03-08 23:59:00+00:00 | 0.258004 | -0.007748 | 0.068857 | 0.035857 | 0.713274 | -0.212688 | 0.00000 | 15203.86117 | 15203.86117 | 84021.341464 | ... | 100000.0 | 84442.073174 | 84442.073174 | 8 | [] | 0.0224 | 13853.794890 | 0.0224 | -0.007748 | 0.035857 |
| 2015-03-09 23:59:00+00:00 | 0.351151 | 0.039234 | 1.427229 | 0.051793 | 0.669335 | -0.180976 | 0.00000 | 15203.86117 | 15203.86117 | 88719.512199 | ... | 100000.0 | 84021.341464 | 84021.341464 | 9 | [] | 0.0220 | 62908.377680 | 0.0220 | 0.039234 | 0.051793 |
| 2015-03-10 23:59:00+00:00 | 0.331070 | 0.044173 | 1.598363 | 0.159363 | 0.793556 | -0.113480 | 0.00000 | 15203.86117 | 15203.86117 | 89213.414638 | ... | 100000.0 | 88719.512199 | 88719.512199 | 10 | [] | 0.0214 | 67389.782195 | 0.0214 | 0.044173 | 0.159363 |
| 2015-03-11 23:59:00+00:00 | 0.315912 | 0.056307 | 1.581998 | 0.099602 | 0.819338 | -0.112162 | 0.00000 | 15203.86117 | 15203.86117 | 90426.829272 | ... | 100000.0 | 89213.414638 | 89213.414638 | 11 | [] | 0.0211 | 25811.471790 | 0.0211 | 0.056307 | 0.099602 |
| 2015-03-12 23:59:00+00:00 | 0.303546 | 0.053106 | 1.379340 | 0.099602 | 0.782516 | -0.109012 | 0.00000 | 15203.86117 | 15203.86117 | 90106.707321 | ... | 100000.0 | 90426.829272 | 90426.829272 | 12 | [] | 0.0210 | 27275.117559 | 0.0210 | 0.053106 | 0.099602 |
| 2015-03-13 23:59:00+00:00 | 0.340503 | 0.015392 | 0.536384 | 0.096056 | 0.751148 | -0.091457 | 0.00000 | 15203.86117 | 15203.86117 | 86335.365857 | ... | 100000.0 | 90106.707321 | 90106.707321 | 13 | [] | 0.0213 | 46670.674822 | 0.0213 | 0.015392 | 0.096056 |
| 2015-03-14 23:59:00+00:00 | 0.327414 | 0.013624 | 0.464604 | 0.096016 | 0.722505 | -0.090370 | 0.00000 | 15203.86117 | 15203.86117 | 86158.536589 | ... | 100000.0 | 86335.365857 | 86335.365857 | 14 | [] | 0.0213 | 23011.197461 | 0.0213 | 0.013624 | 0.096016 |
| 2015-03-15 23:59:00+00:00 | 0.319171 | 0.026734 | 0.671484 | 0.123936 | 0.700101 | -0.082130 | 0.00000 | 15203.86117 | 15203.86117 | 87469.512195 | ... | 100000.0 | 86158.536589 | 86158.536589 | 15 | [] | 0.0213 | 13427.567949 | 0.0213 | 0.026734 | 0.123936 |
| 2015-03-16 23:59:00+00:00 | 0.311356 | 0.039904 | 0.814079 | 0.095618 | 0.689624 | -0.091220 | 0.00000 | 15203.86117 | 15203.86117 | 88786.585369 | ... | 100000.0 | 87469.512195 | 87469.512195 | 16 | [] | 0.0210 | 22313.424619 | 0.0210 | 0.039904 | 0.095618 |
| 2015-03-17 23:59:00+00:00 | 0.311274 | 0.021703 | 0.499630 | 0.095618 | 0.668209 | -0.086678 | 0.00000 | 15203.86117 | 15203.86117 | 86966.463418 | ... | 100000.0 | 88786.585369 | 88786.585369 | 17 | [] | 0.0206 | 22235.369855 | 0.0206 | 0.021703 | 0.095618 |
| 2015-03-18 23:59:00+00:00 | 0.438883 | -0.063785 | -0.875710 | 0.044183 | 0.678082 | 0.058541 | 0.00000 | 15203.86117 | 15203.86117 | 78417.682927 | ... | 100000.0 | 86966.463418 | 86966.463418 | 18 | [] | 0.0193 | 89923.415728 | 0.0193 | -0.063785 | 0.044183 |
| 2015-03-19 23:59:00+00:00 | 0.431989 | -0.049242 | -0.635496 | 0.055165 | 0.659508 | 0.062612 | 0.00000 | 15203.86117 | 15203.86117 | 79871.951223 | ... | 100000.0 | 78417.682927 | 78417.682927 | 19 | [] | 0.0198 | 78451.537176 | 0.0198 | -0.049242 | 0.055165 |
| 2015-03-20 23:59:00+00:00 | 0.420599 | -0.048602 | -0.590673 | 0.050043 | 0.642625 | 0.061705 | 0.00000 | 15203.86117 | 15203.86117 | 79935.975613 | ... | 100000.0 | 79871.951223 | 79871.951223 | 20 | [] | 0.0193 | 16197.477968 | 0.0193 | -0.048602 | 0.050043 |
| 2015-03-21 23:59:00+00:00 | 0.410115 | -0.053846 | -0.627981 | 0.048578 | 0.626557 | 0.062140 | 0.00000 | 15203.86117 | 15203.86117 | 79411.585369 | ... | 100000.0 | 79935.975613 | 79935.975613 | 21 | [] | 0.0193 | 15082.649219 | 0.0193 | -0.053846 | 0.048578 |
| 2015-03-22 23:59:00+00:00 | 0.412261 | -0.028388 | -0.313487 | 0.065804 | 0.613145 | 0.073754 | 0.00000 | 15203.86117 | 15203.86117 | 81957.317076 | ... | 100000.0 | 79411.585369 | 79411.585369 | 22 | [] | 0.0193 | 18263.490755 | 0.0193 | -0.028388 | 0.065804 |
| 2015-03-23 23:59:00+00:00 | 0.403002 | -0.033236 | -0.334801 | 0.038540 | 0.606788 | 0.075368 | 0.00000 | 15203.86117 | 15203.86117 | 81472.560979 | ... | 100000.0 | 81957.317076 | 81957.317076 | 23 | [] | 0.0192 | 23532.384930 | 0.0192 | -0.033236 | 0.038540 |
| 2015-03-24 23:59:00+00:00 | 0.448116 | -0.097961 | -0.950042 | -0.033763 | 0.637613 | 0.187571 | 0.00000 | 15203.86117 | 15203.86117 | 75000.000003 | ... | 100000.0 | 81472.560979 | 81472.560979 | 24 | [] | 0.0188 | 64117.869871 | 0.0188 | -0.097961 | -0.033763 |
| 2015-03-25 23:59:00+00:00 | 0.438954 | -0.097077 | -0.940773 | -0.014042 | 0.627763 | 0.188068 | 0.00000 | 15203.86117 | 15203.86117 | 75088.414637 | ... | 100000.0 | 75000.000003 | 75000.000003 | 25 | [] | 0.0193 | 53254.531782 | 0.0193 | -0.097077 | -0.014042 |
| 2015-03-26 23:59:00+00:00 | 0.432277 | -0.087809 | -0.770002 | -0.033763 | 0.618281 | 0.178979 | 0.00000 | 15203.86117 | 15203.86117 | 76015.243905 | ... | 100000.0 | 75088.414637 | 75088.414637 | 26 | [] | 0.0201 | 33260.968413 | 0.0201 | -0.087809 | -0.033763 |
| 2015-03-27 23:59:00+00:00 | 0.424318 | -0.096437 | -0.900059 | 0.009373 | 0.621827 | 0.163263 | 0.00000 | 15203.86117 | 15203.86117 | 75152.439027 | ... | 100000.0 | 76015.243905 | 76015.243905 | 27 | [] | 0.0195 | 22731.111936 | 0.0195 | -0.096437 | 0.009373 |
| 2015-03-28 23:59:00+00:00 | 0.423172 | -0.076772 | -0.643934 | -0.009050 | 0.612953 | 0.150150 | 0.00000 | 15203.86117 | 15203.86117 | 77118.902442 | ... | 100000.0 | 75152.439027 | 75152.439027 | 28 | [] | 0.0195 | 17724.687732 | 0.0195 | -0.076772 | -0.009050 |
| 2015-03-29 23:59:00+00:00 | 0.425615 | -0.107900 | -0.910906 | -0.012074 | 0.601994 | 0.152684 | 0.00000 | 15203.86117 | 15203.86117 | 74006.097564 | ... | 100000.0 | 77118.902442 | 77118.902442 | 29 | [] | 0.0195 | 31825.768349 | 0.0195 | -0.107900 | -0.012074 |
| 2015-03-30 23:59:00+00:00 | 0.422749 | -0.092077 | -0.767531 | 0.013358 | 0.596112 | 0.163173 | 0.00000 | 15203.86117 | 15203.86117 | 75588.414637 | ... | 100000.0 | 74006.097564 | 74006.097564 | 30 | [] | 0.0196 | 30725.359920 | 0.0196 | -0.092077 | 0.013358 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2017-05-30 23:59:00+00:00 | 0.427200 | 5.696856 | 0.157089 | 7.525896 | 0.553873 | 0.636433 | 0.00000 | 15203.86117 | 15203.86117 | 654481.707339 | ... | 100000.0 | 672987.804904 | 672987.804904 | 822 | [] | 0.0221 | 21448.633495 | 0.0221 | 5.696856 | 7.525896 |
| 2017-05-31 23:59:00+00:00 | 0.427054 | 5.834356 | 0.157937 | 7.752988 | 0.553688 | 0.636502 | 0.00000 | 15203.86117 | 15203.86117 | 668231.707343 | ... | 100000.0 | 654481.707339 | 654481.707339 | 823 | [] | 0.0221 | 21235.805383 | 0.0221 | 5.834356 | 7.752988 |
| 2017-06-01 23:59:00+00:00 | 0.427722 | 6.200819 | 0.162931 | 8.221495 | 0.554049 | 0.637450 | 0.00000 | 15203.86117 | 15203.86117 | 704878.048807 | ... | 100000.0 | 668231.707343 | 668231.707343 | 824 | [] | 0.0221 | 18959.512934 | 0.0221 | 6.200819 | 8.221495 |
| 2017-06-02 23:59:00+00:00 | 0.427951 | 6.487100 | 0.166601 | 8.593625 | 0.554091 | 0.637943 | 0.00000 | 15203.86117 | 15203.86117 | 733506.097589 | ... | 100000.0 | 704878.048807 | 704878.048807 | 825 | [] | 0.0215 | 12549.643232 | 0.0215 | 6.487100 | 8.593625 |
| 2017-06-03 23:59:00+00:00 | 0.427829 | 6.655087 | 0.169294 | 8.782075 | 0.553828 | 0.638093 | 0.00000 | 15203.86117 | 15203.86117 | 750304.878077 | ... | 100000.0 | 733506.097589 | 733506.097589 | 826 | [] | 0.0215 | 10767.981906 | 0.0215 | 6.655087 | 8.782075 |
| 2017-06-04 23:59:00+00:00 | 0.427593 | 6.738014 | 0.170134 | 8.894622 | 0.553511 | 0.638115 | 0.00000 | 15203.86117 | 15203.86117 | 758597.561001 | ... | 100000.0 | 750304.878077 | 750304.878077 | 827 | [] | 0.0215 | 11880.383420 | 0.0215 | 6.738014 | 8.894622 |
| 2017-06-05 23:59:00+00:00 | 0.428439 | 7.191368 | 0.174943 | 9.499428 | 0.554092 | 0.639197 | 0.00000 | 15203.86117 | 15203.86117 | 803932.926860 | ... | 100000.0 | 758597.561001 | 758597.561001 | 828 | [] | 0.0218 | 15390.903185 | 0.0218 | 7.191368 | 9.499428 |
| 2017-06-06 23:59:00+00:00 | 0.430141 | 7.824600 | 0.180975 | 10.338645 | 0.555360 | 0.641121 | 0.00000 | 15203.86117 | 15203.86117 | 867256.097594 | ... | 100000.0 | 803932.926860 | 803932.926860 | 829 | [] | 0.0214 | 42687.668790 | 0.0214 | 7.824600 | 10.338645 |
| 2017-06-07 23:59:00+00:00 | 0.431723 | 7.213014 | 0.171850 | 9.539858 | 0.556521 | 0.642924 | 0.00000 | 15203.86117 | 15203.86117 | 806097.561006 | ... | 100000.0 | 867256.097594 | 867256.097594 | 830 | [] | 0.0218 | 22094.398527 | 0.0218 | 7.213014 | 9.539858 |
| 2017-06-08 23:59:00+00:00 | 0.432277 | 7.632222 | 0.175931 | 10.107570 | 0.556877 | 0.643699 | 0.00000 | 15203.86117 | 15203.86117 | 848018.292715 | ... | 100000.0 | 806097.561006 | 806097.561006 | 831 | [] | 0.0219 | 16977.816089 | 0.0219 | 7.632222 | 10.107570 |
| 2017-06-09 23:59:00+00:00 | 0.432032 | 7.716063 | 0.176681 | 10.219521 | 0.556554 | 0.643715 | 0.00000 | 15203.86117 | 15203.86117 | 856402.439057 | ... | 100000.0 | 848018.292715 | 848018.292715 | 832 | [] | 0.0221 | 9521.116767 | 0.0221 | 7.716063 | 10.219521 |
| 2017-06-10 23:59:00+00:00 | 0.431778 | 7.706917 | 0.176444 | 10.202471 | 0.556226 | 0.643719 | 0.00000 | 15203.86117 | 15203.86117 | 855487.804911 | ... | 100000.0 | 856402.439057 | 856402.439057 | 833 | [] | 0.0221 | 16167.315725 | 0.0221 | 7.706917 | 10.202471 |
| 2017-06-11 23:59:00+00:00 | 0.432214 | 8.120941 | 0.181278 | 10.701594 | 0.556349 | 0.644447 | 0.00000 | 15203.86117 | 15203.86117 | 896890.243937 | ... | 100000.0 | 855487.804911 | 855487.804911 | 834 | [] | 0.0221 | 19034.136815 | 0.0221 | 8.120941 | 10.701594 |
| 2017-06-12 23:59:00+00:00 | 0.437592 | 6.986185 | 0.162983 | 9.243228 | 0.560459 | 0.649967 | 0.00000 | 15203.86117 | 15203.86117 | 783414.634176 | ... | 100000.0 | 896890.243937 | 896890.243937 | 835 | [] | 0.0221 | 48340.947688 | 0.0221 | 6.986185 | 9.243228 |
| 2017-06-13 23:59:00+00:00 | 0.437831 | 7.313929 | 0.166669 | 9.664441 | 0.560505 | 0.650461 | 0.00000 | 15203.86117 | 15203.86117 | 816189.024421 | ... | 100000.0 | 783414.634176 | 783414.634176 | 836 | [] | 0.0221 | 23172.058884 | 0.0221 | 7.313929 | 9.664441 |
| 2017-06-14 23:59:00+00:00 | 0.441463 | 6.451734 | 0.153438 | 8.509086 | 0.563520 | 0.654055 | 0.00000 | 15203.86117 | 15203.86117 | 729969.512223 | ... | 100000.0 | 816189.024421 | 816189.024421 | 837 | [] | 0.0215 | 34717.773840 | 0.0215 | 6.451734 | 8.509086 |
| 2017-06-15 23:59:00+00:00 | 0.441231 | 6.400514 | 0.152175 | 8.460040 | 0.563202 | 0.654088 | 0.00000 | 15203.86117 | 15203.86117 | 724847.561003 | ... | 100000.0 | 729969.512223 | 729969.512223 | 838 | [] | 0.0216 | 55839.127994 | 0.0216 | 6.400514 | 8.460040 |
| 2017-06-16 23:59:00+00:00 | 0.441132 | 6.583441 | 0.154278 | 8.701195 | 0.562997 | 0.654244 | 0.00000 | 15203.86117 | 15203.86117 | 743140.243931 | ... | 100000.0 | 724847.561003 | 724847.561003 | 839 | [] | 0.0216 | 22402.387929 | 0.0216 | 6.583441 | 8.701195 |
| 2017-06-17 23:59:00+00:00 | 0.442375 | 7.109661 | 0.159795 | 9.387043 | 0.563869 | 0.655675 | 0.00000 | 15203.86117 | 15203.86117 | 795762.195152 | ... | 100000.0 | 743140.243931 | 743140.243931 | 840 | [] | 0.0216 | 16637.617543 | 0.0216 | 7.109661 | 9.387043 |
| 2017-06-18 23:59:00+00:00 | 0.442876 | 6.747770 | 0.154265 | 8.929482 | 0.564133 | 0.656408 | 0.00000 | 15203.86117 | 15203.86117 | 759573.170761 | ... | 100000.0 | 795762.195152 | 795762.195152 | 841 | [] | 0.0216 | 19988.156662 | 0.0216 | 6.747770 | 8.929482 |
| 2017-06-19 23:59:00+00:00 | 0.442976 | 7.023990 | 0.157300 | 9.291024 | 0.564087 | 0.656754 | 0.00000 | 15203.86117 | 15203.86117 | 787195.121981 | ... | 100000.0 | 759573.170761 | 759573.170761 | 842 | [] | 0.0219 | 13719.302504 | 0.0219 | 7.023990 | 9.291024 |
| 2017-06-20 23:59:00+00:00 | 0.443473 | 7.427953 | 0.165028 | 9.629482 | 0.563982 | 0.657532 | 0.00000 | 15203.86117 | 15203.86117 | 827591.463446 | ... | 100000.0 | 787195.121981 | 787195.121981 | 843 | [] | 0.0216 | 20548.879169 | 0.0216 | 7.427953 | 9.629482 |
| 2017-06-21 23:59:00+00:00 | 0.443635 | 7.153258 | 0.158260 | 9.438247 | 0.563769 | 0.657964 | 0.00000 | 15203.86117 | 15203.86117 | 800121.951250 | ... | 100000.0 | 827591.463446 | 827591.463446 | 844 | [] | 0.0216 | 24534.642260 | 0.0216 | 7.153258 | 9.438247 |
| 2017-06-22 23:59:00+00:00 | 0.443450 | 7.300819 | 0.159417 | 9.650902 | 0.563511 | 0.658029 | 0.00000 | 15203.86117 | 15203.86117 | 814878.048812 | ... | 100000.0 | 800121.951250 | 800121.951250 | 845 | [] | 0.0215 | 15181.549108 | 0.0215 | 7.300819 | 9.650902 |
| 2017-06-23 23:59:00+00:00 | 0.443189 | 7.307222 | 0.159709 | 9.637450 | 0.563183 | 0.658024 | 0.00000 | 15203.86117 | 15203.86117 | 815518.292714 | ... | 100000.0 | 814878.048812 | 814878.048812 | 846 | [] | 0.0215 | 8139.412746 | 0.0215 | 7.307222 | 9.637450 |
| 2017-06-24 23:59:00+00:00 | 0.444394 | 6.781917 | 0.151725 | 8.974032 | 0.563994 | 0.659430 | 0.00000 | 15203.86117 | 15203.86117 | 762987.804907 | ... | 100000.0 | 815518.292714 | 815518.292714 | 847 | [] | 0.0215 | 16770.845452 | 0.0215 | 6.781917 | 8.974032 |
| 2017-06-25 23:59:00+00:00 | 0.444167 | 6.723075 | 0.150972 | 8.887696 | 0.563699 | 0.659457 | 0.00000 | 15203.86117 | 15203.86117 | 757103.658565 | ... | 100000.0 | 762987.804907 | 762987.804907 | 848 | [] | 0.0215 | 18137.882004 | 0.0215 | 6.723075 | 8.887696 |
| 2017-06-26 23:59:00+00:00 | 0.444393 | 6.449600 | 0.146720 | 8.542984 | 0.563751 | 0.659922 | 0.00000 | 15203.86117 | 15203.86117 | 729756.097589 | ... | 100000.0 | 757103.658565 | 757103.658565 | 849 | [] | 0.0214 | 36367.695758 | 0.0214 | 6.449600 | 8.542984 |
| 2017-06-27 23:59:00+00:00 | 0.444947 | 6.838624 | 0.151955 | 9.000000 | 0.563942 | 0.660755 | 0.00000 | 15203.86117 | 15203.86117 | 768658.536612 | ... | 100000.0 | 729756.097589 | 729756.097589 | 850 | [] | 0.0221 | 33486.182337 | 0.0221 | 6.838624 | 9.000000 |
| 2017-06-28 23:59:00+00:00 | 0.444691 | 6.829478 | 0.151427 | 9.000000 | 0.563613 | 0.660760 | 0.00000 | 15203.86117 | 15203.86117 | 767743.902465 | ... | 100000.0 | 768658.536612 | 768658.536612 | 851 | [] | 0.0221 | 21827.313647 | 0.0221 | 6.829478 | 9.000000 |
851 rows × 45 columns
In [4]:
_.head()Out [4]:
| algo_volatility | algorithm_period_return | alpha | benchmark_period_return | benchmark_volatility | beta | capital_used | cash | ending_cash | ending_exposure | ... | starting_cash | starting_exposure | starting_value | trading_days | transactions | treasury_period_return | volume | treasury | algorithm | benchmark | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2015-03-01 23:59:00+00:00 | NaN | 0.000000 | NaN | 0.045833 | NaN | NaN | 0.000000 | 100000.000000 | 100000.000000 | 0.000 | ... | 100000.0 | 0.000 | 0.000 | 1 | [] | 0.0200 | 317 | 0.0200 | 0.000000 | 0.045833 |
| 2015-03-02 23:59:00+00:00 | 0.000278 | -0.000025 | 0.011045 | 0.120833 | 0.290503 | -0.000956 | -85544.474955 | 14455.525045 | 14455.525045 | 85542.000 | ... | 100000.0 | 0.000 | 0.000 | 2 | [{u'commission': None, u'amount': 318, u'sid':... | 0.0208 | 98063 | 0.0208 | -0.000025 | 0.120833 |
| 2015-03-03 23:59:00+00:00 | 0.051796 | -0.005688 | -1.197544 | 0.113416 | 0.633538 | 0.077239 | 0.000000 | 14455.525045 | 14455.525045 | 84975.642 | ... | 100000.0 | 85542.000 | 85542.000 | 3 | [] | 0.0212 | 442983 | 0.0212 | -0.005688 | 0.113416 |
| 2015-03-04 23:59:00+00:00 | 0.342118 | 0.034955 | 0.401861 | 0.166666 | 0.524400 | 0.181468 | 0.000000 | 14455.525045 | 14455.525045 | 89040.000 | ... | 100000.0 | 84975.642 | 84975.642 | 4 | [] | 0.0212 | 245889 | 0.0212 | 0.034955 | 0.166666 |
| 2015-03-05 23:59:00+00:00 | 0.637226 | -0.038185 | -3.914003 | 0.070834 | 0.976896 | 0.550520 | 0.000000 | 14455.525045 | 14455.525045 | 81726.000 | ... | 100000.0 | 89040.000 | 89040.000 | 5 | [] | 0.0211 | 117440 | 0.0211 | -0.038185 | 0.070834 |
5 rows × 45 columns