Class: Kaesen::Market Abstract
- Inherits:
-
Object
- Object
- Kaesen::Market
- Defined in:
- lib/kaesen/market.rb
Overview
Exchange markets.
Defined Under Namespace
Classes: APIErrorException, ConnectionFailedException, JSONException
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
-
.unBigDecimal(x) ⇒ any
Pretty printer for data including BigDecimal.
Instance Method Summary collapse
-
#balance ⇒ hash
abstract
Get account balance.
-
#buy(rate, amount = BigDecimal.new("0.0")) ⇒ hash
abstract
Buy the amount of Bitcoin at the rate.
-
#cancel(id) ⇒ hash
abstract
Cancel an open order.
-
#cancel_all ⇒ array
abstract
Cancel all open orders.
-
#depth ⇒ hash
abstract
Get order book.
-
#initialize ⇒ Market
constructor
A new instance of Market.
-
#market_buy(amount = BigDecimal.new("0.0")) ⇒ hash
abstract
Buy the amount of Bitcoin from the market.
-
#market_sell(amount = BigDecimal.new("0.0")) ⇒ hash
abstract
Sell the amount of Bitcoin to the market.
-
#opens ⇒ Array
abstract
Get open orders.
-
#sell(rate, amount = BigDecimal.new("0.0")) ⇒ hash
abstract
Sell the amount of Bitcoin at the rate.
-
#ticker ⇒ hash
abstract
Get ticker information.
Constructor Details
#initialize ⇒ Market
8 9 10 11 12 13 14 |
# File 'lib/kaesen/market.rb', line 8 def initialize @name = nil # [String] name of exchange market @api_key = nil # [String] @api_secret = nil # [String] @url_public = nil # [String] @url_private = nil # [String] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/kaesen/market.rb', line 6 def name @name end |
Class Method Details
.unBigDecimal(x) ⇒ any
Pretty printer for data including BigDecimal
162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/kaesen/market.rb', line 162 def self.unBigDecimal(x) if x.is_a?(Array) x.map{|y| unBigDecimal(y)} elsif x.is_a?(Hash) x.map{|k,v| [k, unBigDecimal(v)] }.to_h elsif x.is_a?(BigDecimal) x.to_f else x end end |
Instance Method Details
#balance ⇒ hash
Get account balance.
62 63 64 |
# File 'lib/kaesen/market.rb', line 62 def balance raise NotImplemented.new() end |
#buy(rate, amount = BigDecimal.new("0.0")) ⇒ hash
Buy the amount of Bitcoin at the rate. 指数注文 買い.
92 93 94 |
# File 'lib/kaesen/market.rb', line 92 def buy(rate, amount=BigDecimal.new("0.0")) raise NotImplemented.new() end |
#cancel(id) ⇒ hash
Cancel an open order
147 148 149 |
# File 'lib/kaesen/market.rb', line 147 def cancel(id) raise NotImplemented.new() end |
#cancel_all ⇒ array
Cancel all open orders
155 156 157 |
# File 'lib/kaesen/market.rb', line 155 def cancel_all raise NotImplemented.new() end |
#depth ⇒ hash
Get order book.
44 45 46 |
# File 'lib/kaesen/market.rb', line 44 def depth raise NotImplemented.new() end |
#market_buy(amount = BigDecimal.new("0.0")) ⇒ hash
Buy the amount of Bitcoin from the market. 成行注文 買い.
107 108 109 |
# File 'lib/kaesen/market.rb', line 107 def market_buy(amount=BigDecimal.new("0.0")) raise NotImplemented.new() end |
#market_sell(amount = BigDecimal.new("0.0")) ⇒ hash
Sell the amount of Bitcoin to the market. 成行注文 売り.
138 139 140 |
# File 'lib/kaesen/market.rb', line 138 def market_sell(amount=BigDecimal.new("0.0")) raise NotImplemented.new() end |
#opens ⇒ Array
Get open orders.
76 77 78 |
# File 'lib/kaesen/market.rb', line 76 def opens raise NotImplemented.new() end |
#sell(rate, amount = BigDecimal.new("0.0")) ⇒ hash
Sell the amount of Bitcoin at the rate. 指数注文 売り.
123 124 125 |
# File 'lib/kaesen/market.rb', line 123 def sell(rate, amount=BigDecimal.new("0.0")) raise NotImplemented.new() end |
#ticker ⇒ hash
Get ticker information.
30 31 32 |
# File 'lib/kaesen/market.rb', line 30 def ticker raise NotImplemented.new() end |