code: def test_create_from_buy_order(mock_order_class, mock_exchange_class):
      exchange = mock_exchange_class.return_value
      exchange.options = ExchangeOptions()
      exchange.id = "fake_exchange_id"
      exchange.name = "bitfinex"
      exchange.clock = mock.Mock()
      exchange.clock.step = 0
      exchange.quote_price = mock.Mock(return_value=Decimal(7000.00))
  
      wallets = [
          Wallet(exchange, 10000 * USD),
          Wallet(exchange, 2 * BTC),
      ]
      portfolio = Portfolio(USD, wallets)
  
      order = mock_order_class.return_value
      order.portfolio = portfolio
      order.exchange_pair = ExchangePair(exchange, USD / BTC)
      order.path_id = "fake_path_id"
      order.price = Decimal(7000.00)
  
      wallet_btc = portfolio.get_wallet(exchange.id, BTC)
      wallet_btc.lock(quantity=0.4 * BTC, order=order, reason="test")
  
      assert float(wallet_btc.balance.size) == 1.6
      assert float(wallet_btc.locked[order.path_id].size) == 0.4
  
      order_spec = OrderSpec(
          side=TradeSide.SELL,
          trade_type=TradeType.MARKET,
          exchange_pair=ExchangePair(exchange, USD / BTC),
      )
  
      next_order = order_spec.create_order(order)
      assert next_order
  
      assert next_order.side == TradeSide.SELL
      assert next_order.type == TradeType.MARKET
      assert next_order.exchange_pair == ExchangePair(
          exchange, USD / BTC
      )
      assert next_order.path_id == order.path_id
      assert next_order.quantity.path_id == order.path_id
      assert next_order.quantity.instrument == BTC
  
file_path: tensortrade/tests/tensortrade/unit/oms/orders/test_order_spec.py
imports: import re
  import unittest.mock
  from decimal import Decimal
  from tensortrade.oms.orders import OrderSpec, TradeSide, TradeType
  from tensortrade.oms.exchanges import ExchangeOptions
  from tensortrade.oms.instruments import USD, BTC, ExchangePair
  from tensortrade.oms.wallets import Portfolio, Wallet
label_desc: Use image node_id 2 for calling a global function with example usage: test_create_from_buy_order(mock_order_class, mock_exchange_class) without return types