Browse Source

positions: fix calculateSizeFixedCashWith: correct sizing

master
Denis Tereshkin 4 years ago
parent
commit
9d016b0d44
  1. 2
      src/ATrade/RoboCom/Positions.hs

2
src/ATrade/RoboCom/Positions.hs

@ -184,7 +184,7 @@ calculateSizeFixedCashWith totalCash maxPositions cfg series _ = @@ -184,7 +184,7 @@ calculateSizeFixedCashWith totalCash maxPositions cfg series _ =
case bsBars $ series of
(lastBar:_) ->
let cashPerPosition = totalCash / fromIntegral maxPositions in
truncate (cashPerPosition / (fromIntegral $ ipLotSize . bsParams $ series))
truncate (cashPerPosition / ((toDouble $ barClose lastBar) * (fromIntegral $ ipLotSize . bsParams $ series)))
_ -> 0
-- | Helper function. Finds first element in list which satisfies predicate 'p' and if found, applies 'm' to it, leaving other elements intact.

Loading…
Cancel
Save