betcode-org/flumine

Fill or kill simulation incorrect when min_fill_size is None

Closed this issue · 1 comments

mzaja commented

When placing simulated fill or kill orders without specifying min_fill_size parameter, min_fill_size should be effectively zero, meaning the order should get matched for as much money is available while the unmatched portion is cancelled. Currently the whole order is cancelled if there is not enough money to match the whole order, which is incorrect behaviour.

I traced the issue to this line:

min_fill_size = instruction["limitOrder"].get("minFillSize", size)

The line should be changed to:

 min_fill_size = instruction["limitOrder"].get("minFillSize", 0)
mzaja commented

Pull request created: #651