Class: Kaesen::Market Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/kaesen/market.rb

Overview

This class is abstract.

Exchange markets.

Direct Known Subclasses

Bitflyer, Btcbox, Coincheck, Kraken, Lakebtc, Monetago, Quoine, Zaif

Defined Under Namespace

Classes: APIErrorException, ConnectionFailedException, JSONException

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMarket



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

#nameObject (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

#balancehash

This method is abstract.

Get account balance.

Raises:

  • (NotImplemented)


62
63
64
# File 'lib/kaesen/market.rb', line 62

def balance
  raise NotImplemented.new()
end

#buy(rate, amount = BigDecimal.new("0.0")) ⇒ hash

This method is abstract.

Buy the amount of Bitcoin at the rate. 指数注文 買い.

Raises:

  • (NotImplemented)


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

This method is abstract.

Cancel an open order

Raises:

  • (NotImplemented)


147
148
149
# File 'lib/kaesen/market.rb', line 147

def cancel(id)
  raise NotImplemented.new()
end

#cancel_allarray

This method is abstract.

Cancel all open orders

Raises:

  • (NotImplemented)


155
156
157
# File 'lib/kaesen/market.rb', line 155

def cancel_all
  raise NotImplemented.new()
end

#depthhash

This method is abstract.

Get order book.

Raises:

  • (NotImplemented)


44
45
46
# File 'lib/kaesen/market.rb', line 44

def depth
  raise NotImplemented.new()
end

#market_buy(amount = BigDecimal.new("0.0")) ⇒ hash

This method is abstract.

Buy the amount of Bitcoin from the market. 成行注文 買い.

Raises:

  • (NotImplemented)


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

This method is abstract.

Sell the amount of Bitcoin to the market. 成行注文 売り.

Raises:

  • (NotImplemented)


138
139
140
# File 'lib/kaesen/market.rb', line 138

def market_sell(amount=BigDecimal.new("0.0"))
  raise NotImplemented.new()
end

#opensArray

This method is abstract.

Get open orders.

Raises:

  • (NotImplemented)


76
77
78
# File 'lib/kaesen/market.rb', line 76

def opens
  raise NotImplemented.new()
end

#sell(rate, amount = BigDecimal.new("0.0")) ⇒ hash

This method is abstract.

Sell the amount of Bitcoin at the rate. 指数注文 売り.

Raises:

  • (NotImplemented)


123
124
125
# File 'lib/kaesen/market.rb', line 123

def sell(rate, amount=BigDecimal.new("0.0"))
  raise NotImplemented.new()
end

#tickerhash

This method is abstract.

Get ticker information.

Raises:

  • (NotImplemented)


30
31
32
# File 'lib/kaesen/market.rb', line 30

def ticker
  raise NotImplemented.new()
end