code: def create_trade_history(
      sid,
      prices,
      amounts,
      interval,
      sim_params,
      trading_calendar,
      source_id="test_factory",
  ):
      trades = []
      current = sim_params.first_open
  
      oneday = timedelta(days=1)
      use_midnight = interval >= oneday
      for price, amount in zip(prices, amounts):
          if use_midnight:
              trade_dt = current.replace(hour=0, minute=0)
          else:
              trade_dt = current
          trade = create_trade(sid, price, amount, trade_dt, source_id)
          trades.append(trade)
          current = get_next_trading_dt(
              current, interval, trading_calendar
          )
  
      assert len(trades) == len(prices)
      return trades
  
imports: import pandas
  import numpy
  from datetime import timedelta, datetime
  from catalyst.assets import Asset
  from catalyst.finance.transaction import Transaction
  from catalyst.protocol import Event, DATASOURCE_TYPE
  from catalyst.sources import SpecificEquityTrades
  from catalyst.finance.trading import SimulationParameters
  from catalyst.sources.test_source import create_trade
  from catalyst.data.loader import load_from_yahoo, load_bars_from_yahoo
  from catalyst.utils.calendars import get_calendar
  from catalyst.utils.input_validation import expect_types
label_desc: Use image node_id 3 for calling a global function with example usage: create_trade_history(sid, prices, amounts, interval, sim_params, trading_calendar, source_id) and returns: trades