You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: trades.rb
    path of file: ./repos/cryptoexchange/lib/cryptoexchange/exchanges/bitonbay/services
    
    the code of the file until where you have to start completion: module Cryptoexchange::Exchanges
  module Bitonbay
    module Services
      class Trades < Cryptoexchange::Services::Market
        d
    
        def adapt(output, market_pair)
          output["data"].collect do |trade|
            tr = Cryptoexchange::Models::Trade.new
            tr.trade_id  = trade['seq']
            tr.base      = market_pair.base
            tr.target    = market_pair.target
            tr.market    = Bitonbay::Market::NAME
            tr.type      = trade['order_type'] == 'ask' ? 'sell' : 'buy'
            tr.price     = trade['price']
            tr.amount    = trade['unit_traded']
            tr.timestamp = Time.parse(trade['transaction_date']).to_i
            tr.payload   = trade
            tr
          end
        end