示例#1
0
 def execute(self):
     options = Command._parse_flags(['tickers', 'start_date', 'end_date',
                                     'strategy'])
     market = load_market(options['start_date'], options['end_date'],
                          options['tickers'])
     portfolio = Portfolio()
     simulation = Simulation(portfolio, market)
     trades = get_trades(options)
     simulation.run(trades)
     print(simulation)
示例#2
0
 def execute(self):
     options = Command._parse_flags(
         ['tickers', 'start_date', 'end_date', 'strategy'])
     market = load_market(options['start_date'], options['end_date'],
                          options['tickers'])
     portfolio = Portfolio()
     simulation = Simulation(portfolio, market)
     trades = get_trades(options)
     simulation.run(trades)
     print(simulation)
示例#3
0
 def execute(self):
     options = Command._parse_flags(['tickers', 'start_date', 'end_date',
                                     'model_dir'])
     market = load_market(options['start_date'], options['end_date'],
                          options['tickers'])
     if len(market.stocks) != 1:
         raise Exception('expected 1 stock, found %d' % len(market.stocks))
     stock = next(iter(market.stocks.values()))
     examples = stock.features_all()
     print('DEBUG: examples', examples)
     estimator = LinearRegressionEstimator(options['model_dir'])
     estimator.train(examples, 1000)
     print('trained model written to', options['model_dir'])
示例#4
0
 def execute(self):
     options = Command._parse_flags(
         ['tickers', 'start_date', 'end_date', 'model_dir'])
     market = load_market(options['start_date'], options['end_date'],
                          options['tickers'])
     if len(market.stocks) != 1:
         raise Exception('expected 1 stock, found %d' % len(market.stocks))
     stock = next(iter(market.stocks.values()))
     examples = stock.features_all()
     print('DEBUG: examples', examples)
     estimator = LinearRegressionEstimator(options['model_dir'])
     estimator.train(examples, 1000)
     print('trained model written to', options['model_dir'])
示例#5
0
 def execute(self):
     options = Command._parse_flags(['tickers', 'start_date', 'end_date'])
     market = load_market(options['start_date'], options['end_date'],
                          options['tickers'])
     for stock in market.stocks.values():
         print(stock)
示例#6
0
 def execute(self):
     options = Command._parse_flags(['tickers', 'start_date', 'end_date'])
     market = load_market(options['start_date'], options['end_date'],
                          options['tickers'])
     for stock in market.stocks.values():
         print(stock)