Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trading guard testcases #49

Open
tibkiss opened this issue Aug 24, 2017 · 3 comments
Open

Trading guard testcases #49

tibkiss opened this issue Aug 24, 2017 · 3 comments

Comments

@tibkiss
Copy link

tibkiss commented Aug 24, 2017

Contrary to what zipline-live's feature page states
order/trading guards are supported, but not tested:
LiveTradingAlgorithm.order() calls TradingAlgorithm._calculate_order(), which calls to TradingAlgorithm.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.

@peterfabakker
Copy link

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

@peterfabakker
Copy link

Do set_max_order_size, set_max_position_size, set_max_order_size need a short version?

@tibkiss
Copy link
Author

tibkiss commented Nov 11, 2017

I think the proposed tests are all valid. Short version would also make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants