docstr: create_order method
  tests the handling of a RequestTimeout exception and locating the
  order, if was created, using the fetchTrades method.
  checks as well, the case that the order was not created at all,
  and makes sure an exception is raised in order to retry the
  creation of the order.
  :return:
docstr_tok: ["create_order","method","tests","the","handling","of","a","RequestTimeout","exception","and","locating","the","order",",","if","was","created",",","using","the","fetchTrades","method",".","checks","as","well",",","the","case","that","the","order","was","not","created","at","all",",","and","makes","sure","an","exception","is","raised","in","order","to","retry","the","creation","of","the","order",".",":","return",":"]
code: def test_create_order_timeout_trade(self):
      """
      create_order method
      tests the handling of a RequestTimeout exception and locating the
      order, if was created, using the fetchTrades method.
      checks as well, the case that the order was not created at all,
      and makes sure an exception is raised in order to retry the
      creation of the order.
      :return:
      """
      asset = [
          pair
          for pair in self.exchange.assets
          if pair.symbol == "eth_usdt"
      ][0]
      amount = 2
      is_buy = True
      self.last_order = False
      self.last_trade = False
  
      price = 0.00254
      stop_price = 0.00354
  
      self.exchange.api = MagicMock(
          spec=[
              "create_order",
              "fetch_my_trades",
              "has",
              "fetch_open_orders",
              "orders",
              "fetch_closed_orders",
              "amount_to_precision",
          ]
      )
      self.exchange.api.create_order.side_effect = RequestTimeout
  
      orders_dict = self.create_orders_dict(asset, self.last_order)
      self.exchange.api.orders = orders_dict
      self.exchange.api.has = {
          "fetchClosedOrders": "emulated",
          "fetchOrders": False,
          "fetchMyTrades": True,
      }
      self.exchange.api.fetch_my_trades.side_effect = (
          self.create_trades_dict
      )
  
      mock_style = create_autospec(
          ExchangeLimitOrder, return_value=price
      )
      mock_style.get_limit_price.return_value = price
      mock_style.get_stop_price.return_value = stop_price
      style = mock_style
  
      self.exchange.api.amount_to_precision = Mock(
          return_value=float(amount)
      )
  
      # check the case there are no new trades and an exception is raised
      with patch(
          "catalyst.exchange.ccxt.ccxt_exchange.CCXT.get_symbol"
      ) as mock_symbol:
          mock_symbol.return_value = "ETH/USDT"
          try:
              observed_fetchTrade_None = self.exchange.create_order(
                  asset, amount, is_buy, style
              )
              print(observed_fetchTrade_None)
          except ExchangeRequestError:
              pass
  
      # check the case there are trades which form a neew order
      self.last_trade = True
      with patch(
          "catalyst.exchange.ccxt.ccxt_exchange.CCXT.get_symbol"
      ) as mock_symbol:
          mock_symbol.return_value = "ETH/USDT"
          observed_fetchTrade_order = self.exchange.create_order(
              asset, amount, is_buy, style
          )
  
      expected_fetchTrade_order = Order(
          dt=pd.Timestamp.utcnow(),
          asset=asset,
          amount=amount,
          stop=stop_price,
          limit=price,
          id="111",
      )
      assert (
          self.compare_orders(
              observed_fetchTrade_order, expected_fetchTrade_order
          )
          is True
      )
  
      # check the case there are no new trades or orders and an exception is
      # raised
      self.last_trade = False
      self.exchange.api.has["fetchOpenOrders"] = True
      with patch(
          "catalyst.exchange.ccxt.ccxt_exchange.CCXT.get_symbol"
      ) as mock_symbol:
          mock_symbol.return_value = "ETH/USDT"
          try:
              observed_fetchTradeOrder_None = (
                  self.exchange.create_order(
                      asset, amount, is_buy, style
                  )
              )
              print(observed_fetchTradeOrder_None)
          except ExchangeRequestError:
              pass
  
imports: from logbook import Logger
  from mock import patch, create_autospec, MagicMock, Mock
  import pandas
  from ccxt.base.errors import RequestTimeout
  from catalyst.exchange.exchange_errors import ExchangeRequestError
  from .base import BaseExchangeTestCase
  from catalyst.exchange.ccxt.ccxt_exchange import CCXT
  from catalyst.exchange.exchange_execution import ExchangeLimitOrder
  from catalyst.exchange.utils.exchange_utils import get_exchange_auth
  from catalyst.finance.order import Order
label_desc: Use image node_id 9 for calling the TestCCXT obj's underlying member method code with example usage: obj.test_create_order_timeout_trade() without return types