Open tibkiss opened 6 years ago
so these tests?
set_long_only() -> try to order a short: should fail set_do_not_order_list([asset1, asset 2]) -> try order asset1 or asset 2: should fail set_max_order_count(2): -> try order 1 time: success, 2 time success, 3 times fail set_max_order_count(0): -> any order should fail set_max_order_count(-1): -> any order should fail set_max_order_size( max_shares=10) -> any order with more then 10 shares should fail set_max_order_size( max_notional=1000.00) -> any order with more then 1000 $ should fail set_max_order_size(asset1, max_shares=1) -> 2 shares of asset1 will fail set_max_order_size(asset1, max_notional=1000.00) -> 1001.00 of value of asset1 will fail
first buy 10 shares for 1000 and then: set_max_position_size( max_shares=11) -> any order with more then 1 shares should fail, 1 share should succeed set_max_position_size( max_notional=1100.00) -> any order with more then 100 $ should fail, 99$ should succeed set_max_position_size(asset1, max_shares=11) -> 2 shares of asset1 will fail, 1 will succeed set_max_position_size(asset1, max_notional=1100.00) -> 101.00 of value of asset1 will fail, 100 will succeed
Do set_max_order_size, set_max_position_size, set_max_order_size need a short version?
I think the proposed tests are all valid. Short version would also make sense.
Contrary to what zipline-live's feature page states order/trading guards are supported, but not tested:
LiveTradingAlgorithm.order()
callsTradingAlgorithm._calculate_order()
, which calls toTradingAlgorithm.validate_order_params()
which finally enforces that the order meets the guards set by the user.This effort is to prove that Trading Guards are working: Create a testcase which tests that sets trading guards are called if they are set and used through
LiveTradingAlgorithm
.