Class: Cryptohopper::Resources::Strategies

Inherits:
Object
  • Object
show all
Defined in:
lib/cryptohopper/resources/strategy.rb

Overview

‘client.strategy` — user-defined trading strategies.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Strategies

Returns a new instance of Strategies.



7
8
9
# File 'lib/cryptohopper/resources/strategy.rb', line 7

def initialize(client)
  @client = client
end

Instance Method Details

#create(data) ⇒ Object



20
21
22
# File 'lib/cryptohopper/resources/strategy.rb', line 20

def create(data)
  @client._request("POST", "/strategy/create", body: data)
end

#delete(strategy_id) ⇒ Object



29
30
31
32
# File 'lib/cryptohopper/resources/strategy.rb', line 29

def delete(strategy_id)
  @client._request("POST", "/strategy/delete",
                   body: { strategy_id: strategy_id })
end

#get(strategy_id) ⇒ Object



15
16
17
18
# File 'lib/cryptohopper/resources/strategy.rb', line 15

def get(strategy_id)
  @client._request("GET", "/strategy/get",
                   params: { strategy_id: strategy_id })
end

#listObject



11
12
13
# File 'lib/cryptohopper/resources/strategy.rb', line 11

def list
  @client._request("GET", "/strategy/strategies")
end

#update(strategy_id, data) ⇒ Object



24
25
26
27
# File 'lib/cryptohopper/resources/strategy.rb', line 24

def update(strategy_id, data)
  @client._request("POST", "/strategy/edit",
                   body: { strategy_id: strategy_id }.merge(data))
end