app/models/trading_fee.rb
# Get trading fee for specific order that based on member group and market_id.
# TradingFee record selected with the next priorities:
#  1. both group and market_id match
#  2. group match
#  3. market_id match
#  4. both group and market_id are 'any'
#  5. default (zero fees)
Get trading fee for specific order that based on member group and market_id.
TradingFee record selected with the next priorities:
1. both group and market_id match
2. group match
3.
Get trading fee for specific order that based on member group and market_id . TradingFee record selected with the next priorities : 1 . both group and market_id match 2 . group match 3 .
def for(group:, market_id:, market_type: Market::DEFAULT_TYPE)
      TradingFee
        .where(market_id: [market_id, ANY], market_type: [market_type, ANY], group: [group, ANY])
        .max_by { |fs| fs.weight } || TradingFee.new
    end
def for ( group : , market_id : , market_type : Market :: DEFAULT_TYPE ) TradingFee . where ( market_id : [ market_id , ANY ] , market_type : [ market_type , ANY ] , group : [ group , ANY ] ) . max_by { | fs | fs . weight } || TradingFee . new end
Get trading fee for specific order that based on member group and market_id.
Get trading fee for specific order that based on member group and market_id .
group
market_id
market_type