lib/cryptum/api.rb in cryptum-0.0.333 vs lib/cryptum/api.rb in cryptum-0.0.334
- old
+ new
@@ -84,13 +84,11 @@
api_key = env[:api_key]
api_secret = env[:api_secret]
api_passphrase = env[:api_passphrase]
api_endpoint = 'https://api.exchange.coinbase.com'
- api_endpoint = 'https://api-public.sandbox.pro.coinbase.com' if env[:env] == :sandbox
- # api_endpoint = 'https://api.pro.coinbase.com'
- # api_endpoint = 'https://api-public.sandbox.pro.coinbase.com' if env[:env] == :sandbox
+ api_endpoint = 'https://api-public.sandbox.exchange.coinbase.com' if env[:env] == :sandbox
api_endpoint = opts[:api_endpoint] if opts[:api_endpoint]
http_method = if opts[:http_method].nil?
:GET
else
@@ -407,34 +405,34 @@
event_history
rescue StandardError => e
raise e
end
- public_class_method def self.cancel_open_order(opts = {})
- env = opts[:env]
- option_choice = opts[:option_choice]
- order_id = opts[:order_id]
- order_type = opts[:order_type]
+ # public_class_method def self.cancel_open_order(opts = {})
+ # env = opts[:env]
+ # option_choice = opts[:option_choice]
+ # order_id = opts[:order_id]
+ # order_type = opts[:order_type]
- product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
+ # product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
- order_hash = {}
- order_hash[:product_id] = product_id
+ # order_hash = {}
+ # order_hash[:product_id] = product_id
- params = order_hash
+ # params = order_hash
- rest_api_call(
- env: env,
- http_method: :DELETE,
- api_call: "/orders/#{order_id}",
- option_choice: option_choice,
- params: params,
- order_type: order_type
- )
- rescue StandardError => e
- raise e
- end
+ # rest_api_call(
+ # env: env,
+ # http_method: :DELETE,
+ # api_call: "/orders/#{order_id}",
+ # option_choice: option_choice,
+ # params: params,
+ # order_type: order_type
+ # )
+ # rescue StandardError => e
+ # raise e
+ # end
public_class_method def self.cancel_all_open_orders(opts = {})
env = opts[:env]
option_choice = opts[:option_choice]
event_notes = opts[:event_notes]
@@ -488,11 +486,11 @@
sorted_products
rescue StandardError => e
raise e
end
- public_class_method def self.get_exchange_rates(opts = {})
+ private_class_method def self.get_exchange_rates(opts = {})
option_choice = opts[:option_choice]
env = opts[:env]
api_endpoint = 'https://api.coinbase.com/v2'
exchange_rates_api_call = '/exchange-rates'
@@ -588,35 +586,35 @@
fees
rescue StandardError => e
raise e
end
- public_class_method def self.get_profiles(opts = {})
- option_choice = opts[:option_choice]
- env = opts[:env]
+ # public_class_method def self.get_profiles(opts = {})
+ # option_choice = opts[:option_choice]
+ # env = opts[:env]
- profiles_api_call = '/profiles'
+ # profiles_api_call = '/profiles'
- # We don't always get fees back from Coinbase...
- # This is a hack to ensure we do.
- profiles = {}
- # loop do
- profiles = rest_api_call(
- option_choice: option_choice,
- env: env,
- http_method: :GET,
- api_call: profiles_api_call
- )
+ # # We don't always get fees back from Coinbase...
+ # # This is a hack to ensure we do.
+ # profiles = {}
+ # # loop do
+ # profiles = rest_api_call(
+ # option_choice: option_choice,
+ # env: env,
+ # http_method: :GET,
+ # api_call: profiles_api_call
+ # )
- # break unless fees.empty?
+ # # break unless fees.empty?
- # sleep 0.3
- # end
+ # # sleep 0.3
+ # # end
- profiles
- rescue StandardError => e
- raise e
- end
+ # profiles
+ # rescue StandardError => e
+ # raise e
+ # end
public_class_method def self.get_order_history(opts = {})
option_choice = opts[:option_choice]
env = opts[:env]