def initialize(context):
            pipeline = Pipeline()
            context.vwaps = []
            for length in vwaps:
                name = vwap_key(length)
                factor = VWAP(window_length=length)
                context.vwaps.append(factor)
                pipeline.add(factor, name=name)

            filter_ = (USEquityPricing.close.latest > 300)
            pipeline.add(filter_, 'filter')
            if set_screen:
                pipeline.set_screen(filter_)

            attach_pipeline(pipeline, 'test')
        def initialize(context):
            pipeline = attach_pipeline(Pipeline(), 'test')

            vwap = VWAP(window_length=10)
            pipeline.add(vwap, 'vwap')

            # Nothing should have prices less than 0.
            pipeline.set_screen(vwap < 0)
Beispiel #3
0
def initialize(context):
    context.ASSET_NAME = 'USDT_BTC'
    context.TARGET_INVESTMENT_RATIO = 0.8
    context.SHORT_WINDOW = 30
    context.LONG_WINDOW = 100

    # 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)

    set_max_leverage(1.0)

    attach_pipeline(make_pipeline(context), 'vwap_pipeline')

    schedule_function(
        rebalance,
        time_rules=times_rules.every_minute(),
    )
 def initialize(context):
     p = attach_pipeline(Pipeline(), 'test', chunks=chunks)
     p.add(USEquityPricing.close.latest, 'close')
 def initialize(context):
     attach_pipeline(Pipeline(), 'test')
 def initialize(context):
     attach_pipeline(Pipeline(), 'test')
     pipeline_output('test')
     raise AssertionError("Shouldn't make it past pipeline_output()")
 def late_attach(context, data):
     attach_pipeline(Pipeline(), 'test')
     raise AssertionError("Shouldn't make it past attach_pipeline!")
 def initialize(context):
     p = attach_pipeline(Pipeline(), 'test', chunks=chunks)
     p.add(USEquityPricing.close.latest, 'close')
 def initialize(context):
     attach_pipeline(Pipeline(), 'test')
 def initialize(context):
     attach_pipeline(Pipeline(), 'test')
     pipeline_output('test')
     raise AssertionError("Shouldn't make it past pipeline_output()")
 def late_attach(context, data):
     attach_pipeline(Pipeline(), 'test')
     raise AssertionError("Shouldn't make it past attach_pipeline!")