mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-14 11:15:09 +08:00
Uses min function in place of taking the minimum with an if statement.
This commit is contained in:
@@ -94,9 +94,8 @@ class VolumeShareSlippage(object):
|
||||
|
||||
desired_order = total_order + open_amount
|
||||
|
||||
volume_share = direction * (desired_order) / event.volume
|
||||
if volume_share > self.volume_limit:
|
||||
volume_share = self.volume_limit
|
||||
volume_share = min(direction * (desired_order) / event.volume,
|
||||
self.volume_limit)
|
||||
simulated_amount = int(volume_share * event.volume * direction)
|
||||
simulated_impact = (volume_share) ** 2 \
|
||||
* self.price_impact * direction * event.price
|
||||
|
||||
Reference in New Issue
Block a user