币本位期权开仓/翻倍提醒/翻倍平仓/目标平仓/手动平仓微信推送:按ETH/BTC计价并补齐全平必发
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,10 +11,10 @@ from lib.options.options_notify_lib import (
|
||||
|
||||
|
||||
class TestOptionsNotify(unittest.TestCase):
|
||||
def test_open_close_messages(self) -> None:
|
||||
def test_open_close_messages_usdc(self) -> None:
|
||||
open_msg = build_options_open_message(
|
||||
account_label="OKX期权",
|
||||
inst_id="ETH-USD-250725-3200-C",
|
||||
inst_id="ETH-USD_UM-250725-3200-C",
|
||||
underlying="ETH",
|
||||
opt_type="C",
|
||||
sheets=2,
|
||||
@@ -23,14 +23,17 @@ class TestOptionsNotify(unittest.TestCase):
|
||||
target_index=3400,
|
||||
signal_note="假突破",
|
||||
trade_id=12,
|
||||
premium_ccy="USDC",
|
||||
margin_mode="usdc",
|
||||
)
|
||||
self.assertIn("【OKX期权·开仓】", open_msg)
|
||||
self.assertIn("ETH-USD-250725-3200-C", open_msg)
|
||||
self.assertIn("ETH-USD_UM-250725-3200-C", open_msg)
|
||||
self.assertIn("目标指数:3400", open_msg)
|
||||
self.assertIn("USDC", open_msg)
|
||||
|
||||
close_msg = build_options_close_message(
|
||||
account_label="OKX期权",
|
||||
inst_id="ETH-USD-250725-3200-C",
|
||||
inst_id="ETH-USD_UM-250725-3200-C",
|
||||
reason="手动平仓",
|
||||
underlying="ETH",
|
||||
opt_type="C",
|
||||
@@ -38,10 +41,45 @@ class TestOptionsNotify(unittest.TestCase):
|
||||
premium_paid=8.5,
|
||||
premium_received=12.0,
|
||||
realized_pnl=3.5,
|
||||
premium_ccy="USDC",
|
||||
)
|
||||
self.assertIn("【OKX期权·平仓】", close_msg)
|
||||
self.assertIn("手动平仓", close_msg)
|
||||
self.assertIn("3.5000", close_msg)
|
||||
self.assertIn("USDC", close_msg)
|
||||
|
||||
def test_open_close_messages_coin(self) -> None:
|
||||
open_msg = build_options_open_message(
|
||||
account_label="OKX期权",
|
||||
inst_id="ETH-USD-250725-3200-C",
|
||||
underlying="ETH",
|
||||
opt_type="C",
|
||||
sheets=1,
|
||||
premium_paid=0.001234,
|
||||
open_quote=0.01234,
|
||||
trade_id=99,
|
||||
premium_ccy="ETH",
|
||||
margin_mode="coin",
|
||||
)
|
||||
self.assertIn("本位:币本位", open_msg)
|
||||
self.assertIn("ETH", open_msg)
|
||||
self.assertNotIn("USDC", open_msg)
|
||||
|
||||
close_msg = build_options_close_message(
|
||||
account_label="OKX期权",
|
||||
inst_id="ETH-USD-250725-3200-C",
|
||||
reason="翻倍出场(1倍)",
|
||||
underlying="ETH",
|
||||
sheets=1,
|
||||
premium_paid=0.001234,
|
||||
premium_received=0.0025,
|
||||
realized_pnl=0.001266,
|
||||
premium_ccy="ETH",
|
||||
margin_mode="coin",
|
||||
)
|
||||
self.assertIn("本位:币本位", close_msg)
|
||||
self.assertIn("翻倍出场", close_msg)
|
||||
self.assertIn("ETH", close_msg)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user