/ StrategyTools / src / checks.jl
checks.jl
 1  @doc """ Check if collateral is below a calculated threshold
 2  
 3  $(TYPEDSIGNATURES)
 4  
 5  Determines if the collateral of a position `p` is less than the minimum required amount or a dynamic threshold based on `s[:qt_base]`.
 6  """
 7  belowtotal(s, ai, p; qt=s.qt_base) = collateral(p) < max(ai.limits.amount.min, current_total(s) * qt)
 8  
 9  @doc """ Verify if free cash is above the entry cost minimum
10  
11  $(TYPEDSIGNATURES)
12  """
13  hasentrycash(s, ai) = freecash(s) > ai.limits.cost.min
14  
15  @doc """ Assess if amount exceeds the minimum exit amount
16  
17  $(TYPEDSIGNATURES)
18  """
19  hasexitcash(amt, ai) = amt > ai.limits.amount.min
20