Class: Cryptohopper::Resources::Hoppers
- Inherits:
-
Object
- Object
- Cryptohopper::Resources::Hoppers
- Defined in:
- lib/cryptohopper/resources/hoppers.rb
Overview
‘client.hoppers` — user trading bots (CRUD, positions, orders, trade, config).
Instance Method Summary collapse
- #buy(data) ⇒ Object
- #config_get(hopper_id) ⇒ Object
- #config_pools(hopper_id) ⇒ Object
- #config_update(hopper_id, config) ⇒ Object
- #create(data) ⇒ Object
- #delete(hopper_id) ⇒ Object
- #get(hopper_id) ⇒ Object
-
#initialize(client) ⇒ Hoppers
constructor
A new instance of Hoppers.
- #list(exchange: nil) ⇒ Object
- #orders(hopper_id, **extra) ⇒ Object
- #panic(hopper_id) ⇒ Object
- #position(hopper_id, position_id) ⇒ Object
- #positions(hopper_id) ⇒ Object
- #sell(data) ⇒ Object
- #update(hopper_id, data) ⇒ Object
Constructor Details
#initialize(client) ⇒ Hoppers
Returns a new instance of Hoppers.
7 8 9 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 7 def initialize(client) @client = client end |
Instance Method Details
#buy(data) ⇒ Object
50 51 52 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 50 def buy(data) @client._request("POST", "/hopper/buy", body: data) end |
#config_get(hopper_id) ⇒ Object
58 59 60 61 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 58 def config_get(hopper_id) @client._request("GET", "/hopper/configget", params: { hopper_id: hopper_id }) end |
#config_pools(hopper_id) ⇒ Object
68 69 70 71 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 68 def config_pools(hopper_id) @client._request("GET", "/hopper/configpools", params: { hopper_id: hopper_id }) end |
#config_update(hopper_id, config) ⇒ Object
63 64 65 66 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 63 def config_update(hopper_id, config) @client._request("POST", "/hopper/configupdate", body: { hopper_id: hopper_id }.merge(config)) end |
#create(data) ⇒ Object
20 21 22 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 20 def create(data) @client._request("POST", "/hopper/create", body: data) end |
#delete(hopper_id) ⇒ Object
29 30 31 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 29 def delete(hopper_id) @client._request("POST", "/hopper/delete", body: { hopper_id: hopper_id }) end |
#get(hopper_id) ⇒ Object
16 17 18 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 16 def get(hopper_id) @client._request("GET", "/hopper/get", params: { hopper_id: hopper_id }) end |
#list(exchange: nil) ⇒ Object
11 12 13 14 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 11 def list(exchange: nil) params = exchange ? { exchange: exchange } : nil @client._request("GET", "/hopper/list", params: params) end |
#orders(hopper_id, **extra) ⇒ Object
45 46 47 48 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 45 def orders(hopper_id, **extra) @client._request("GET", "/hopper/orders", params: { hopper_id: hopper_id }.merge(extra)) end |
#panic(hopper_id) ⇒ Object
73 74 75 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 73 def panic(hopper_id) @client._request("POST", "/hopper/panic", body: { hopper_id: hopper_id }) end |
#position(hopper_id, position_id) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 38 def position(hopper_id, position_id) @client._request( "GET", "/hopper/position", params: { hopper_id: hopper_id, position_id: position_id } ) end |
#positions(hopper_id) ⇒ Object
33 34 35 36 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 33 def positions(hopper_id) @client._request("GET", "/hopper/positions", params: { hopper_id: hopper_id }) end |
#sell(data) ⇒ Object
54 55 56 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 54 def sell(data) @client._request("POST", "/hopper/sell", body: data) end |
#update(hopper_id, data) ⇒ Object
24 25 26 27 |
# File 'lib/cryptohopper/resources/hoppers.rb', line 24 def update(hopper_id, data) @client._request("POST", "/hopper/update", body: { hopper_id: hopper_id }.merge(data)) end |