What would the backtest look like if our predictions were perfect?
import pandas as pd
import numpy as np
from dfply import *
import simple_back_test
def perfect_model_data():
model_data = pd.read_feather( '../../data/backtesting/first_seen_dummy.feather')
model_data = (model_data >>
rename( spyid = 'index', streams = 'actual_streams') >>
mutate( streams = exp(X.streams), predicted_streams = exp(X.predicted_streams)))
model_data = model_data >> mutate(predicted_streams = X.streams)
return model_data
simple_back_test.get_model_data = perfect_model_data
logging.basicConfig(format='%(message)s', level=logging.WARNING)
ps, ps_summary = run_backtest(
payment_per_stream = 0.005
,
artist_advance_fraction = 0.8
,
pop_5_slippage = 0.15
, # Applied on both enter and exit
execution_slippage = 0.1
, # Applied only on the exit, ie how long does it take to sign up the artist
clip_individual_returns = 3
,
min_price = 5e3
,
max_price = 50e3
,
duration_days = 365
,
new_streams_per_date = 3/7
,
capital = 250e3
)
ps_summary.transpose()