Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _init_func(self, context):
"""Sets up catalyst's context object and fetches external data"""
context.asset = symbol(self.trading_info["ASSET"])
if not self.is_live:
set_benchmark(context.asset)
context.i = 0
context.errors = []
for k, v in self.trading_info.items():
if "__" not in k:
setattr(context, k, v)
for dataset, manager in self._datasets.items():
manager.fetch_data()
self._extra_init(context)
self.log.info("Initilized Strategy")
def initialize(context):
context.assets = [symbol('eth_btc'), symbol('eth_usdt')]
def initialize(context):
context.asset = symbol('btc_usdt')
def initialize(context):
context.asset = symbol(CONFIG.ASSETS[0])
def initialize(context):
context.asset = symbol('USDT_BTC')
def initialize(context):
context.ASSET_NAME = CONFIG.ASSETS[0]
context.WINDOW = 30
# 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.i = 0
context.asset = symbol(context.ASSET_NAME)
attach_pipeline(make_pipeline(context), "mr_pipeline")
schedule_function(handle_data, date_rules.every_day())
def initialize(context):
context.asset = symbol('trx_btc')
def initialize(context):
log.info('initializing')
context.asset = symbol('eth_btc')
context.base_price = None
df.sort_values(by=['market_cap_usd'], ascending=True, inplace=True)
print('the marketplace data:\n{}'.format(df))
# Pick the 5 assets with the lowest market cap for trading
quote_currency = 'eth'
exchange = context.exchanges[next(iter(context.exchanges))]
symbols = [a.symbol for a in exchange.assets
if a.start_date < context.datetime]
context.assets = []
for currency, price in df['market_cap_usd'].iteritems():
if len(context.assets) >= 5:
break
s = '{}_{}'.format(currency.decode('utf-8'), quote_currency)
if s in symbols:
context.assets.append(symbol(s))
context.base_price = None
context.current_day = None
context.RSI_OVERSOLD = 55
context.RSI_OVERBOUGHT = 60
context.CANDLE_SIZE = '5T'
context.start_time = time.time()
def initialize(context):
context.asset = symbol('AAPL')
# To keep track of whether we invested in the stock or not
context.invested = False