Skip to content

Commit

Permalink
Fix FTX Futures funding rate mapping (coingecko#1849)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmlee authored Oct 25, 2019
1 parent bd996cc commit a8090cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/cryptoexchange/exchanges/ftx/services/contract_stat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def adapt(open_interest, index, market_pair)
contract_stat.start_timestamp = start_timestamp
contract_stat.contract_type = contract_type(index['result']['type'])

contract_stat.funding_rate_percentage = nil
contract_stat.funding_rate_percentage = open_interest['result']['nextFundingRate'] ? open_interest['result']['nextFundingRate'] * 100 : nil
contract_stat.next_funding_rate_timestamp = open_interest['result']['nextFundingTime'] ? DateTime.parse(open_interest['result']['nextFundingTime']).to_time.to_i : nil
contract_stat.funding_rate_percentage_predicted = open_interest['result']['nextFundingRate'] ? open_interest['result']['nextFundingRate'] * 100 : nil
contract_stat.funding_rate_percentage_predicted = nil

contract_stat
end
Expand Down
4 changes: 2 additions & 2 deletions spec/exchanges/ftx/integration/market_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
expect(contract_stat.expire_timestamp).to be nil
expect(contract_stat.start_timestamp).to be nil
expect(contract_stat.contract_type).to eq 'perpetual'
expect(contract_stat.funding_rate_percentage).to be nil
expect(contract_stat.funding_rate_percentage_predicted).to be_a Numeric
expect(contract_stat.funding_rate_percentage).to be_a Numeric
expect(contract_stat.funding_rate_percentage_predicted).to be nil
expect(2018..Date.today.year).to include(Time.at(contract_stat.next_funding_rate_timestamp).year)
end

Expand Down

0 comments on commit a8090cd

Please sign in to comment.