Skip to content

Instantly share code, notes, and snippets.

@lamres
Created September 3, 2019 17:53
Show Gist options
  • Save lamres/0a5a320d834cd30bec5d0aa91822d569 to your computer and use it in GitHub Desktop.
Save lamres/0a5a320d834cd30bec5d0aa91822d569 to your computer and use it in GitHub Desktop.
def initialize(context):
context.asset = symbol('btc_usd')
context.leverage = 1.0
context.std_period = 10
context.ma_period = 10
context.price_deviation_period = 10
context.volume_deviation_period = 10
context.n_periods = 5 + int(np.max([context.std_period, context.ma_period,
context.price_deviation_period, context.volume_deviation_period]))
context.tf = '1440T'
context.model = joblib.load('quandl_BITFINEX_BTCUSD_final_model.pkl')
context.cols_features = ['last_return', 'std_normalized', 'ma_ratio', 'price_deviation', 'volume_deviation']
context.long_states = [2]
context.random_states = [1]
context.short_states = [0]
context.set_commission(maker = 0.001, taker = 0.002)
context.set_slippage(slippage = 0.0005)
context.set_benchmark(context.asset)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment