lib/cryptum/api.rb in cryptum-0.0.299 vs lib/cryptum/api.rb in cryptum-0.0.300
- old
+ new
@@ -209,11 +209,11 @@
f.puts "PARAMS: #{params.inspect}"
f.puts "HTTP POST BODY: #{http_body.inspect}" if http_body != ''
f.puts "#{e}\n#{e.response}\n\n\n"
end
- insufficient_funds = '{"message":"Insufficient funds"}'
+ insufficient_funds = '{"message":"Insufficient funds"}'
size -= base_increment if e.response == insufficient_funds
sleep 0.3
retry
rescue RestClient::TooManyRequests => e
@@ -359,11 +359,10 @@
current_crypto_fiat_value = format(
'%0.2f',
balance.to_f * price.to_f
)
-
order_hash = {}
order_hash[:type] = 'limit'
order_hash[:time_in_force] = 'GTT'
order_hash[:cancel_after] = 'min'
@@ -525,11 +524,11 @@
# Retrieve Exchange Rates
exchange_rates = get_exchange_rates(
option_choice: option_choice,
env: env
)
-
+
portfolio_complete_arr = []
portfolio_complete_arr = rest_api_call(
option_choice: option_choice,
env: env,
http_method: :GET,
@@ -599,16 +598,16 @@
# 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
- )
+ profiles = rest_api_call(
+ option_choice: option_choice,
+ env: env,
+ http_method: :GET,
+ api_call: profiles_api_call
+ )
# break unless fees.empty?
# sleep 0.3
# end
@@ -644,14 +643,14 @@
order_history.each do |order|
order[:created_at] = Time.parse(
order[:created_at]
).localtime.to_s
- if order[:done_at]
- order[:done_at] = Time.parse(
- order[:done_at]
- ).localtime.to_s
- end
+ next unless order[:done_at]
+
+ order[:done_at] = Time.parse(
+ order[:done_at]
+ ).localtime.to_s
end
order_history
rescue StandardError => e
raise e