You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of Bug
When submitting an order, the function that rounds to two or four decimal places very occasionally rounds down an additional number. This function truncate_float is called with many order submissions. The issue is floating point arithmetic: e.g., 4.64*100=4.6399999999999994. I suggest using the python native function round() instead: return round(flt, 2) etc.
Code to Reproduce
from tda.orders.generic import truncate_float
a = 4.64
b = truncate_float(a)
print(a, b)
Expected Behavior
4.64 4.64
Actual Behavior
4.64 4.63
Error/Exception Log, If Applicable
N/A
The text was updated successfully, but these errors were encountered:
Description of Bug
When submitting an order, the function that rounds to two or four decimal places very occasionally rounds down an additional number. This function truncate_float is called with many order submissions. The issue is floating point arithmetic: e.g., 4.64*100=4.6399999999999994. I suggest using the python native function round() instead: return round(flt, 2) etc.
Code to Reproduce
from tda.orders.generic import truncate_float
a = 4.64
b = truncate_float(a)
print(a, b)
Expected Behavior
4.64 4.64
Actual Behavior
4.64 4.63
Error/Exception Log, If Applicable
N/A
The text was updated successfully, but these errors were encountered: