Class: ApiController::Peatio

Inherits:
Object
  • Object
show all
Defined in:
lib/ApiController/peatio.rb

Overview

General peatio api functionality

Instance Method Summary collapse

Constructor Details

#initialize(endpoint, token) ⇒ Peatio



9
10
11
12
# File 'lib/ApiController/peatio.rb', line 9

def initialize(endpoint, token)
  @endpoint = endpoint
  @auth_token = token
end

Instance Method Details

#post_order(market, price, volume, type) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ApiController/peatio.rb', line 14

def post_order(market, price, volume, type)
  response = RestClient.post("#{@endpoint}/orders",
                             {
                                 'market': market,
                                 'side': type.to_s,
                                 'volume': volume.to_s,
                                 'price': price.to_s,
                                 'ord_type': 'limit'
                             },
                             {'Authorization': "Bearer #{@auth_token}",
                              'content_type': 'application/x-www-form-urlencoded'})
  #puts response
end