中控期权浮盈只显示U;总浮盈亏按指数把币本位浮盈计入USDT
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -63,6 +63,28 @@ class HubOptionsFundsLibTests(TestCase):
|
||||
self.assertEqual(out["options_open_position_count"], 1)
|
||||
self.assertEqual(out["options_float_pnl_u"], 0.5)
|
||||
|
||||
def test_options_float_pnl_usdt_coin_converts_by_index(self):
|
||||
from lib.hub.hub_options_funds_lib import options_float_pnl_usdt
|
||||
|
||||
snap = {
|
||||
"ok": True,
|
||||
"enabled": True,
|
||||
"options_margin_mode": "coin",
|
||||
"options_index_px": 2280.0,
|
||||
"upl_total_usdc": 0.0016,
|
||||
"positions": [
|
||||
{
|
||||
"inst_id": "ETH-USD-260822-2250-C",
|
||||
"margin_mode": "coin",
|
||||
"premium_ccy": "ETH",
|
||||
"upl": 0.0016,
|
||||
"idx_px": 2280.0,
|
||||
}
|
||||
],
|
||||
}
|
||||
out = options_float_pnl_usdt(snap)
|
||||
self.assertAlmostEqual(out, round(0.0016 * 2280.0, 4), places=4)
|
||||
|
||||
def test_repair_double_counted_fund_entry(self):
|
||||
raw = {
|
||||
"funding_usdt": 586.82,
|
||||
|
||||
Reference in New Issue
Block a user