Skip to content

Commit

Permalink
[Mod] remove offset converter related data update and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vnpy committed Dec 20, 2023
1 parent bf6cce9 commit 38753eb
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions vnpy/trader/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,31 +412,16 @@ def process_order_event(self, event: Event) -> None:
elif order.vt_orderid in self.active_orders:
self.active_orders.pop(order.vt_orderid)

# Update to offset converter
converter: OffsetConverter = self.offset_converters.get(order.gateway_name, None)
if converter:
converter.update_order(order)

def process_trade_event(self, event: Event) -> None:
""""""
trade: TradeData = event.data
self.trades[trade.vt_tradeid] = trade

# Update to offset converter
converter: OffsetConverter = self.offset_converters.get(trade.gateway_name, None)
if converter:
converter.update_trade(trade)

def process_position_event(self, event: Event) -> None:
""""""
position: PositionData = event.data
self.positions[position.vt_positionid] = position

# Update to offset converter
converter: OffsetConverter = self.offset_converters.get(position.gateway_name, None)
if converter:
converter.update_position(position)

def process_account_event(self, event: Event) -> None:
""""""
account: AccountData = event.data
Expand All @@ -447,10 +432,6 @@ def process_contract_event(self, event: Event) -> None:
contract: ContractData = event.data
self.contracts[contract.vt_symbol] = contract

# Initialize offset converter for each gateway
if contract.gateway_name not in self.offset_converters:
self.offset_converters[contract.gateway_name] = OffsetConverter(self)

def process_quote_event(self, event: Event) -> None:
""""""
quote: QuoteData = event.data
Expand Down Expand Up @@ -582,9 +563,7 @@ def update_order_request(self, req: OrderRequest, vt_orderid: str, gateway_name:
"""
Update order request to offset converter.
"""
converter: OffsetConverter = self.offset_converters.get(gateway_name, None)
if converter:
converter.update_order_request(req, vt_orderid)
pass

def convert_order_request(
self,
Expand All @@ -596,12 +575,7 @@ def convert_order_request(
"""
Convert original order request according to given mode.
"""
converter: OffsetConverter = self.offset_converters.get(gateway_name, None)
if not converter:
return [req]

reqs: List[OrderRequest] = converter.convert_order_request(req, lock, net)
return reqs
return [req]

def get_converter(self, gateway_name: str) -> OffsetConverter:
"""
Expand Down

0 comments on commit 38753eb

Please sign in to comment.