Created
March 31, 2016 12:18
-
-
Save twiecki/f3494d4acf44bca79a31e62b5bd81807 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def initialize(context): | |
| fetch_csv('URL', | |
| date_format='%d/%m/%y', | |
| universe_func=my_universe) | |
| def my_universe(context, fetcher_data): | |
| my_stocks = set(fetcher_data['sid']) | |
| # log the size of the universe for debugging | |
| context.count = len(my_stocks) | |
| print 'total universe size: {c}'.format(c=context.count) | |
| return my_stocks | |
| def handle_data(context, data): | |
| for stock in data: | |
| order_target_percent(stock, data[stock]['weight']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment