Class: ChinaShop::Client
- Inherits:
-
Object
- Object
- ChinaShop::Client
- Defined in:
- lib/chinashop/client.rb
Instance Attribute Summary
Attributes included from Api
Attributes included from Config
Instance Method Summary collapse
- #account ⇒ Object
- #buy(h = {}) ⇒ Object
- #cancel_order(id) ⇒ Object
- #deposits ⇒ Object
- #market_depth ⇒ Object
- #order(id) ⇒ Object
- #order_book ⇒ Object
- #orders ⇒ Object
- #sell(h = {}) ⇒ Object
- #ticker ⇒ Object
- #trades ⇒ Object
- #transactions ⇒ Object
Methods included from Api
Methods included from Config
Instance Method Details
#account ⇒ Object
19 20 21 |
# File 'lib/chinashop/client.rb', line 19 def account Account.new(post(:method => 'getAccountInfo')) end |
#buy(h = {}) ⇒ Object
35 36 37 |
# File 'lib/chinashop/client.rb', line 35 def buy(h = {}) Buy.new(post(:method => 'buyOrder', :params => ["#{h[:price].to_f.round(5)}", "#{h[:amount].to_f.round(8)}"])) end |
#cancel_order(id) ⇒ Object
43 44 45 |
# File 'lib/chinashop/client.rb', line 43 def cancel_order(id) CancelOrder.new(post(:method => 'cancelOrder', :params => [id])) end |
#deposits ⇒ Object
51 52 53 |
# File 'lib/chinashop/client.rb', line 51 def deposits Deposits.new(post(:method => 'getDeposits', :params => ['BTC'])) end |
#market_depth ⇒ Object
31 32 33 |
# File 'lib/chinashop/client.rb', line 31 def market_depth MarketDepth.new(post(:method => 'getMarketDepth2')) end |
#order(id) ⇒ Object
27 28 29 |
# File 'lib/chinashop/client.rb', line 27 def order(id) Order.new(post(:method => 'getOrder', :params => [id])) end |
#order_book ⇒ Object
59 60 61 |
# File 'lib/chinashop/client.rb', line 59 def order_book get('https://data.btcchina.com/data/orderbook') end |
#orders ⇒ Object
23 24 25 |
# File 'lib/chinashop/client.rb', line 23 def orders Orders.new(post(:method => 'getOrders')) end |
#sell(h = {}) ⇒ Object
39 40 41 |
# File 'lib/chinashop/client.rb', line 39 def sell(h = {}) Sell.new(post(:method => 'sellOrder', :params => ["#{h[:price].to_f.round(5)}", "#{h[:amount].to_f.round(8)}"])) end |
#ticker ⇒ Object
55 56 57 |
# File 'lib/chinashop/client.rb', line 55 def ticker Ticker.new(get('https://data.btcchina.com/data/ticker')) end |
#trades ⇒ Object
63 64 65 |
# File 'lib/chinashop/client.rb', line 63 def trades get('https://data.btcchina.com/data/trades') end |
#transactions ⇒ Object
47 48 49 |
# File 'lib/chinashop/client.rb', line 47 def transactions Transactions.new(post(:method => 'getTransactions')) end |