def test_optimize_empty_signals(self): manager = linear.Constant({}) alloc, e_ret, e_risk = manager.optimize({}, {}) self._check_optimize_return(alloc, e_ret, e_risk) eq_(alloc, {}) eq_(e_ret, 0) eq_(e_risk, 1)
def test_optimize_buy_signals_init_custom_amount(self): manager = linear.Constant({'buy_amount': 200}) alloc, e_ret, e_risk = manager.optimize(to_buy=self.buy_signal, to_sell={}) self._check_optimize_return(alloc, e_ret, e_risk) eq_(alloc, {'goog': 200})
def test_optimize_buy_signals(self): manager = linear.Constant({}) alloc, e_ret, e_risk = manager.optimize(to_buy=self.buy_signal, to_sell={}) self._check_optimize_return(alloc, e_ret, e_risk) eq_(alloc, {'goog': self.default_amount})
def test_initialize(self): self._check_initialization(linear.Constant({}))