Module: Naming

Defined in:
lib/deribit/naming.rb

Class Method Summary collapse

Class Method Details

.book_channel(options) ⇒ Object



18
19
20
# File 'lib/deribit/naming.rb', line 18

def self.book_channel(options)
  'book' + for_instrument(options) + with_group_and_depth(options) + with_interval(options)
end

.cancel_uri(options) ⇒ Object



34
35
36
# File 'lib/deribit/naming.rb', line 34

def self.cancel_uri(options)
  "/private/cancel_all" + by_instrument(options) + by_currency(options)
end

.channel(prefix, options) ⇒ Object



22
23
24
# File 'lib/deribit/naming.rb', line 22

def self.channel(prefix, options)
  prefix + channel_suffix(options)
end

.channel_for_instrument(prefix, options) ⇒ Object



26
27
28
# File 'lib/deribit/naming.rb', line 26

def self.channel_for_instrument(prefix, options)
  prefix + for_instrument(options)
end

.instrument_with_interval(prefix, options) ⇒ Object



30
31
32
# File 'lib/deribit/naming.rb', line 30

def self.instrument_with_interval(prefix, options)
  prefix + for_instrument(options) + with_interval(options)
end

.trades_channel(options) ⇒ Object



4
5
6
7
8
# File 'lib/deribit/naming.rb', line 4

def self.trades_channel(options)
  private = options.delete :private
  trades = private ? 'user.trades' : 'trades'
  channel trades, options
end

.trades_uri(options) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/deribit/naming.rb', line 10

def self.trades_uri(options)
  private = options.delete :private
  uri = private ? 'private/get_user_trades' : 'public/get_last_trades'
  uri += options[:instrument_name] ? '_by_instrument' : '_by_currency'
  uri += options[:end_timestamp] ? '_and_time' : ''
  uri
end