<s> import pandas as pd <EOL> from zipline import TradingAlgorithm <EOL> from zipline . api import order , symbol <EOL> from zipline . data . loader import load_bars_from_yahoo <EOL> stocks = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> def initialize ( context ) : <EOL> context . has_ordered = False <EOL> context . stocks = stocks <EOL> def handle_data ( context , data ) : <EOL> if not context . has_ordered : <EOL> for stock in context . stocks : <EOL> order ( symbol ( stock ) , <NUM_LIT:100> ) <EOL> context . has_ordered = True <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> start = pd . Timestamp ( '<STR_LIT>' , tz = '<STR_LIT>' ) <EOL> end = pd . Timestamp ( '<STR_LIT>' , tz = '<STR_LIT>' ) <EOL> input_data = load_bars_from_yahoo ( <EOL> stocks = stocks , <EOL> start = start , <EOL> end = end , <EOL> ) <EOL> algo = TradingAlgorithm ( initialize = initialize , handle_data = handle_data ) <EOL> results = algo . run ( input_data ) </s>
