betcode-org / flumine

flūmine - Betting trading framework
MIT License
177 stars 60 forks source link

multi_order_trades does not do what it says on the tin #683

Open mzaja opened 1 year ago

mzaja commented 1 year ago

This section also does not make sense to me. If self.multi_order_trades==True and the trade is already live, the rest of the validations is skipped. https://github.com/betcode-org/flumine/blob/796ec51060328edac7e14678c6defd63a964d250/flumine/strategy/strategy.py#L166-L170

Should this code not check if len(trade.orders) >= 1 and reject placement if self.multi_order_trades==False? Allowing multiple orders per trade is very different from allowing multiple trades per runner, so the validation should proceed with the other checks. If a trade does not have at least two orders (opening and closing), I would not even call it a trade but a straight bet.

Originally posted by @mzaja in https://github.com/betcode-org/flumine/issues/679#issuecomment-1676131870

mzaja commented 1 year ago

Current behaviour

Expected behaviour

Proposal

Since the current implementation of multi_order_trades argument does not do much on its own and certainly does not do what the name suggest, I propose replacing it with per-trade order limits: max_order_count and max_live_order_count. These would behave on the trade level the same as max_trade_count and max_live_trade_count behave on the strategy level. To maintain backwards compatibility, they should be None by default and optionally set by the user.