-
Notifications
You must be signed in to change notification settings - Fork 1
/
trades.rb
32 lines (27 loc) · 954 Bytes
/
trades.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module APIv2
class Trades < Grape::API
helpers ::APIv2::NamedParams
desc 'Get recent trades on market, each trade is included only once. Trades are sorted in reverse creation order.'
params do
use :market, :trade_filters
end
get "/trades" do
trades = Trade.filter(params[:market], time_to, params[:from], params[:to], params[:limit], order_param)
present trades, with: APIv2::Entities::Trade
end
desc 'Get your executed trades. Trades are sorted in reverse creation order.', scopes: %w(history)
params do
use :auth, :market, :trade_filters
end
get "/trades/my" do
authenticate!
trades = Trade.for_member(
params[:market], current_user,
limit: params[:limit], time_to: time_to,
from: params[:from], to: params[:to],
order: order_param
)
present trades, with: APIv2::Entities::Trade, current_user: current_user
end
end
end