class Kucoin::Api::Endpoints::Base
Attributes
client[R]
Public Class Methods
new(client)
click to toggle source
# File lib/kucoin/api/endpoints/base.rb, line 7 def initialize client @client = client end
Public Instance Methods
assert_param_is_one_of(options, param, valid_values)
click to toggle source
# File lib/kucoin/api/endpoints/base.rb, line 37 def assert_param_is_one_of options, param, valid_values return if valid_values.include? options[param].to_s raise Kucoin::Api::InvalidParamError.new("#{param} must be one of #{valid_values.inspect}") end
assert_required_param(options, param, valid_values=nil)
click to toggle source
# File lib/kucoin/api/endpoints/base.rb, line 32 def assert_required_param options, param, valid_values=nil raise Kucoin::Api::MissingParamError.new("#{param} is required") unless options.has_key?(param) assert_param_is_one_of options, param, valid_values if valid_values end
auth()
click to toggle source
# File lib/kucoin/api/endpoints/base.rb, line 15 def auth client.auth(self) end
open()
click to toggle source
# File lib/kucoin/api/endpoints/base.rb, line 11 def open client.open(self) end
path()
click to toggle source
# File lib/kucoin/api/endpoints/base.rb, line 19 def path self.class.name .gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2') .gsub(/([a-z\d])([A-Z])/,'\1_\2') .tr('-', '_') .downcase.split('::')[3..-1].join('::') end
url(action)
click to toggle source
# File lib/kucoin/api/endpoints/base.rb, line 27 def url action path_array = path.split('::').map(&:to_sym) path_array.reduce(Kucoin::Api::ENDPOINTS) { |m, k| m.fetch(k, {}) }[action] end
Private Instance Methods
account_types()
click to toggle source
# File lib/kucoin/api/endpoints/base.rb, line 52 def account_types %w(main trade) end
order_types()
click to toggle source
# File lib/kucoin/api/endpoints/base.rb, line 48 def order_types %w(limit market) end
side_types()
click to toggle source
# File lib/kucoin/api/endpoints/base.rb, line 44 def side_types %w(buy sell) end