feat dev
This commit is contained in:
Binary file not shown.
@@ -65,7 +65,7 @@ class TrendTests(unittest.TestCase):
|
||||
|
||||
book.refresh(client)
|
||||
|
||||
self.assertEqual(set(book.data), {"BUY-A", "SELL-B"})
|
||||
self.assertEqual({item.id for item in book.data}, {"completed"})
|
||||
self.assertEqual(client.canceled, ["active"])
|
||||
|
||||
def test_position_dataclasses_execute_without_type_error(self):
|
||||
@@ -126,15 +126,20 @@ class TrendTests(unittest.TestCase):
|
||||
second = handle_loss(runtime, position, Tick(last_price=5), -50, 5000)
|
||||
self.assertIn("等待", second.message)
|
||||
|
||||
def test_reconcile_ing_order_from_deal(self):
|
||||
def test_reconcile_split_orders_complete_only_when_all_are_status_56(self):
|
||||
with TemporaryDirectory() as directory:
|
||||
state = State.for_strategy(directory, "trend", "A")
|
||||
position = PositionItem(stock_code="A", volume=100, open_price=10)
|
||||
state.set(StateItem("A", base_order_id="local-1", base_status="ING"))
|
||||
completed = OrderItem("1", "A", "BUY", "", "56", None, 50, "local-1")
|
||||
processing = OrderItem("2", "A", "BUY", "", "50", None, 50, "local-1")
|
||||
|
||||
state.reconcile([position], [completed, processing])
|
||||
self.assertEqual(state.get("A").base_status, "ING")
|
||||
|
||||
state.reconcile(
|
||||
[position],
|
||||
[],
|
||||
[{"m_strRemark": "local-1|morning"}],
|
||||
[completed, OrderItem("2", "A", "BUY", "", "56", None, 50, "local-1")],
|
||||
)
|
||||
self.assertEqual(state.get("A").base_status, STATUS_OK)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user