Class: Coinone::Order

Inherits:
Object
  • Object
show all
Defined in:
lib/coinone/order.rb,
lib/coinone/order/market_buy.rb,
lib/coinone/order/market_sell.rb,
lib/coinone/order/limit_orders.rb,
lib/coinone/order/trade_response.rb,
lib/coinone/order/complete_orders.rb,
lib/coinone/order/cancel_order_response.rb,
lib/coinone/order/limit_orders/limit_order.rb,
lib/coinone/order/cancel_all_order_response.rb,
lib/coinone/order/complete_orders/complete_order.rb

Defined Under Namespace

Classes: CancelAllOrderResponse, CancelOrderResponse, CompleteOrders, LimitOrders, TradeResponse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, connection = nil) ⇒ Order

Returns a new instance of Order.



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/coinone/order.rb', line 16

def initialize(options={}, connection=nil)

  @connection = connection || Connection.factory(options)
  @cancel_all_order_response = CancelAllOrderResponse.new()
  @cancel_order_response = CancelOrderResponse.new()
  @limit_sell = TradeResponse.new()
  @limit_buy = TradeResponse.new()
  @market_sell = TradeResponse.new()
  @market_buy = TradeResponse.new()
  @complete_orders = CompleteOrders.new()
  @limit_orders = LimitOrders.new()

end

Instance Attribute Details

#cancel_all_order_responseObject (readonly)

Returns the value of attribute cancel_all_order_response.



12
13
14
# File 'lib/coinone/order.rb', line 12

def cancel_all_order_response
  @cancel_all_order_response
end

#cancel_order_responseObject (readonly)

Returns the value of attribute cancel_order_response.



12
13
14
# File 'lib/coinone/order.rb', line 12

def cancel_order_response
  @cancel_order_response
end

#complete_ordersObject (readonly)

Returns the value of attribute complete_orders.



13
14
15
# File 'lib/coinone/order.rb', line 13

def complete_orders
  @complete_orders
end

#connectionObject (readonly)

Returns the value of attribute connection.



11
12
13
# File 'lib/coinone/order.rb', line 11

def connection
  @connection
end

#limit_buyObject (readonly)

Returns the value of attribute limit_buy.



12
13
14
# File 'lib/coinone/order.rb', line 12

def limit_buy
  @limit_buy
end

#limit_ordersObject (readonly)

Returns the value of attribute limit_orders.



13
14
15
# File 'lib/coinone/order.rb', line 13

def limit_orders
  @limit_orders
end

#limit_sellObject (readonly)

Returns the value of attribute limit_sell.



12
13
14
# File 'lib/coinone/order.rb', line 12

def limit_sell
  @limit_sell
end

#market_buyObject (readonly)

Returns the value of attribute market_buy.



13
14
15
# File 'lib/coinone/order.rb', line 13

def market_buy
  @market_buy
end

#market_sellObject (readonly)

Returns the value of attribute market_sell.



13
14
15
# File 'lib/coinone/order.rb', line 13

def market_sell
  @market_sell
end

Instance Method Details

#cancel_all_order(options = {}) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/coinone/order.rb', line 31

def cancel_all_order(options={})
  options[:currency] = "btc" if options[:currency].blank?
  response = @connection.post( "/v2/order/cancel_all/", options)

  @cancel_all_order_response.update_response(response)
  @cancel_all_order_response

end

#cancel_order(options = {}) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/coinone/order.rb', line 40

def cancel_order(options={})
  options[:currency] = "btc" if options[:currency].blank?
  response = @connection.post( "/v2/order/cancel/", options)

  @cancel_order_response.update_response(response)
  @cancel_order_response

end

#get_complete_orders(options = {}) ⇒ Object



85
86
87
88
89
90
91
92
93
# File 'lib/coinone/order.rb', line 85

def get_complete_orders(options={})
  options[:currency] = "btc" if options[:currency].blank?
  response = @connection.post( "/v2/order/complete_orders/", options)

  @complete_orders.update_response(response)
  @complete_orders


end

#get_limit_buy(options = {}) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/coinone/order.rb', line 58

def get_limit_buy(options = {})
  options[:currency] = "btc" if options[:currency].blank?
  response = @connection.post( "/v2/order/limit_buy/", options)

  @limit_buy.update_response(response)
  @limit_buy

end

#get_limit_orders(options = {}) ⇒ Object



96
97
98
99
100
101
102
103
# File 'lib/coinone/order.rb', line 96

def get_limit_orders(options={})
  options[:currency] = "btc" if options[:currency].blank?
  response = @connection.post( "/v2/order/limit_orders/", options)

  @limit_orders.update_response(response)
  @limit_orders

end

#get_limit_sell(options = {}) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/coinone/order.rb', line 49

def get_limit_sell(options={})

  options[:currency] = "btc" if options[:currency].blank?
  response = @connection.post( "/v2/order/limit_sell/", options)

  @limit_sell.update_response(response)
  @limit_sell
end

#get_market_buy(options = {}) ⇒ Object



67
68
69
70
71
72
73
74
# File 'lib/coinone/order.rb', line 67

def get_market_buy(options={})
  options[:currency] = "btc" if options[:currency].blank?
  response = @connection.post( "/v2/order/market_buy/", options)

  @market_buy.update_response(response)
  @market_buy

end

#get_market_sell(options = {}) ⇒ Object



76
77
78
79
80
81
82
83
# File 'lib/coinone/order.rb', line 76

def get_market_sell(options={})
  options[:currency] = "btc" if options[:currency].blank?
  response = @connection.post( "/v2/order/market_sell/", options)

  @market_sell.update_response(response)
  @market_sell

end