Class: Abucoins::API
- Inherits:
-
Object
- Object
- Abucoins::API
- Defined in:
- lib/abucoins/abucoins.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#passphrase ⇒ Object
readonly
Returns the value of attribute passphrase.
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #accounts ⇒ Object
- #cancel_order(id) ⇒ Object
- #create_order(side:, hidden: false, time_in_force: nil, size:, price:, product_id:, type: 'limit', cancel_after: nil, post_only: nil) ⇒ Object
- #deposits(opts = {}) ⇒ Object
- #deposits_crypto(currency:, method:) ⇒ Object
- #fills(args = nil) ⇒ Object
-
#initialize(passphrase:, key:, secret:, url: 'https://api.abucoins.com') ⇒ API
constructor
A new instance of API.
- #order(id) ⇒ Object
- #orders(args = {}) ⇒ Object
- #products ⇒ Object
- #withdrawals(opts = {}) ⇒ Object
- #withdrawals_crypto(amount:, currency:, method:, address:, tag: nil) ⇒ Object
Constructor Details
permalink #initialize(passphrase:, key:, secret:, url: 'https://api.abucoins.com') ⇒ API
Returns a new instance of API.
12 13 14 15 16 17 |
# File 'lib/abucoins/abucoins.rb', line 12 def initialize(passphrase:, key:, secret:, url: 'https://api.abucoins.com') @passphrase = passphrase @key = key @secret = secret @url = url end |
Instance Attribute Details
permalink #key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/abucoins/abucoins.rb', line 7 def key @key end |
permalink #passphrase ⇒ Object (readonly)
Returns the value of attribute passphrase.
7 8 9 |
# File 'lib/abucoins/abucoins.rb', line 7 def passphrase @passphrase end |
permalink #secret ⇒ Object (readonly)
Returns the value of attribute secret.
7 8 9 |
# File 'lib/abucoins/abucoins.rb', line 7 def secret @secret end |
permalink #url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/abucoins/abucoins.rb', line 7 def url @url end |
Instance Method Details
permalink #accounts ⇒ Object
[View source]
58 59 60 |
# File 'lib/abucoins/abucoins.rb', line 58 def accounts get('/accounts') end |
permalink #cancel_order(id) ⇒ Object
[View source]
54 55 56 |
# File 'lib/abucoins/abucoins.rb', line 54 def cancel_order(id) delete("/orders/#{id}") end |
permalink #create_order(side:, hidden: false, time_in_force: nil, size:, price:, product_id:, type: 'limit', cancel_after: nil, post_only: nil) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/abucoins/abucoins.rb', line 35 def create_order(side:, hidden: false, time_in_force: nil, size:, price:, product_id:, type: 'limit', cancel_after: nil, post_only: nil) opts = { side: side, hidden: hidden, size: size, price: price, product_id: product_id, type: type } opts[:time_in_force] = time_in_force unless time_in_force.nil? opts[:cancel_after] = cancel_after unless cancel_after.nil? opts[:post_only] = post_only unless post_only.nil? order = post('/orders', opts) raise Abucoins::CreateOrderException.new(order['error'] || order['message']) unless order['id'] order end |
permalink #deposits(opts = {}) ⇒ Object
[View source]
79 80 81 |
# File 'lib/abucoins/abucoins.rb', line 79 def deposits(opts={}) get('/deposits/history', opts) end |
permalink #deposits_crypto(currency:, method:) ⇒ Object
[View source]
62 63 64 65 66 67 |
# File 'lib/abucoins/abucoins.rb', line 62 def deposits_crypto(currency:, method:) post('/deposits/crypto', { currency: currency, method: method }) end |
permalink #fills(args = nil) ⇒ Object
[View source]
31 32 33 |
# File 'lib/abucoins/abucoins.rb', line 31 def fills(args = nil) get('/fills', params: args) end |
permalink #order(id) ⇒ Object
[View source]
27 28 29 |
# File 'lib/abucoins/abucoins.rb', line 27 def order(id) get("/orders/#{id}") end |
permalink #orders(args = {}) ⇒ Object
[View source]
23 24 25 |
# File 'lib/abucoins/abucoins.rb', line 23 def orders(args = {}) get('/orders', params: args) end |
permalink #products ⇒ Object
[View source]
19 20 21 |
# File 'lib/abucoins/abucoins.rb', line 19 def products get('/products') end |
permalink #withdrawals(opts = {}) ⇒ Object
[View source]
83 84 85 |
# File 'lib/abucoins/abucoins.rb', line 83 def withdrawals(opts={}) get('/withdrawals/history', opts) end |
permalink #withdrawals_crypto(amount:, currency:, method:, address:, tag: nil) ⇒ Object
[View source]
69 70 71 72 73 74 75 76 77 |
# File 'lib/abucoins/abucoins.rb', line 69 def withdrawals_crypto(amount:, currency:, method:, address:, tag: nil) post('/withdrawals/crypto', { amount: amount, currency: currency, method: method, address: address, tag: tag, }) end |