Align hedge-plan perp contract precision with exchange and show TP/SL USDT PnL.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import unittest
|
||||
from lib.hedge_plan.hedge_plan_calc_lib import (
|
||||
build_options_options_preview,
|
||||
build_perp_options_preview,
|
||||
floor_contracts_to_precision,
|
||||
gate_status,
|
||||
option_expiry_pnl,
|
||||
option_premium_total,
|
||||
@@ -81,6 +82,11 @@ class TestHedgePlanCalc(unittest.TestCase):
|
||||
10,
|
||||
)
|
||||
|
||||
def test_floor_contracts_to_precision(self):
|
||||
self.assertEqual(floor_contracts_to_precision(4.569713, 4), 4.5697)
|
||||
self.assertEqual(floor_contracts_to_precision(4.569713, 0), 4.0)
|
||||
self.assertEqual(floor_contracts_to_precision(0, 4), 0.0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user