Module: Bitopro::Order

Included in:
Client
Defined in:
lib/bitopro/api/order.rb

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Instance Method Details

#cancel_order(pair: "", order_id: "") ⇒ Object

Example: client = Bitopro::Client.new client.cancel_order(pair: “bito_eth”, order_id: “3135725012”)



21
22
23
# File 'lib/bitopro/api/order.rb', line 21

def cancel_order(pair: "", order_id: "")
  authenticated_delete("/orders/#{pair}/#{order_id}")
end

#create_order(pair: "", action: "", amount: "0", price: "0", type: "limit") ⇒ Object

Example: client = Bitopro::Client.new client.create_order(pair: “bito_eth”, action: “buy”, amount: “600”, price: “0.000001”, type: “limit”)

Raises:



8
9
10
11
12
13
14
15
16
# File 'lib/bitopro/api/order.rb', line 8

def create_order(pair: "", action: "", amount: "0", price: "0", type: "limit")
  raise Error, "Amount or Price must be string" if !amount.is_a?(String) || !price.is_a?(String)

  authenticated_post("/orders/#{pair}", { body: { action: action,
                                                  amount: amount,
                                                  price: price,
                                                  timestamp: timestamp,
                                                  type: type }})
end

#get_order(pair: "", order_id: "") ⇒ Object



25
26
27
# File 'lib/bitopro/api/order.rb', line 25

def get_order(pair: "", order_id: "")
  authenticated_get("/orders/#{pair}/#{order_id}")
end