use FtPrecise to convert to contracts and back
This commit is contained in:
parent
00b192b4df
commit
4efe2e9bc4
@ -2891,7 +2891,7 @@ def amount_to_contracts(amount: float, contract_size: Optional[float]) -> float:
|
||||
:return: num-contracts
|
||||
"""
|
||||
if contract_size and contract_size != 1:
|
||||
return amount / contract_size
|
||||
return float(FtPrecise(amount) / FtPrecise(contract_size))
|
||||
else:
|
||||
return amount
|
||||
|
||||
@ -2905,7 +2905,7 @@ def contracts_to_amount(num_contracts: float, contract_size: Optional[float]) ->
|
||||
"""
|
||||
|
||||
if contract_size and contract_size != 1:
|
||||
return num_contracts * contract_size
|
||||
return float(FtPrecise(num_contracts) * FtPrecise(contract_size))
|
||||
else:
|
||||
return num_contracts
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user