Skip to content

Commit

Permalink
Fix warnings from Big Decimal
Browse files Browse the repository at this point in the history
  • Loading branch information
StragaSevera authored and JacobPlaster committed Feb 5, 2020
1 parent f9c8248 commit 7b5f0a0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/models/funding_offer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def to_new_order_packet
data = {
:type => @type,
:symbol => @symbol,
:amount => BigDecimal.new(@amount, 8).to_s,
:rate => BigDecimal.new(@rate, 8).to_s,
:amount => BigDecimal(@amount, 8).to_s,
:rate => BigDecimal(@rate, 8).to_s,
:period => 2
}
if !@flags.nil?
Expand Down
10 changes: 5 additions & 5 deletions lib/models/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def to_new_order_packet
:cid => cid,
:symbol => @symbol,
:type => @type,
:amount => BigDecimal.new(@amount, 8).to_s,
:amount => BigDecimal(@amount, 8).to_s,
:flags => @flags || 0,
:meta => @meta
}
Expand All @@ -184,14 +184,14 @@ def to_new_order_packet
data[:lev] = @lev
end

data[:price] = BigDecimal.new(@price, 5).to_s if !@price.nil?
data[:price_trailing] = BigDecimal.new(@price_trailing, 5).to_s if !@price_trailing.nil?
data[:price] = BigDecimal(@price, 5).to_s if !@price.nil?
data[:price_trailing] = BigDecimal(@price_trailing, 5).to_s if !@price_trailing.nil?

if !@price_aux_limit.nil?
if is_oco
data[:price_oco_stop] = BigDecimal.new(@price_aux_limit, 5).to_s
data[:price_oco_stop] = BigDecimal(@price_aux_limit, 5).to_s
else
data[:price_aux_limit] = BigDecimal.new(@price_aux_limit, 5).to_s
data[:price_aux_limit] = BigDecimal(@price_aux_limit, 5).to_s
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rest/v2/funding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def close_funding(funding)
# @return [Array] Raw notification
###
def submit_funding_auto(currency, amount, period, rate='0', status=1)
dec_amount = BigDecimal.new(amount, 8).to_s
dec_amount = BigDecimal(amount, 8).to_s
payload = { :status => status, :currency => currency, :amount => dec_amount, :period => period, :rate => rate }
authenticated_post("auth/w/funding/auto", params: payload).body
end
Expand Down

0 comments on commit 7b5f0a0

Please sign in to comment.