code: def test_on_fill(mock_trade_class, mock_exchange_class):
      exchange = mock_exchange_class.return_value
      exchange.options.max_trade_size = 1e6
      exchange.id = "fake_exchange_id"
      exchange.name = "bitfinex"
      exchange.quote_price = lambda pair: Decimal(7000.00)
  
      broker = Broker()
      broker.exchanges = [exchange]
  
      wallets = [
          Wallet(exchange, 10000 * USD),
          Wallet(exchange, 0 * BTC),
      ]
      portfolio = Portfolio(USD, wallets)
  
      order = Order(
          step=0,
          exchange_pair=ExchangePair(exchange, USD / BTC),
          side=TradeSide.BUY,
          trade_type=TradeType.MARKET,
          quantity=5200.00 * USD,
          portfolio=portfolio,
          price=7000.00,
      )
  
      order.attach(broker)
  
      order.execute()
  
      broker.executed[order.id] = order
  
      trade = mock_trade_class.return_value
      trade.quantity = 5197.00 * USD
      trade.commission = 3.00 * USD
      trade.order_id = order.id
  
      assert order.status == OrderStatus.OPEN
      order.fill(trade)
      assert order.status == OrderStatus.FILLED
  
      assert order.remaining == 0
  
      assert trade in broker.trades[order.id]
  
file_path: tensortrade/tests/tensortrade/unit/oms/orders/test_broker.py
imports: import pytest
  import unittest.mock
  from decimal import Decimal
  from tensortrade.oms.orders import Broker, OrderStatus, Order, OrderSpec, TradeSide, TradeType
  from tensortrade.oms.orders.criteria import Stop
  from tensortrade.oms.wallets import Wallet, Portfolio
  from tensortrade.oms.instruments import USD, BTC, Quantity, ExchangePair
label_desc: Use image node_id 6 for calling a global function with example usage: test_on_fill(mock_trade_class, mock_exchange_class) without return types