Initial commit
This commit is contained in:
28
app/api/v2/account/levels.rb
Normal file
28
app/api/v2/account/levels.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Account
|
||||
class Levels < Grape::API
|
||||
|
||||
desc 'Get current level and next level informations',
|
||||
is_array: true
|
||||
get '/levels' do
|
||||
current_level = current_user.group
|
||||
next_level = current_user.next_group
|
||||
current_level_min_max = Member.min_max_group(current_level)
|
||||
next_level_min_max = Member.min_max_group(next_level)
|
||||
|
||||
current_level_fee = TradingFee.for(group: current_level, market_id: 'ANY')
|
||||
next_level_fee = TradingFee.for(group: next_level, market_id: 'ANY')
|
||||
|
||||
{ 'current': { 'name': current_level, 'max': current_level_min_max[1], 'min': current_level_min_max[0],
|
||||
'maker_fee': current_level_fee.maker, 'taker_fee': current_level_fee.taker },
|
||||
'next': { 'name': next_level, 'max': next_level_min_max[1], 'min': next_level_min_max[0],
|
||||
'maker_fee': next_level_fee.maker, 'taker_fee': next_level_fee.taker }}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user