How to use the catalyst.api.symbol function in catalyst

To help you get started, we’ve selected a few catalyst examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github produvia / kryptos / kryptos / platform / strategy / strategy.py View on Github external
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")
github enigmampc / catalyst / catalyst / support / issue_126.py View on Github external
def initialize(context):
    context.assets = [symbol('eth_btc'), symbol('eth_usdt')]
github enigmampc / catalyst / catalyst / support / issue_112.py View on Github external
def initialize(context):
    context.asset = symbol('btc_usdt')
github produvia / kryptos / algos / __buy_btc_simple.py View on Github external
def initialize(context):
    context.asset = symbol(CONFIG.ASSETS[0])
github enigmampc / catalyst / catalyst / examples / buybtc.py View on Github external
def initialize(context):
    context.asset = symbol('USDT_BTC')
github produvia / kryptos / algos / __mr_bitcoin.py View on Github external
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())
github enigmampc / catalyst / catalyst / support / issue_111.py View on Github external
def initialize(context):
    context.asset = symbol('trx_btc')
github enigmampc / catalyst / catalyst / examples / simple_loop.py View on Github external
def initialize(context):
    log.info('initializing')
    context.asset = symbol('eth_btc')
    context.base_price = None
github enigmampc / catalyst / catalyst / examples / marketplace / mean_reversion_by_marketcap.py View on Github external
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()
github enigmampc / catalyst / catalyst / examples / dual_ema_talib.py View on Github external
def initialize(context):
    context.asset = symbol('AAPL')

    # To keep track of whether we invested in the stock or not
    context.invested = False