Ejemplo n.º 1
0
def initialize(context):
    context.asset = symbol('AAPL')

    # Explicitly set the commission to the "old" value until we can
    # rebuild example data.
    # github.com/quantopian/gateway/blob/master/tests/resources/
    # rebuild_example_data#L105
    context.set_commission(commission.PerShare(cost=.0075, min_trade_cost=1.0))
Ejemplo n.º 2
0
def initialize(context):
    context.stocks = stocks
    context.symbols = [symbol(s) for s in stocks]
    context.sn = 0

    log.info("totoal symbols/stocks {}".format(context.symbols))
    log.info("list of symbols/stockes : {}".format(context.symbols)) \

    log.info("context.data exists : %r" % hasattr(context, "data"))
    log.info("context.watchlists exists : %r" % hasattr(context, "watchlists"))

    log.info("create data object and watchlist objecrt within context")
    context.data = create_data(context.symbols)
    context.watchlists = create_watchlists(context.symbols)

    log.info("done")
    pass
Ejemplo n.º 3
0
def initialize(context):
    context.symbols = [symbol(s) for s in stocks]
    context.sn = 0
    pass
Ejemplo n.º 4
0
def handle_data(context, data):
    if not context.has_ordered:
        for stock in context.stocks:
            order(symbol(stock), 100)
        context.has_ordered = True