Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Brokers/Tinvest.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def new_order(self, order):
request = PostOrderRequest(instrument_id=symbol.broker_info['figi'], quantity=quantity, direction=direction,
account_id=self.account_id, order_type=OrderType.ORDER_TYPE_MARKET, order_id=order_id)
response: PostOrderResponse = self.provider.call_function(self.provider.stub_orders.PostOrder, request) # Отправляем рыночную заявку брокеру
if response.execution_report_status == OrderExecutionReportStatus.EXECUTION_REPORT_STATUS_NEW: # Должен вернуться статус "Новая"
if response.execution_report_status in (OrderExecutionReportStatus.EXECUTION_REPORT_STATUS_NEW, OrderExecutionReportStatus.EXECUTION_REPORT_STATUS_FILL, OrderExecutionReportStatus.EXECUTION_REPORT_STATUS_PARTIALLYFILL): # Новая, а при мгновенном исполнении - исполнена или частично исполнена
order.id = response.order_id # Уникальный код заявки
order.status = Order.Submitted # Заявка отправлена брокеру
self.orders.append(order) # Добавляем новую заявку в список заявок
Expand All @@ -186,7 +186,7 @@ def new_order(self, order):
request = PostOrderRequest(instrument_id=symbol.broker_info['figi'], quantity=quantity, price=price, direction=direction,
account_id=self.account_id, order_type=OrderType.ORDER_TYPE_LIMIT, order_id=order_id)
response: PostOrderResponse = self.provider.call_function(self.provider.stub_orders.PostOrder, request) # Отправляем лимитную заявку брокеру
if response.execution_report_status == OrderExecutionReportStatus.EXECUTION_REPORT_STATUS_NEW: # Должен вернуться статус "Новая"
if response.execution_report_status in (OrderExecutionReportStatus.EXECUTION_REPORT_STATUS_NEW, OrderExecutionReportStatus.EXECUTION_REPORT_STATUS_FILL, OrderExecutionReportStatus.EXECUTION_REPORT_STATUS_PARTIALLYFILL): # Новая, а при мгновенном исполнении - исполнена или частично исполнена
order.id = response.order_id # Уникальный код заявки
order.status = Order.Submitted # Заявка отправлена брокеру
self.orders.append(order) # Добавляем новую заявку в список заявок
Expand Down