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
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
Returns the value of attribute api_secret.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url_private ⇒ Object
Returns the value of attribute url_private.
-
#url_public ⇒ Object
Returns the value of attribute url_public.
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
Returns a new instance of Market.
9 10 11 12 13 14 15 |
# File 'lib/kaesen/market.rb', line 9 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
#api_key ⇒ Object
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/kaesen/market.rb', line 7 def api_key @api_key end |
#api_secret ⇒ Object
Returns the value of attribute api_secret.
7 8 9 |
# File 'lib/kaesen/market.rb', line 7 def api_secret @api_secret end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/kaesen/market.rb', line 6 def name @name end |
#url_private ⇒ Object
Returns the value of attribute url_private.
7 8 9 |
# File 'lib/kaesen/market.rb', line 7 def url_private @url_private end |
#url_public ⇒ Object
Returns the value of attribute url_public.
7 8 9 |
# File 'lib/kaesen/market.rb', line 7 def url_public @url_public end |
Class Method Details
.unBigDecimal(x) ⇒ any
Pretty printer for data including BigDecimal
163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/kaesen/market.rb', line 163 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.
63 64 65 |
# File 'lib/kaesen/market.rb', line 63 def balance raise NotImplemented.new() end |
#buy(rate, amount = BigDecimal.new("0.0")) ⇒ hash
Buy the amount of Bitcoin at the rate. 指数注文 買い.
93 94 95 |
# File 'lib/kaesen/market.rb', line 93 def buy(rate, amount=BigDecimal.new("0.0")) raise NotImplemented.new() end |
#cancel(id) ⇒ hash
Cancel an open order
148 149 150 |
# File 'lib/kaesen/market.rb', line 148 def cancel(id) raise NotImplemented.new() end |
#cancel_all ⇒ array
Cancel all open orders
156 157 158 |
# File 'lib/kaesen/market.rb', line 156 def cancel_all raise NotImplemented.new() end |
#depth ⇒ hash
Get order book.
45 46 47 |
# File 'lib/kaesen/market.rb', line 45 def depth raise NotImplemented.new() end |
#market_buy(amount = BigDecimal.new("0.0")) ⇒ hash
Buy the amount of Bitcoin from the market. 成行注文 買い.
108 109 110 |
# File 'lib/kaesen/market.rb', line 108 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. 成行注文 売り.
139 140 141 |
# File 'lib/kaesen/market.rb', line 139 def market_sell(amount=BigDecimal.new("0.0")) raise NotImplemented.new() end |
#opens ⇒ Array
Get open orders.
77 78 79 |
# File 'lib/kaesen/market.rb', line 77 def opens raise NotImplemented.new() end |
#sell(rate, amount = BigDecimal.new("0.0")) ⇒ hash
Sell the amount of Bitcoin at the rate. 指数注文 売り.
124 125 126 |
# File 'lib/kaesen/market.rb', line 124 def sell(rate, amount=BigDecimal.new("0.0")) raise NotImplemented.new() end |
#ticker ⇒ hash
Get ticker information.
31 32 33 |
# File 'lib/kaesen/market.rb', line 31 def ticker raise NotImplemented.new() end |