diff --git a/README.md b/README.md index 3491b9adc..564cc374e 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,7 @@ Or install it yourself as: | Cryptopia | Y | Y | Y | | Y | | cryptopia | | | Crytrex | Y | Y [x] | | | Y | Y | crytrex | | | Currency | Y | | | | Y | Y | currency | | +| Curve | Y | | | | Y | | curve | | | Cybex | Y | | Y | | Y | | cybex | | | Dach.Exchange | Y | | | | Y | Y | dach_exchange | | | Dakuce | Y | Y | Y | | Y | | dakuce | | diff --git a/lib/cryptoexchange/exchanges/curve/authentication.rb b/lib/cryptoexchange/exchanges/curve/authentication.rb new file mode 100644 index 000000000..6569300da --- /dev/null +++ b/lib/cryptoexchange/exchanges/curve/authentication.rb @@ -0,0 +1,17 @@ +module Cryptoexchange::Exchanges + module Curve + class Authentication < Cryptoexchange::Services::Authentication + def api_key + HashHelper.dig(Cryptoexchange::Credentials.get(@exchange), 'api_key') + end + + def headers + # Do nothing, no headers override needed for API key only + end + + def required_credentials + %i(api_key) + end + end + end +end diff --git a/lib/cryptoexchange/exchanges/curve/market.rb b/lib/cryptoexchange/exchanges/curve/market.rb new file mode 100644 index 000000000..0524ac13b --- /dev/null +++ b/lib/cryptoexchange/exchanges/curve/market.rb @@ -0,0 +1,16 @@ +module Cryptoexchange::Exchanges + module Curve + class Market < Cryptoexchange::Models::Market + NAME = 'curve' + + def self.api_key + authentication = Cryptoexchange::Exchanges::Curve::Authentication.new( + :market, + Cryptoexchange::Exchanges::Curve::Market::NAME + ) + authentication.validate_credentials! + authentication.api_key + end + end + end +end diff --git a/lib/cryptoexchange/exchanges/curve/services/market.rb b/lib/cryptoexchange/exchanges/curve/services/market.rb new file mode 100644 index 000000000..03d0fb2ee --- /dev/null +++ b/lib/cryptoexchange/exchanges/curve/services/market.rb @@ -0,0 +1,62 @@ +module Cryptoexchange::Exchanges + module Curve + module Services + class Market < Cryptoexchange::Services::Market + class << self + def supports_individual_ticker_query? + true + end + end + + HOURS_24 = 24*60*60 + + def fetch(market_pair) + tokens_response = TheGraphClient::Client.query(TheGraphClient::TokensQuery) + tokens = tokens_response.data.tokens + + # Get the token information + # Decimals to calculate price, Id to pass into graphql + base_token = tokens.select { |token| token.symbol == market_pair.base_raw }.first + base_token_id = base_token.id + base_token_decimals = base_token.decimals.to_i + target_token = tokens.select { |token| token.symbol == market_pair.target_raw }.first + target_token_id = target_token.id + target_token_decimals = target_token.decimals.to_i + + # Get swaps from both direction + # Example, DAI-ETH and ETH-DAI + swaps_response = TheGraphClient::Client.query(TheGraphClient::SwapsQuery, variables: { fromToken: base_token_id, toToken: target_token_id, range_timestamp: Time.now.to_i - HOURS_24 }) + swaps_response_inverse = TheGraphClient::Client.query(TheGraphClient::SwapsQuery, variables: { fromToken: target_token_id, toToken: base_token_id, range_timestamp: Time.now.to_i - HOURS_24 }) + latest_swap = swaps_response.data.swaps.first + latest_swap_inverse = swaps_response_inverse.data.swaps.first + + # Put the latest swap from both side together so we can compare and get the latest of the two + latest_swaps = [] + latest_swaps << latest_swap if latest_swap + latest_swaps << latest_swap_inverse if latest_swap_inverse + last_swap = latest_swaps.max_by { |k| k.timestamp} + + if last_swap + last_price = 1.0 / last_swap.underlying_price.to_f + volume = swaps_response.data.swaps.map(&:from_token_amount).map { |s| s.to_f / 10**base_token_decimals }.sum + volume_inverse = swaps_response_inverse.data.swaps.map(&:to_token_amount).map { |s| s.to_f / 10**base_token_decimals }.sum + + adapt(last_price, market_pair, volume + volume_inverse) + end + end + + def adapt(last_price, market_pair, volume) + ticker = Cryptoexchange::Models::Ticker.new + ticker.base = market_pair.base + ticker.target = market_pair.target + ticker.market = Curve::Market::NAME + ticker.last = last_price.to_f + ticker.volume = volume.to_f + ticker.timestamp = nil + ticker.payload = { last_price: last_price, volume: volume } + ticker + end + end + end + end +end diff --git a/lib/cryptoexchange/exchanges/curve/services/pairs.rb b/lib/cryptoexchange/exchanges/curve/services/pairs.rb new file mode 100644 index 000000000..f2dce6602 --- /dev/null +++ b/lib/cryptoexchange/exchanges/curve/services/pairs.rb @@ -0,0 +1,29 @@ +module Cryptoexchange::Exchanges + module Curve + module Services + class Pairs < Cryptoexchange::Services::Pairs + def pairs_url + "https://api.blocklytics.org/pools/v1/pairs?platform=Curve&key=#{Cryptoexchange::Exchanges::Curve::Market.api_key}" + end + + def fetch + output = fetch_via_api(pairs_url) + adapt(output) + end + + def adapt(output) + market_pairs = [] + output.each do |pair| + base, target = pair["pair"].split("-") + market_pairs << Cryptoexchange::Models::MarketPair.new( + base: base, + target: target, + market: Curve::Market::NAME, + ) + end + market_pairs + end + end + end + end +end diff --git a/lib/cryptoexchange/exchanges/curve/the_graph_client.rb b/lib/cryptoexchange/exchanges/curve/the_graph_client.rb new file mode 100644 index 000000000..38224f52e --- /dev/null +++ b/lib/cryptoexchange/exchanges/curve/the_graph_client.rb @@ -0,0 +1,36 @@ +require "graphql/client" +require "graphql/client/http" + +module Cryptoexchange::Exchanges + module Curve + class TheGraphClient < Cryptoexchange::Models::Market + HTTP = GraphQL::Client::HTTP.new("https://api.thegraph.com/subgraphs/name/blocklytics/curve") do + end + Schema = GraphQL::Client.load_schema(HTTP) + Client = GraphQL::Client.new(schema: Schema, execute: HTTP) + + TokensQuery = Client.parse <<-'GRAPHQL' + query + { + tokens { + id + symbol + decimals + } + } + GRAPHQL + + SwapsQuery = Client.parse <<-'GRAPHQL' + query($fromToken: String!, $toToken: String!, $range_timestamp: BigInt!) + { + swaps(orderBy: timestamp, orderDirection: desc, where: { isUnderlyingSwap: false, fromToken: $fromToken, toToken: $toToken, timestamp_gte: $range_timestamp } ){ + fromTokenAmount, + toTokenAmount, + underlyingPrice, + timestamp + } + } + GRAPHQL + end + end +end diff --git a/spec/cassettes/vcr_cassettes/Curve/integration_specs_fetch_pairs.yml b/spec/cassettes/vcr_cassettes/Curve/integration_specs_fetch_pairs.yml new file mode 100644 index 000000000..1b6c3beb5 --- /dev/null +++ b/spec/cassettes/vcr_cassettes/Curve/integration_specs_fetch_pairs.yml @@ -0,0 +1,44 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.blocklytics.org/pools/v1/pairs?key=test_key&platform=Curve + body: + encoding: UTF-8 + string: '' + headers: + Connection: + - close + Host: + - api.blocklytics.org + User-Agent: + - http.rb/5.0.0.pre + response: + status: + code: 200 + message: OK + headers: + Date: + - Sun, 07 Jun 2020 06:11:18 GMT + Content-Type: + - application/json + Content-Length: + - '9318' + Vary: + - Accept-Encoding + Server: + - gunicorn/19.9.0 + Access-Control-Allow-Origin: + - "*" + Via: + - 1.1 google + Connection: + - close + body: + encoding: ASCII-8BIT + string: '[{"exchange":"0xa5407eae9ba41422680e2e00537571bcc53efbfd","id":"0xa5407eae9ba41422680e2e00537571bcc53efbfd-0x6b175474e89094c44da98b954eedeac495271d0f-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","pair":"DAI-USDC","platform":"Curve"},{"exchange":"0xa5407eae9ba41422680e2e00537571bcc53efbfd","id":"0xa5407eae9ba41422680e2e00537571bcc53efbfd-0x6b175474e89094c44da98b954eedeac495271d0f-0xdac17f958d2ee523a2206206994597c13d831ec7","pair":"DAI-USDT","platform":"Curve"},{"exchange":"0xa5407eae9ba41422680e2e00537571bcc53efbfd","id":"0xa5407eae9ba41422680e2e00537571bcc53efbfd-0x6b175474e89094c44da98b954eedeac495271d0f-0x57ab1ec28d129707052df4df418d58a2d46d5f51","pair":"DAI-sUSD","platform":"Curve"},{"exchange":"0xa5407eae9ba41422680e2e00537571bcc53efbfd","id":"0xa5407eae9ba41422680e2e00537571bcc53efbfd-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48-0x6b175474e89094c44da98b954eedeac495271d0f","pair":"USDC-DAI","platform":"Curve"},{"exchange":"0xa5407eae9ba41422680e2e00537571bcc53efbfd","id":"0xa5407eae9ba41422680e2e00537571bcc53efbfd-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48-0xdac17f958d2ee523a2206206994597c13d831ec7","pair":"USDC-USDT","platform":"Curve"},{"exchange":"0xa5407eae9ba41422680e2e00537571bcc53efbfd","id":"0xa5407eae9ba41422680e2e00537571bcc53efbfd-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48-0x57ab1ec28d129707052df4df418d58a2d46d5f51","pair":"USDC-sUSD","platform":"Curve"},{"exchange":"0xa5407eae9ba41422680e2e00537571bcc53efbfd","id":"0xa5407eae9ba41422680e2e00537571bcc53efbfd-0xdac17f958d2ee523a2206206994597c13d831ec7-0x6b175474e89094c44da98b954eedeac495271d0f","pair":"USDT-DAI","platform":"Curve"},{"exchange":"0xa5407eae9ba41422680e2e00537571bcc53efbfd","id":"0xa5407eae9ba41422680e2e00537571bcc53efbfd-0xdac17f958d2ee523a2206206994597c13d831ec7-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","pair":"USDT-USDC","platform":"Curve"},{"exchange":"0xa5407eae9ba41422680e2e00537571bcc53efbfd","id":"0xa5407eae9ba41422680e2e00537571bcc53efbfd-0xdac17f958d2ee523a2206206994597c13d831ec7-0x57ab1ec28d129707052df4df418d58a2d46d5f51","pair":"USDT-sUSD","platform":"Curve"},{"exchange":"0xa5407eae9ba41422680e2e00537571bcc53efbfd","id":"0xa5407eae9ba41422680e2e00537571bcc53efbfd-0x57ab1ec28d129707052df4df418d58a2d46d5f51-0x6b175474e89094c44da98b954eedeac495271d0f","pair":"sUSD-DAI","platform":"Curve"},{"exchange":"0xa5407eae9ba41422680e2e00537571bcc53efbfd","id":"0xa5407eae9ba41422680e2e00537571bcc53efbfd-0x57ab1ec28d129707052df4df418d58a2d46d5f51-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","pair":"sUSD-USDC","platform":"Curve"},{"exchange":"0xa5407eae9ba41422680e2e00537571bcc53efbfd","id":"0xa5407eae9ba41422680e2e00537571bcc53efbfd-0x57ab1ec28d129707052df4df418d58a2d46d5f51-0xdac17f958d2ee523a2206206994597c13d831ec7","pair":"sUSD-USDT","platform":"Curve"},{"exchange":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51","id":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51-0x16de59092dae5ccf4a1e6439d611fd0653f0bd01-0xd6ad7a6750a7593e092a9b218d66c0a814a3436e","pair":"yDAI-yUSDC","platform":"Curve"},{"exchange":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51","id":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51-0x16de59092dae5ccf4a1e6439d611fd0653f0bd01-0x83f798e925bcd4017eb265844fddabb448f1707d","pair":"yDAI-yUSDT","platform":"Curve"},{"exchange":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51","id":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51-0x16de59092dae5ccf4a1e6439d611fd0653f0bd01-0x73a052500105205d34daf004eab301916da8190f","pair":"yDAI-yTUSD","platform":"Curve"},{"exchange":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51","id":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51-0xd6ad7a6750a7593e092a9b218d66c0a814a3436e-0x16de59092dae5ccf4a1e6439d611fd0653f0bd01","pair":"yUSDC-yDAI","platform":"Curve"},{"exchange":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51","id":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51-0xd6ad7a6750a7593e092a9b218d66c0a814a3436e-0x83f798e925bcd4017eb265844fddabb448f1707d","pair":"yUSDC-yUSDT","platform":"Curve"},{"exchange":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51","id":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51-0xd6ad7a6750a7593e092a9b218d66c0a814a3436e-0x73a052500105205d34daf004eab301916da8190f","pair":"yUSDC-yTUSD","platform":"Curve"},{"exchange":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51","id":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51-0x83f798e925bcd4017eb265844fddabb448f1707d-0x16de59092dae5ccf4a1e6439d611fd0653f0bd01","pair":"yUSDT-yDAI","platform":"Curve"},{"exchange":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51","id":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51-0x83f798e925bcd4017eb265844fddabb448f1707d-0xd6ad7a6750a7593e092a9b218d66c0a814a3436e","pair":"yUSDT-yUSDC","platform":"Curve"},{"exchange":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51","id":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51-0x83f798e925bcd4017eb265844fddabb448f1707d-0x73a052500105205d34daf004eab301916da8190f","pair":"yUSDT-yTUSD","platform":"Curve"},{"exchange":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51","id":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51-0x73a052500105205d34daf004eab301916da8190f-0x16de59092dae5ccf4a1e6439d611fd0653f0bd01","pair":"yTUSD-yDAI","platform":"Curve"},{"exchange":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51","id":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51-0x73a052500105205d34daf004eab301916da8190f-0xd6ad7a6750a7593e092a9b218d66c0a814a3436e","pair":"yTUSD-yUSDC","platform":"Curve"},{"exchange":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51","id":"0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51-0x73a052500105205d34daf004eab301916da8190f-0x83f798e925bcd4017eb265844fddabb448f1707d","pair":"yTUSD-yUSDT","platform":"Curve"},{"exchange":"0x93054188d876f558f4a66b2ef1d97d16edf0895b","id":"0x93054188d876f558f4a66b2ef1d97d16edf0895b-0xeb4c2781e4eba804ce9a9803c67d0893436bb27d-0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","pair":"renBTC-WBTC","platform":"Curve"},{"exchange":"0x93054188d876f558f4a66b2ef1d97d16edf0895b","id":"0x93054188d876f558f4a66b2ef1d97d16edf0895b-0x2260fac5e5542a773aa44fbcfedf7c193bc2c599-0xeb4c2781e4eba804ce9a9803c67d0893436bb27d","pair":"WBTC-renBTC","platform":"Curve"},{"exchange":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27","id":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27-0xc2cb1040220768554cf699b0d863a3cd4324ce32-0x26ea744e5b887e5205727f55dfbe8685e3b21951","pair":"yDAI-yUSDC","platform":"Curve"},{"exchange":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27","id":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27-0xc2cb1040220768554cf699b0d863a3cd4324ce32-0xe6354ed5bc4b393a5aad09f21c46e101e692d447","pair":"yDAI-yUSDT","platform":"Curve"},{"exchange":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27","id":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27-0xc2cb1040220768554cf699b0d863a3cd4324ce32-0x04bc0ab673d88ae9dbc9da2380cb6b79c4bca9ae","pair":"yDAI-yBUSD","platform":"Curve"},{"exchange":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27","id":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27-0x26ea744e5b887e5205727f55dfbe8685e3b21951-0xc2cb1040220768554cf699b0d863a3cd4324ce32","pair":"yUSDC-yDAI","platform":"Curve"},{"exchange":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27","id":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27-0x26ea744e5b887e5205727f55dfbe8685e3b21951-0xe6354ed5bc4b393a5aad09f21c46e101e692d447","pair":"yUSDC-yUSDT","platform":"Curve"},{"exchange":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27","id":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27-0x26ea744e5b887e5205727f55dfbe8685e3b21951-0x04bc0ab673d88ae9dbc9da2380cb6b79c4bca9ae","pair":"yUSDC-yBUSD","platform":"Curve"},{"exchange":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27","id":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27-0xe6354ed5bc4b393a5aad09f21c46e101e692d447-0xc2cb1040220768554cf699b0d863a3cd4324ce32","pair":"yUSDT-yDAI","platform":"Curve"},{"exchange":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27","id":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27-0xe6354ed5bc4b393a5aad09f21c46e101e692d447-0x26ea744e5b887e5205727f55dfbe8685e3b21951","pair":"yUSDT-yUSDC","platform":"Curve"},{"exchange":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27","id":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27-0xe6354ed5bc4b393a5aad09f21c46e101e692d447-0x04bc0ab673d88ae9dbc9da2380cb6b79c4bca9ae","pair":"yUSDT-yBUSD","platform":"Curve"},{"exchange":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27","id":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27-0x04bc0ab673d88ae9dbc9da2380cb6b79c4bca9ae-0xc2cb1040220768554cf699b0d863a3cd4324ce32","pair":"yBUSD-yDAI","platform":"Curve"},{"exchange":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27","id":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27-0x04bc0ab673d88ae9dbc9da2380cb6b79c4bca9ae-0x26ea744e5b887e5205727f55dfbe8685e3b21951","pair":"yBUSD-yUSDC","platform":"Curve"},{"exchange":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27","id":"0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27-0x04bc0ab673d88ae9dbc9da2380cb6b79c4bca9ae-0xe6354ed5bc4b393a5aad09f21c46e101e692d447","pair":"yBUSD-yUSDT","platform":"Curve"},{"exchange":"0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56","id":"0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56-0x5d3a536e4d6dbd6114cc1ead35777bab948e3643-0x39aa39c021dfbae8fac545936693ac917d5e7563","pair":"cDAI-cUSDC","platform":"Curve"},{"exchange":"0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56","id":"0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56-0x39aa39c021dfbae8fac545936693ac917d5e7563-0x5d3a536e4d6dbd6114cc1ead35777bab948e3643","pair":"cUSDC-cDAI","platform":"Curve"}] + + ' + http_version: + recorded_at: Sun, 07 Jun 2020 06:11:09 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/cassettes/vcr_cassettes/Curve/integration_specs_fetch_ticker.yml b/spec/cassettes/vcr_cassettes/Curve/integration_specs_fetch_ticker.yml new file mode 100644 index 000000000..252b9fe20 --- /dev/null +++ b/spec/cassettes/vcr_cassettes/Curve/integration_specs_fetch_ticker.yml @@ -0,0 +1,161 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.thegraph.com/subgraphs/name/blocklytics/curve + body: + encoding: UTF-8 + string: '{"query":"query Cryptoexchange__Exchanges__Curve__TheGraphClient__TokensQuery + {\n tokens {\n id\n symbol\n name\n decimals\n }\n}","operationName":"Cryptoexchange__Exchanges__Curve__TheGraphClient__TokensQuery"}' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - application/json + User-Agent: + - Ruby + Content-Type: + - application/json + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx/1.19.0 + Date: + - Sun, 07 Jun 2020 06:11:19 GMT + Content-Type: + - application/json + Content-Length: + - '2551' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - Content-Type, User-Agent + Access-Control-Allow-Methods: + - GET, OPTIONS, POST + Via: + - 1.1 google + Alt-Svc: + - clear + body: + encoding: UTF-8 + string: '{"data":{"tokens":[{"decimals":"18","id":"0x0000000000085d4780b73119b644ae5ecd22b376","name":"TrueUSD","symbol":"TUSD"},{"decimals":"18","id":"0x04bc0ab673d88ae9dbc9da2380cb6b79c4bca9ae","name":"iearn + BUSD","symbol":"yBUSD"},{"decimals":"18","id":"0x16de59092dae5ccf4a1e6439d611fd0653f0bd01","name":"iearn + DAI","symbol":"yDAI"},{"decimals":"8","id":"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","name":"Wrapped + BTC","symbol":"WBTC"},{"decimals":"6","id":"0x26ea744e5b887e5205727f55dfbe8685e3b21951","name":"iearn + USDC","symbol":"yUSDC"},{"decimals":"8","id":"0x39aa39c021dfbae8fac545936693ac917d5e7563","name":"Compound + USD Coin","symbol":"cUSDC"},{"decimals":"18","id":"0x3b3ac5386837dc563660fb6a0937dfaa5924333b","name":"Curve.fi + yDAI/yUSDC/yUSDT/yBUSD","symbol":"yDAI+yUSDC+yUSDT+yBUSD"},{"decimals":"18","id":"0x49849c98ae39fff122806c06791fa73784fb3675","name":"Curve.fi + renBTC/wBTC","symbol":"crvRenWBTC"},{"decimals":"18","id":"0x4fabb145d64652a948d72533023f6e7a623c7c53","name":"Binance + USD","symbol":"BUSD"},{"decimals":"18","id":"0x57ab1ec28d129707052df4df418d58a2d46d5f51","name":"Synth + sUSD","symbol":"sUSD"},{"decimals":"8","id":"0x5d3a536e4d6dbd6114cc1ead35777bab948e3643","name":"Compound + Dai","symbol":"cDAI"},{"decimals":"18","id":"0x6b175474e89094c44da98b954eedeac495271d0f","name":"Dai + Stablecoin","symbol":"DAI"},{"decimals":"18","id":"0x73a052500105205d34daf004eab301916da8190f","name":"iearn + TUSD","symbol":"yTUSD"},{"decimals":"6","id":"0x83f798e925bcd4017eb265844fddabb448f1707d","name":"iearn + USDT","symbol":"yUSDT"},{"decimals":"18","id":"0x845838df265dcd2c412a1dc9e959c7d08537f8a2","name":"Curve.fi + cDAI/cUSDC","symbol":"cDAI+cUSDC"},{"decimals":"6","id":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","name":"USD//C","symbol":"USDC"},{"decimals":"18","id":"0xc25a3a3b969415c80451098fa907ec722572917f","name":"Curve.fi + DAI/USDC/USDT/sUSD","symbol":"crvPlain3andSUSD"},{"decimals":"18","id":"0xc2cb1040220768554cf699b0d863a3cd4324ce32","name":"iearn + DAI","symbol":"yDAI"},{"decimals":"6","id":"0xd6ad7a6750a7593e092a9b218d66c0a814a3436e","name":"iearn + USDC","symbol":"yUSDC"},{"decimals":"6","id":"0xdac17f958d2ee523a2206206994597c13d831ec7","name":"Tether + USD","symbol":"USDT"},{"decimals":"18","id":"0xdf5e0e81dff6faf3a7e52ba697820c5e32d806a8","name":"Curve.fi + yDAI/yUSDC/yUSDT/yTUSD","symbol":"yDAI+yUSDC+yUSDT+yTUSD"},{"decimals":"6","id":"0xe6354ed5bc4b393a5aad09f21c46e101e692d447","name":"iearn + USDT","symbol":"yUSDT"},{"decimals":"8","id":"0xeb4c2781e4eba804ce9a9803c67d0893436bb27d","name":"renBTC","symbol":"renBTC"}]}}' + http_version: + recorded_at: Tue, 04 Feb 2020 00:00:00 GMT +- request: + method: post + uri: https://api.thegraph.com/subgraphs/name/blocklytics/curve + body: + encoding: UTF-8 + string: '{"query":"query Cryptoexchange__Exchanges__Curve__TheGraphClient__SwapsQuery($fromToken: + String!, $toToken: String!, $range_timestamp: BigInt!) {\n swaps(orderBy: + timestamp, orderDirection: desc, where: {isUnderlyingSwap: false, fromToken: + $fromToken, toToken: $toToken, timestamp_gte: $range_timestamp}) {\n isUnderlyingSwap\n fromToken + {\n symbol\n }\n fromTokenAmount\n toToken {\n symbol\n }\n toTokenAmount\n underlyingPrice\n timestamp\n }\n}","variables":{"fromToken":"0x6b175474e89094c44da98b954eedeac495271d0f","toToken":"0xdac17f958d2ee523a2206206994597c13d831ec7","range_timestamp":1580688000},"operationName":"Cryptoexchange__Exchanges__Curve__TheGraphClient__SwapsQuery"}' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - application/json + User-Agent: + - Ruby + Content-Type: + - application/json + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx/1.19.0 + Date: + - Sun, 07 Jun 2020 06:11:19 GMT + Content-Type: + - application/json + Content-Length: + - '23727' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - Content-Type, User-Agent + Access-Control-Allow-Methods: + - GET, OPTIONS, POST + Via: + - 1.1 google + Alt-Svc: + - clear + body: + encoding: UTF-8 + string: '{"data":{"swaps":[{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"800000000000000000000","isUnderlyingSwap":false,"timestamp":"1591466059","toToken":{"symbol":"USDT"},"toTokenAmount":"802263093","underlyingPrice":"0.9971791136601618541612258860323767"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"58242000000000000000000","isUnderlyingSwap":false,"timestamp":"1591457146","toToken":{"symbol":"USDT"},"toTokenAmount":"58407123723","underlyingPrice":"0.9971728838457597882284952318366708"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3000000000000000000","isUnderlyingSwap":false,"timestamp":"1591422510","toToken":{"symbol":"USDT"},"toTokenAmount":"3009633","underlyingPrice":"0.9967992775198836535883278791799532"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"410000000000000000000","isUnderlyingSwap":false,"timestamp":"1591421822","toToken":{"symbol":"USDT"},"toTokenAmount":"411317197","underlyingPrice":"0.9967976126220659818412600920257657"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1394000000000000000000","isUnderlyingSwap":false,"timestamp":"1591420111","toToken":{"symbol":"USDT"},"toTokenAmount":"1398456050","underlyingPrice":"0.996813593105053247829990795920973"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"6000000000000000000000","isUnderlyingSwap":false,"timestamp":"1591378494","toToken":{"symbol":"USDT"},"toTokenAmount":"6019573410","underlyingPrice":"0.9967483725727999718837219064664584"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"878731925040409638515","isUnderlyingSwap":false,"timestamp":"1591373714","toToken":{"symbol":"USDT"},"toTokenAmount":"881266909","underlyingPrice":"0.9971234776505260093851997794688556"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"200000000000000000000","isUnderlyingSwap":false,"timestamp":"1591365803","toToken":{"symbol":"USDT"},"toTokenAmount":"200574846","underlyingPrice":"0.9971340075215613028564907884810242"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"2000000000000000000000","isUnderlyingSwap":false,"timestamp":"1591353198","toToken":{"symbol":"USDT"},"toTokenAmount":"2006098133","underlyingPrice":"0.9969602020461079807006629620346693"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"100000000000000000","isUnderlyingSwap":false,"timestamp":"1591344645","toToken":{"symbol":"USDT"},"toTokenAmount":"100289","underlyingPrice":"0.9971183280319875559632661607953016"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"400000000000000000000","isUnderlyingSwap":false,"timestamp":"1591336963","toToken":{"symbol":"USDT"},"toTokenAmount":"401155811","underlyingPrice":"0.9971187978129525337973977398024031"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1283285068357890693509","isUnderlyingSwap":false,"timestamp":"1591327726","toToken":{"symbol":"USDT"},"toTokenAmount":"1286739481","underlyingPrice":"0.9973153752619569256140668617597193"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1484461870611157586115","isUnderlyingSwap":false,"timestamp":"1591324267","toToken":{"symbol":"USDT"},"toTokenAmount":"1488538853","underlyingPrice":"0.9972610843307007627801570054147589"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1880000000000000000000","isUnderlyingSwap":false,"timestamp":"1591297388","toToken":{"symbol":"USDT"},"toTokenAmount":"1884486898","underlyingPrice":"0.9976190346535378247028810067110374"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3416351001806572017202","isUnderlyingSwap":false,"timestamp":"1591295344","toToken":{"symbol":"USDT"},"toTokenAmount":"3424682786","underlyingPrice":"0.9975671369542638911147316988324419"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1500000000000000000000","isUnderlyingSwap":false,"timestamp":"1591288092","toToken":{"symbol":"USDT"},"toTokenAmount":"1503848265","underlyingPrice":"0.9974410549989895423392332736441332"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"400000000000000000000","isUnderlyingSwap":false,"timestamp":"1591273336","toToken":{"symbol":"USDT"},"toTokenAmount":"401098281","underlyingPrice":"0.9972618157393698727918507334615079"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"100000000000000000000","isUnderlyingSwap":false,"timestamp":"1591247765","toToken":{"symbol":"USDT"},"toTokenAmount":"100204384","underlyingPrice":"0.9979603287616637611384348213746816"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"200000000000000000000","isUnderlyingSwap":false,"timestamp":"1591204763","toToken":{"symbol":"USDT"},"toTokenAmount":"200308845","underlyingPrice":"0.9984581559541217463462484644649616"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"640000000000000000000","isUnderlyingSwap":false,"timestamp":"1591194501","toToken":{"symbol":"USDT"},"toTokenAmount":"641033617","underlyingPrice":"0.9983875775425986746651385055208423"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"500690000000000000000","isUnderlyingSwap":false,"timestamp":"1591183082","toToken":{"symbol":"USDT"},"toTokenAmount":"501630456","underlyingPrice":"0.9981252015527542051792804223194933"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"10000000000000000000","isUnderlyingSwap":false,"timestamp":"1591175970","toToken":{"symbol":"USDT"},"toTokenAmount":"10018469","underlyingPrice":"0.9981565047513746860922562120020534"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"277368066093489225537","isUnderlyingSwap":false,"timestamp":"1591144665","toToken":{"symbol":"USDT"},"toTokenAmount":"277667598","underlyingPrice":"0.9989212572562723920599478805589696"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"369311621749870880885","isUnderlyingSwap":false,"timestamp":"1591141945","toToken":{"symbol":"USDT"},"toTokenAmount":"369772716","underlyingPrice":"0.9987530333359448858985042044043076"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"51000000000000000000","isUnderlyingSwap":false,"timestamp":"1591127582","toToken":{"symbol":"USDT"},"toTokenAmount":"51070172","underlyingPrice":"0.998625968990274792886932121552283"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"28866738936835994487725","isUnderlyingSwap":false,"timestamp":"1591126099","toToken":{"symbol":"USDT"},"toTokenAmount":"28910225097","underlyingPrice":"0.9984958207686692121269926617202637"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"29015220129655283009306","isUnderlyingSwap":false,"timestamp":"1591125421","toToken":{"symbol":"USDT"},"toTokenAmount":"29065683975","underlyingPrice":"0.9982637998339167936028589535368056"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"25000000000000000000000","isUnderlyingSwap":false,"timestamp":"1591125280","toToken":{"symbol":"USDT"},"toTokenAmount":"25048866882","underlyingPrice":"0.9980491380216837067544283498739702"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"14132556524677552893295","isUnderlyingSwap":false,"timestamp":"1591124616","toToken":{"symbol":"USDT"},"toTokenAmount":"14162408983","underlyingPrice":"0.9978921341448138642060708521765756"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"15000000000000000000000","isUnderlyingSwap":false,"timestamp":"1591124314","toToken":{"symbol":"USDT"},"toTokenAmount":"15033459815","underlyingPrice":"0.9977743104107934850657662798295776"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"2000000000000000000000","isUnderlyingSwap":false,"timestamp":"1591114448","toToken":{"symbol":"USDT"},"toTokenAmount":"2002883128","underlyingPrice":"0.9985605111153545050982126002511316"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"117843592538393278560542","isUnderlyingSwap":false,"timestamp":"1591114140","toToken":{"symbol":"USDT"},"toTokenAmount":"118065844278","underlyingPrice":"0.9981175610866475199927761448265108"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"23505025871850653648319","isUnderlyingSwap":false,"timestamp":"1591109698","toToken":{"symbol":"USDT"},"toTokenAmount":"23627689630","underlyingPrice":"0.9948084742913839286079618272012997"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"51000000000000000000","isUnderlyingSwap":false,"timestamp":"1591050118","toToken":{"symbol":"USDT"},"toTokenAmount":"51033730","underlyingPrice":"0.9993390645755268133448211604364408"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3453309063912865675665","isUnderlyingSwap":false,"timestamp":"1591046572","toToken":{"symbol":"USDT"},"toTokenAmount":"3456757454","underlyingPrice":"0.9990024205825768867106057594979876"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1450000000000000000000","isUnderlyingSwap":false,"timestamp":"1591037630","toToken":{"symbol":"USDT"},"toTokenAmount":"1451444826","underlyingPrice":"0.9990045601636944344999856026218664"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"11099000000000000000000","isUnderlyingSwap":false,"timestamp":"1591026029","toToken":{"symbol":"USDT"},"toTokenAmount":"11111153150","underlyingPrice":"0.9989062206383142149381677814421989"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"10044185910655841382538","isUnderlyingSwap":false,"timestamp":"1591024394","toToken":{"symbol":"USDT"},"toTokenAmount":"10055861765","underlyingPrice":"0.9988389006713679086198138484454395"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"9699894016406245253186","isUnderlyingSwap":false,"timestamp":"1591022704","toToken":{"symbol":"USDT"},"toTokenAmount":"9711717318","underlyingPrice":"0.9987825735442442223261177503725196"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"349109479729798775708","isUnderlyingSwap":false,"timestamp":"1591022586","toToken":{"symbol":"USDT"},"toTokenAmount":"349548137","underlyingPrice":"0.9987450733568028591953273663134986"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3438761005594251137259","isUnderlyingSwap":false,"timestamp":"1591006099","toToken":{"symbol":"USDT"},"toTokenAmount":"3443294201","underlyingPrice":"0.9986834713674967610643038398913738"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3000000000000000000000","isUnderlyingSwap":false,"timestamp":"1590981870","toToken":{"symbol":"USDT"},"toTokenAmount":"3003416703","underlyingPrice":"0.9988623946199049955806282269317192"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"239327233840054236310","isUnderlyingSwap":false,"timestamp":"1590973141","toToken":{"symbol":"USDT"},"toTokenAmount":"239671330","underlyingPrice":"0.998564299868717031402963383229859"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"334958830343155994999","isUnderlyingSwap":false,"timestamp":"1590969735","toToken":{"symbol":"USDT"},"toTokenAmount":"335456755","underlyingPrice":"0.9985156815314569980831061219798659"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3449649802766320509125","isUnderlyingSwap":false,"timestamp":"1590899189","toToken":{"symbol":"USDT"},"toTokenAmount":"3450236303","underlyingPrice":"0.9998300115753899158729592672771781"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"231780361674538769119","isUnderlyingSwap":false,"timestamp":"1590893110","toToken":{"symbol":"USDT"},"toTokenAmount":"231868375","underlyingPrice":"0.99962041686167321920895853089064"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1121629906239147612137","isUnderlyingSwap":false,"timestamp":"1590880326","toToken":{"symbol":"USDT"},"toTokenAmount":"1123009492","underlyingPrice":"0.9987715279606448884200526419058976"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3404571504297309558599","isUnderlyingSwap":false,"timestamp":"1590849877","toToken":{"symbol":"USDT"},"toTokenAmount":"3406577876","underlyingPrice":"0.9994110301376564093551930294987919"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"7000000000000000000000","isUnderlyingSwap":false,"timestamp":"1590847801","toToken":{"symbol":"USDT"},"toTokenAmount":"7004652126","underlyingPrice":"0.9993358519571968248234459145501896"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3402814636899709938867","isUnderlyingSwap":false,"timestamp":"1590838421","toToken":{"symbol":"USDT"},"toTokenAmount":"3406691426","underlyingPrice":"0.9988620075564513247073878067170736"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3459577066941823623429","isUnderlyingSwap":false,"timestamp":"1590828938","toToken":{"symbol":"USDT"},"toTokenAmount":"3465742437","underlyingPrice":"0.9982210535923398809191428670497017"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"510909255244405216069","isUnderlyingSwap":false,"timestamp":"1590765893","toToken":{"symbol":"USDT"},"toTokenAmount":"511216837","underlyingPrice":"0.9993983340662256319014782371105668"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1326443176072108016292","isUnderlyingSwap":false,"timestamp":"1590765401","toToken":{"symbol":"USDT"},"toTokenAmount":"1327307463","underlyingPrice":"0.9993488419586381970731072428242649"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1267600000000000000000","isUnderlyingSwap":false,"timestamp":"1590758226","toToken":{"symbol":"USDT"},"toTokenAmount":"1268753493","underlyingPrice":"0.9990908454586615274051505606377077"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"28380588428498953253447","isUnderlyingSwap":false,"timestamp":"1590715610","toToken":{"symbol":"USDT"},"toTokenAmount":"28420952909","underlyingPrice":"0.9985797632954008161981223597262602"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3427521468751439151496","isUnderlyingSwap":false,"timestamp":"1590715476","toToken":{"symbol":"USDT"},"toTokenAmount":"3432862975","underlyingPrice":"0.9984440083139173801412798889824608"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3453407085770159634384","isUnderlyingSwap":false,"timestamp":"1590714593","toToken":{"symbol":"USDT"},"toTokenAmount":"3459634235","underlyingPrice":"0.9982000556108381886167801782086366"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"249000000000000000000","isUnderlyingSwap":false,"timestamp":"1590693740","toToken":{"symbol":"USDT"},"toTokenAmount":"249381501","underlyingPrice":"0.9984702113088973668499974262325095"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"169270000000000000000","isUnderlyingSwap":false,"timestamp":"1590681295","toToken":{"symbol":"USDT"},"toTokenAmount":"169515298","underlyingPrice":"0.9985529447613630717860048241781695"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"165852733608920899033","isUnderlyingSwap":false,"timestamp":"1590670952","toToken":{"symbol":"USDT"},"toTokenAmount":"166091965","underlyingPrice":"0.9985596450070351027095139731774502"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"404004675682749419861","isUnderlyingSwap":false,"timestamp":"1590670916","toToken":{"symbol":"USDT"},"toTokenAmount":"404588462","underlyingPrice":"0.9985570860959189188667471194470197"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3399811341987125344461","isUnderlyingSwap":false,"timestamp":"1590632824","toToken":{"symbol":"USDT"},"toTokenAmount":"3405070578","underlyingPrice":"0.9984554693089610738931943512860719"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"3412710046943223337635","isUnderlyingSwap":false,"timestamp":"1590632246","toToken":{"symbol":"USDT"},"toTokenAmount":"3418094065","underlyingPrice":"0.998424847896403148763256753731264"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"464370000000000000000","isUnderlyingSwap":false,"timestamp":"1590628011","toToken":{"symbol":"USDT"},"toTokenAmount":"465114271","underlyingPrice":"0.9983998104414216092715847886765874"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"171390000000000000000","isUnderlyingSwap":false,"timestamp":"1590583302","toToken":{"symbol":"USDT"},"toTokenAmount":"171726563","underlyingPrice":"0.9980401226570871275167837604715818"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"270397968610456902861","isUnderlyingSwap":false,"timestamp":"1590539809","toToken":{"symbol":"USDT"},"toTokenAmount":"270870549","underlyingPrice":"0.99825532753085276487921173002828"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"155374000000000000000","isUnderlyingSwap":false,"timestamp":"1590525560","toToken":{"symbol":"USDT"},"toTokenAmount":"155661047","underlyingPrice":"0.9981559484178466305703314458626248"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"10374000000000000000000","isUnderlyingSwap":false,"timestamp":"1590515665","toToken":{"symbol":"USDT"},"toTokenAmount":"10390010851","underlyingPrice":"0.9984590149876061953306231441201408"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"65770781994891443520594","isUnderlyingSwap":false,"timestamp":"1590506996","toToken":{"symbol":"USDT"},"toTokenAmount":"65830524597","underlyingPrice":"0.9990924787175206705970342823576877"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"111390098432026664327368","isUnderlyingSwap":false,"timestamp":"1590506877","toToken":{"symbol":"USDT"},"toTokenAmount":"111646991996","underlyingPrice":"0.9976990552151862770134348546358843"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"531465809797586766822","isUnderlyingSwap":false,"timestamp":"1590489481","toToken":{"symbol":"USDT"},"toTokenAmount":"532967754","underlyingPrice":"0.9971819229378495698296974266852174"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"19000000000000000000000","isUnderlyingSwap":false,"timestamp":"1590449106","toToken":{"symbol":"USDT"},"toTokenAmount":"19047995029","underlyingPrice":"0.9974803107137035152152548369924294"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1500000000000000000000","isUnderlyingSwap":false,"timestamp":"1590423743","toToken":{"symbol":"USDT"},"toTokenAmount":"1503172330","underlyingPrice":"0.9978895766395593511224358420700839"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"11647190000000000000000","isUnderlyingSwap":false,"timestamp":"1590416197","toToken":{"symbol":"USDT"},"toTokenAmount":"11682456821","underlyingPrice":"0.9969812153778642243354883442800101"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"5000000000000000000000","isUnderlyingSwap":false,"timestamp":"1590416120","toToken":{"symbol":"USDT"},"toTokenAmount":"5015502004","underlyingPrice":"0.9969091819746783616278662741014827"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"5000000000000000000000","isUnderlyingSwap":false,"timestamp":"1590415933","toToken":{"symbol":"USDT"},"toTokenAmount":"5015720647","underlyingPrice":"0.9968657251656543462995617666423837"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"192522505539189469796","isUnderlyingSwap":false,"timestamp":"1590403497","toToken":{"symbol":"USDT"},"toTokenAmount":"193048718","underlyingPrice":"0.9972741986258073456670144786975483"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"235190000000000000000","isUnderlyingSwap":false,"timestamp":"1590339239","toToken":{"symbol":"USDT"},"toTokenAmount":"235704590","underlyingPrice":"0.9978168011068431039039163386678214"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1937909009745823012856","isUnderlyingSwap":false,"timestamp":"1590337650","toToken":{"symbol":"USDT"},"toTokenAmount":"1942191068","underlyingPrice":"0.9977952435655125836754182827907022"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"388297599405511062324","isUnderlyingSwap":false,"timestamp":"1590311689","toToken":{"symbol":"USDT"},"toTokenAmount":"389042307","underlyingPrice":"0.998085792776031071407357246624594"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"601277171904533502792","isUnderlyingSwap":false,"timestamp":"1590284927","toToken":{"symbol":"USDT"},"toTokenAmount":"602881933","underlyingPrice":"0.9973381834690566233836700493726688"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"301524509293236318042","isUnderlyingSwap":false,"timestamp":"1590284678","toToken":{"symbol":"USDT"},"toTokenAmount":"302330406","underlyingPrice":"0.9973343842009603163831295222088909"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"409741332449382845558","isUnderlyingSwap":false,"timestamp":"1590284565","toToken":{"symbol":"USDT"},"toTokenAmount":"410837698","underlyingPrice":"0.9973313900940581298797950133582922"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"499990000000000000000","isUnderlyingSwap":false,"timestamp":"1590270241","toToken":{"symbol":"USDT"},"toTokenAmount":"501476028","underlyingPrice":"0.9970366918515993350733008517806957"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"450000000000000000000","isUnderlyingSwap":false,"timestamp":"1590264947","toToken":{"symbol":"USDT"},"toTokenAmount":"451334135","underlyingPrice":"0.997044019282964272135100084995787"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"172060000000000000000","isUnderlyingSwap":false,"timestamp":"1590261258","toToken":{"symbol":"USDT"},"toTokenAmount":"172583890","underlyingPrice":"0.9969644327752723617482489240449963"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"246000000000000000000","isUnderlyingSwap":false,"timestamp":"1590261217","toToken":{"symbol":"USDT"},"toTokenAmount":"246749451","underlyingPrice":"0.9969627044884488922327936608053487"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"698182546057177077159","isUnderlyingSwap":false,"timestamp":"1590255268","toToken":{"symbol":"USDT"},"toTokenAmount":"700321299","underlyingPrice":"0.9969460404161962767306895802407974"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"376341164984102954471","isUnderlyingSwap":false,"timestamp":"1590254241","toToken":{"symbol":"USDT"},"toTokenAmount":"377493431","underlyingPrice":"0.9969475865769514661329298734207642"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1905901544898190274111","isUnderlyingSwap":false,"timestamp":"1590211147","toToken":{"symbol":"USDT"},"toTokenAmount":"1912147928","underlyingPrice":"0.9967333159687372650339215805692623"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1838383772104569759439","isUnderlyingSwap":false,"timestamp":"1590186316","toToken":{"symbol":"USDT"},"toTokenAmount":"1845770054","underlyingPrice":"0.9959982653963730194091663381163513"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"378180000000000000000","isUnderlyingSwap":false,"timestamp":"1590185107","toToken":{"symbol":"USDT"},"toTokenAmount":"379713322","underlyingPrice":"0.9959618956956163892506252387952825"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1000000000000000","isUnderlyingSwap":false,"timestamp":"1590155978","toToken":{"symbol":"USDT"},"toTokenAmount":"1003","underlyingPrice":"0.9970089730807577268195413758723829"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"425660000000000000000","isUnderlyingSwap":false,"timestamp":"1590111768","toToken":{"symbol":"USDT"},"toTokenAmount":"427260530","underlyingPrice":"0.996253971786254162068281851356595"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1508040000000000000000","isUnderlyingSwap":false,"timestamp":"1589961945","toToken":{"symbol":"USDT"},"toTokenAmount":"1513640187","underlyingPrice":"0.9963001861022866724402052361734764"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1228260000000000000000","isUnderlyingSwap":false,"timestamp":"1589901360","toToken":{"symbol":"USDT"},"toTokenAmount":"1233079077","underlyingPrice":"0.9960918345871827650839298119077565"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"10000000000000000000000","isUnderlyingSwap":false,"timestamp":"1589888425","toToken":{"symbol":"USDT"},"toTokenAmount":"10037646982","underlyingPrice":"0.9962494215957673734415857343806316"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"137240000000000000000","isUnderlyingSwap":false,"timestamp":"1589869645","toToken":{"symbol":"USDT"},"toTokenAmount":"137761835","underlyingPrice":"0.9962120495854312625844451041175519"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1699980000000000000000","isUnderlyingSwap":false,"timestamp":"1589852288","toToken":{"symbol":"USDT"},"toTokenAmount":"1706569936","underlyingPrice":"0.9961384905118825437928024064288919"},{"fromToken":{"symbol":"DAI"},"fromTokenAmount":"1000000000000000000000","isUnderlyingSwap":false,"timestamp":"1589799341","toToken":{"symbol":"USDT"},"toTokenAmount":"1004924050","underlyingPrice":"0.9951000774635655301512586946247331"}]}}' + http_version: + recorded_at: Tue, 04 Feb 2020 00:00:00 GMT +- request: + method: post + uri: https://api.thegraph.com/subgraphs/name/blocklytics/curve + body: + encoding: UTF-8 + string: '{"query":"query Cryptoexchange__Exchanges__Curve__TheGraphClient__SwapsQuery($fromToken: + String!, $toToken: String!, $range_timestamp: BigInt!) {\n swaps(orderBy: + timestamp, orderDirection: desc, where: {isUnderlyingSwap: false, fromToken: + $fromToken, toToken: $toToken, timestamp_gte: $range_timestamp}) {\n isUnderlyingSwap\n fromToken + {\n symbol\n }\n fromTokenAmount\n toToken {\n symbol\n }\n toTokenAmount\n underlyingPrice\n timestamp\n }\n}","variables":{"fromToken":"0xdac17f958d2ee523a2206206994597c13d831ec7","toToken":"0x6b175474e89094c44da98b954eedeac495271d0f","range_timestamp":1580688000},"operationName":"Cryptoexchange__Exchanges__Curve__TheGraphClient__SwapsQuery"}' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - application/json + User-Agent: + - Ruby + Content-Type: + - application/json + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx/1.19.0 + Date: + - Sun, 07 Jun 2020 06:11:20 GMT + Content-Type: + - application/json + Content-Length: + - '23547' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - Content-Type, User-Agent + Access-Control-Allow-Methods: + - GET, OPTIONS, POST + Via: + - 1.1 google + Alt-Svc: + - clear + body: + encoding: UTF-8 + string: '{"data":{"swaps":[{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"91340000","isUnderlyingSwap":false,"timestamp":"1591499359","toToken":{"symbol":"DAI"},"toTokenAmount":"91001178450358376701","underlyingPrice":"1.003723265516022435282951226627783"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"282733745","isUnderlyingSwap":false,"timestamp":"1591481987","toToken":{"symbol":"DAI"},"toTokenAmount":"281653860882866733101","underlyingPrice":"1.003834082422120126727689208511983"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"190280000","isUnderlyingSwap":false,"timestamp":"1591446032","toToken":{"symbol":"DAI"},"toTokenAmount":"189548280117945447648","underlyingPrice":"1.0038603351167272179868174690999"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"81089936","isUnderlyingSwap":false,"timestamp":"1591407134","toToken":{"symbol":"DAI"},"toTokenAmount":"80764443318432868386","underlyingPrice":"1.004030148270617057808057104040207"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"535250000","isUnderlyingSwap":false,"timestamp":"1591397093","toToken":{"symbol":"DAI"},"toTokenAmount":"533232246866101472410","underlyingPrice":"1.003784004335366462184159214679915"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"301300000","isUnderlyingSwap":false,"timestamp":"1591378890","toToken":{"symbol":"DAI"},"toTokenAmount":"300087201942154198064","underlyingPrice":"1.004041485441553701788253345565036"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"155000000","isUnderlyingSwap":false,"timestamp":"1591362287","toToken":{"symbol":"DAI"},"toTokenAmount":"154433746317488405875","underlyingPrice":"1.003666644732864777714145433612675"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3474590908","isUnderlyingSwap":false,"timestamp":"1591361566","toToken":{"symbol":"DAI"},"toTokenAmount":"3461998423741442614990","underlyingPrice":"1.003637345462725100172148486896307"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"2833153","isUnderlyingSwap":false,"timestamp":"1591342664","toToken":{"symbol":"DAI"},"toTokenAmount":"2822745615765050439","underlyingPrice":"1.003686972066070800149758375354113"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"25500000000","isUnderlyingSwap":false,"timestamp":"1591333017","toToken":{"symbol":"DAI"},"toTokenAmount":"25409132963301730956032","underlyingPrice":"1.003576156527241909369676874386536"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"79000000","isUnderlyingSwap":false,"timestamp":"1591324617","toToken":{"symbol":"DAI"},"toTokenAmount":"78721143456612156315","underlyingPrice":"1.003542333496991667772808888365222"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"75800000","isUnderlyingSwap":false,"timestamp":"1591323734","toToken":{"symbol":"DAI"},"toTokenAmount":"75526887891793415641","underlyingPrice":"1.003616091114436877463084991718312"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1009670599","isUnderlyingSwap":false,"timestamp":"1591321486","toToken":{"symbol":"DAI"},"toTokenAmount":"1006404128692681061320","underlyingPrice":"1.003245684525919109185009672775566"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1741060000","isUnderlyingSwap":false,"timestamp":"1591321049","toToken":{"symbol":"DAI"},"toTokenAmount":"1735444863907451529357","underlyingPrice":"1.00323556006262606149754902918886"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1500000000","isUnderlyingSwap":false,"timestamp":"1591320016","toToken":{"symbol":"DAI"},"toTokenAmount":"1495180029197501384493","underlyingPrice":"1.003223672540012193887586713993021"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"946000000","isUnderlyingSwap":false,"timestamp":"1591319875","toToken":{"symbol":"DAI"},"toTokenAmount":"942968631959336835429","underlyingPrice":"1.003214707189532349935576150569088"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"357520000","isUnderlyingSwap":false,"timestamp":"1591319718","toToken":{"symbol":"DAI"},"toTokenAmount":"356376145077920039401","underlyingPrice":"1.003209684312146824167854298659479"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1000000000","isUnderlyingSwap":false,"timestamp":"1591313961","toToken":{"symbol":"DAI"},"toTokenAmount":"996807597882020984707","underlyingPrice":"1.003202626188606618121989257250601"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"832350000","isUnderlyingSwap":false,"timestamp":"1591292265","toToken":{"symbol":"DAI"},"toTokenAmount":"829607215736275861109","underlyingPrice":"1.003306123924307866164950312664022"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3410925494","isUnderlyingSwap":false,"timestamp":"1591284297","toToken":{"symbol":"DAI"},"toTokenAmount":"3399521472038594184366","underlyingPrice":"1.003354596243972877523888932697566"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"207520000","isUnderlyingSwap":false,"timestamp":"1591276393","toToken":{"symbol":"DAI"},"toTokenAmount":"206821446362161727601","underlyingPrice":"1.003377568671553753152944681632262"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"159420000","isUnderlyingSwap":false,"timestamp":"1591238541","toToken":{"symbol":"DAI"},"toTokenAmount":"158969617490124245817","underlyingPrice":"1.002833135771391873264369716585138"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"140514302","isUnderlyingSwap":false,"timestamp":"1591235685","toToken":{"symbol":"DAI"},"toTokenAmount":"140116609908145816342","underlyingPrice":"1.002838293704899746070399551702172"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"134454121","isUnderlyingSwap":false,"timestamp":"1591229468","toToken":{"symbol":"DAI"},"toTokenAmount":"134141451554428797399","underlyingPrice":"1.002330893560103864446840825579004"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3000000000","isUnderlyingSwap":false,"timestamp":"1591224303","toToken":{"symbol":"DAI"},"toTokenAmount":"2993552410775257846649","underlyingPrice":"1.002153825402065495592153934345303"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"178760000","isUnderlyingSwap":false,"timestamp":"1591221512","toToken":{"symbol":"DAI"},"toTokenAmount":"178376915105559458285","underlyingPrice":"1.002147614752804984126387832704532"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"592810000","isUnderlyingSwap":false,"timestamp":"1591218970","toToken":{"symbol":"DAI"},"toTokenAmount":"591522500786928829152","underlyingPrice":"1.002176585356192457737621274524233"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1136340000","isUnderlyingSwap":false,"timestamp":"1591209683","toToken":{"symbol":"DAI"},"toTokenAmount":"1133680651041684633258","underlyingPrice":"1.002345765499192227430418500372129"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"658970000","isUnderlyingSwap":false,"timestamp":"1591198582","toToken":{"symbol":"DAI"},"toTokenAmount":"657379873224277917414","underlyingPrice":"1.00241888570138742282185801894659"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"122900000","isUnderlyingSwap":false,"timestamp":"1591197217","toToken":{"symbol":"DAI"},"toTokenAmount":"122603919860938468403","underlyingPrice":"1.002414932078822241169644069985355"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3000000000","isUnderlyingSwap":false,"timestamp":"1591192614","toToken":{"symbol":"DAI"},"toTokenAmount":"2992830423279884544246","underlyingPrice":"1.002395584014498962747913417196394"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"104304749","isUnderlyingSwap":false,"timestamp":"1591181643","toToken":{"symbol":"DAI"},"toTokenAmount":"104025755821612477850","underlyingPrice":"1.002681962521531213853568334203885"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"280310000","isUnderlyingSwap":false,"timestamp":"1591152494","toToken":{"symbol":"DAI"},"toTokenAmount":"279589335760036337987","underlyingPrice":"1.002577581287228307798618925602204"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"6061395","isUnderlyingSwap":false,"timestamp":"1591148455","toToken":{"symbol":"DAI"},"toTokenAmount":"6049511459022388163","underlyingPrice":"1.001964380274028316066411647967967"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1703110123","isUnderlyingSwap":false,"timestamp":"1591144345","toToken":{"symbol":"DAI"},"toTokenAmount":"1699921094673689252652","underlyingPrice":"1.001875986089179569696895041568954"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3421231405","isUnderlyingSwap":false,"timestamp":"1591143080","toToken":{"symbol":"DAI"},"toTokenAmount":"3414192287655279164347","underlyingPrice":"1.002061722583749083316116566155867"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"2896037514","isUnderlyingSwap":false,"timestamp":"1591138791","toToken":{"symbol":"DAI"},"toTokenAmount":"2890189154399739524497","underlyingPrice":"1.002023521398714512656173491530502"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"274770461","isUnderlyingSwap":false,"timestamp":"1591138388","toToken":{"symbol":"DAI"},"toTokenAmount":"274218846481377191770","underlyingPrice":"1.00201158500117995934942173533898"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"716825207","isUnderlyingSwap":false,"timestamp":"1591137939","toToken":{"symbol":"DAI"},"toTokenAmount":"715388810215942589078","underlyingPrice":"1.002007854698794952607449633000702"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"256946666","isUnderlyingSwap":false,"timestamp":"1591134543","toToken":{"symbol":"DAI"},"toTokenAmount":"256436627231662703286","underlyingPrice":"1.001988946640904506821782727806216"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"162000000","isUnderlyingSwap":false,"timestamp":"1591132974","toToken":{"symbol":"DAI"},"toTokenAmount":"161675314333536944095","underlyingPrice":"1.002008257524047411638077507283153"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"200000000","isUnderlyingSwap":false,"timestamp":"1591126453","toToken":{"symbol":"DAI"},"toTokenAmount":"199562047119517896068","underlyingPrice":"1.00219456999366123731725223694221"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"45429422","isUnderlyingSwap":false,"timestamp":"1591122787","toToken":{"symbol":"DAI"},"toTokenAmount":"45284028342804463060","underlyingPrice":"1.003210705021534147294691649320336"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"4000401761","isUnderlyingSwap":false,"timestamp":"1591115130","toToken":{"symbol":"DAI"},"toTokenAmount":"3983261241993314900614","underlyingPrice":"1.004303137044083905527783929159567"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3448951157","isUnderlyingSwap":false,"timestamp":"1591104255","toToken":{"symbol":"DAI"},"toTokenAmount":"3428319330306525181131","underlyingPrice":"1.006018058618719783130832197830442"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3459438057","isUnderlyingSwap":false,"timestamp":"1591102325","toToken":{"symbol":"DAI"},"toTokenAmount":"3439632798167891883079","underlyingPrice":"1.005757957315285898324733949469395"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3442144054","isUnderlyingSwap":false,"timestamp":"1591095166","toToken":{"symbol":"DAI"},"toTokenAmount":"3426708780684398910879","underlyingPrice":"1.004504401833796416575495616561241"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"2292972172","isUnderlyingSwap":false,"timestamp":"1591094547","toToken":{"symbol":"DAI"},"toTokenAmount":"2282980113921121348813","underlyingPrice":"1.004376760891586059685974259837623"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1830084158","isUnderlyingSwap":false,"timestamp":"1591094260","toToken":{"symbol":"DAI"},"toTokenAmount":"1822389951089239345644","underlyingPrice":"1.004222041998290124510674007289782"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3428112263","isUnderlyingSwap":false,"timestamp":"1591089536","toToken":{"symbol":"DAI"},"toTokenAmount":"3415352264042961404812","underlyingPrice":"1.003736071119625535740703128033528"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3433461540","isUnderlyingSwap":false,"timestamp":"1591089207","toToken":{"symbol":"DAI"},"toTokenAmount":"3420790971093134573063","underlyingPrice":"1.003703988058298829504996342601718"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3441600257","isUnderlyingSwap":false,"timestamp":"1591088889","toToken":{"symbol":"DAI"},"toTokenAmount":"3429009259726329630578","underlyingPrice":"1.003671905299746919056691126865417"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3401355704","isUnderlyingSwap":false,"timestamp":"1591088603","toToken":{"symbol":"DAI"},"toTokenAmount":"3389019555717957139018","underlyingPrice":"1.003640034552538742193457959804006"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3305723431","isUnderlyingSwap":false,"timestamp":"1591085118","toToken":{"symbol":"DAI"},"toTokenAmount":"3294917779595963481294","underlyingPrice":"1.003279490453737984506568736171836"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1100000000","isUnderlyingSwap":false,"timestamp":"1591080004","toToken":{"symbol":"DAI"},"toTokenAmount":"1096687434446052826839","underlyingPrice":"1.003020519292828755063415814230273"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3445713699","isUnderlyingSwap":false,"timestamp":"1591076764","toToken":{"symbol":"DAI"},"toTokenAmount":"3436071575936627806411","underlyingPrice":"1.002806147325596347036211141580495"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3425905316","isUnderlyingSwap":false,"timestamp":"1591076050","toToken":{"symbol":"DAI"},"toTokenAmount":"3416547775799122800144","underlyingPrice":"1.00273888755988155100798140821594"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3465458329","isUnderlyingSwap":false,"timestamp":"1591075710","toToken":{"symbol":"DAI"},"toTokenAmount":"3456105722085029007373","underlyingPrice":"1.002706111348158838141359740262512"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1650000000","isUnderlyingSwap":false,"timestamp":"1591064942","toToken":{"symbol":"DAI"},"toTokenAmount":"1647955244803430374164","underlyingPrice":"1.001240783208777933849224813097127"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3428437793","isUnderlyingSwap":false,"timestamp":"1591063176","toToken":{"symbol":"DAI"},"toTokenAmount":"3424326297072377407920","underlyingPrice":"1.00120067294145937824590945758829"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"39662819636","isUnderlyingSwap":false,"timestamp":"1591062166","toToken":{"symbol":"DAI"},"toTokenAmount":"39621760655630186303258","underlyingPrice":"1.001036273494423304581424970197535"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"596830000","isUnderlyingSwap":false,"timestamp":"1591058976","toToken":{"symbol":"DAI"},"toTokenAmount":"596154364409697465054","underlyingPrice":"1.001133323230756749591238671543749"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"6958959","isUnderlyingSwap":false,"timestamp":"1591055198","toToken":{"symbol":"DAI"},"toTokenAmount":"6951261678336861920","underlyingPrice":"1.001107327276590128047189231193978"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"300000000","isUnderlyingSwap":false,"timestamp":"1591043584","toToken":{"symbol":"DAI"},"toTokenAmount":"299448623179415918515","underlyingPrice":"1.001841306915122203495840849855312"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"271830000","isUnderlyingSwap":false,"timestamp":"1591034687","toToken":{"symbol":"DAI"},"toTokenAmount":"271346206201521517010","underlyingPrice":"1.001782939239324327865320165932897"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"200000000","isUnderlyingSwap":false,"timestamp":"1591020476","toToken":{"symbol":"DAI"},"toTokenAmount":"199575967749761491080","underlyingPrice":"1.002124665885474658667993383208967"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"25000000000","isUnderlyingSwap":false,"timestamp":"1591013252","toToken":{"symbol":"DAI"},"toTokenAmount":"24948450159308538158466","underlyingPrice":"1.002066254230715331035595192310896"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"148544000","isUnderlyingSwap":false,"timestamp":"1591008685","toToken":{"symbol":"DAI"},"toTokenAmount":"148264525513385867749","underlyingPrice":"1.001884972050100415047878694637573"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"10000","isUnderlyingSwap":false,"timestamp":"1590964970","toToken":{"symbol":"DAI"},"toTokenAmount":"9976610800241337","underlyingPrice":"1.002344403347687694575524495237824"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"10000","isUnderlyingSwap":false,"timestamp":"1590964295","toToken":{"symbol":"DAI"},"toTokenAmount":"9976611478397831","underlyingPrice":"1.002344335213695724793824652946914"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"120600000","isUnderlyingSwap":false,"timestamp":"1590946120","toToken":{"symbol":"DAI"},"toTokenAmount":"120356587211085222290","underlyingPrice":"1.002022430134944526097264954945425"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"500000000","isUnderlyingSwap":false,"timestamp":"1590943559","toToken":{"symbol":"DAI"},"toTokenAmount":"499018678289045019271","underlyingPrice":"1.001966502966020387800574788004236"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"500000000","isUnderlyingSwap":false,"timestamp":"1590940349","toToken":{"symbol":"DAI"},"toTokenAmount":"499244641914613474753","underlyingPrice":"1.001513001887190439233275427091092"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1189304244","isUnderlyingSwap":false,"timestamp":"1590929428","toToken":{"symbol":"DAI"},"toTokenAmount":"1187519646948885072485","underlyingPrice":"1.001502793705940043875627030840727"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3015000000","isUnderlyingSwap":false,"timestamp":"1590871882","toToken":{"symbol":"DAI"},"toTokenAmount":"3010524382105780043487","underlyingPrice":"1.001486657248425732180172478100758"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"108800790","isUnderlyingSwap":false,"timestamp":"1590868655","toToken":{"symbol":"DAI"},"toTokenAmount":"108637732102211682381","underlyingPrice":"1.001500932453513525004241993332286"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"5667653","isUnderlyingSwap":false,"timestamp":"1590825416","toToken":{"symbol":"DAI"},"toTokenAmount":"5652771122495191263","underlyingPrice":"1.002632669390343142592840067798532"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"2485985090","isUnderlyingSwap":false,"timestamp":"1590810989","toToken":{"symbol":"DAI"},"toTokenAmount":"2478938814336908756118","underlyingPrice":"1.002842456466589334467341888132089"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"963731539","isUnderlyingSwap":false,"timestamp":"1590810836","toToken":{"symbol":"DAI"},"toTokenAmount":"961014645079998733675","underlyingPrice":"1.002827109798909569292908174735181"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"14820473","isUnderlyingSwap":false,"timestamp":"1590744770","toToken":{"symbol":"DAI"},"toTokenAmount":"14799101772384952542","underlyingPrice":"1.001444089509197514833642761996995"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1000000000","isUnderlyingSwap":false,"timestamp":"1590718223","toToken":{"symbol":"DAI"},"toTokenAmount":"997955260841198753582","underlyingPrice":"1.002048928683514018617677910116918"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"47000000","isUnderlyingSwap":false,"timestamp":"1590709640","toToken":{"symbol":"DAI"},"toTokenAmount":"46872064164366129231","underlyingPrice":"1.002729468776652091773147067048049"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3469992728","isUnderlyingSwap":false,"timestamp":"1590705365","toToken":{"symbol":"DAI"},"toTokenAmount":"3461229254952908336250","underlyingPrice":"1.002531896156416514211061088437545"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"100000000","isUnderlyingSwap":false,"timestamp":"1590695179","toToken":{"symbol":"DAI"},"toTokenAmount":"99767225979838473579","underlyingPrice":"1.002333171218056786646123333691208"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"180100000","isUnderlyingSwap":false,"timestamp":"1590691761","toToken":{"symbol":"DAI"},"toTokenAmount":"179680598184632311418","underlyingPrice":"1.00233415193184479893384317861633"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"4742884","isUnderlyingSwap":false,"timestamp":"1590681955","toToken":{"symbol":"DAI"},"toTokenAmount":"4732237064529451181","underlyingPrice":"1.002249873648628694468894164149794"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3471088318","isUnderlyingSwap":false,"timestamp":"1590680499","toToken":{"symbol":"DAI"},"toTokenAmount":"3463256136852076679093","underlyingPrice":"1.00226150791002203331035573015569"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"699000000","isUnderlyingSwap":false,"timestamp":"1590674761","toToken":{"symbol":"DAI"},"toTokenAmount":"697340125890817240042","underlyingPrice":"1.002380293414296722920090170379741"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"602760000","isUnderlyingSwap":false,"timestamp":"1590624581","toToken":{"symbol":"DAI"},"toTokenAmount":"601617534147095982110","underlyingPrice":"1.001898990285453821312568029154176"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"602800000","isUnderlyingSwap":false,"timestamp":"1590621736","toToken":{"symbol":"DAI"},"toTokenAmount":"601678734646008234495","underlyingPrice":"1.00186356154776095077952045180081"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"574970000","isUnderlyingSwap":false,"timestamp":"1590599106","toToken":{"symbol":"DAI"},"toTokenAmount":"573763847422140168184","underlyingPrice":"1.002102175979331822373486873939119"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"507679400","isUnderlyingSwap":false,"timestamp":"1590593060","toToken":{"symbol":"DAI"},"toTokenAmount":"506294241196474183595","underlyingPrice":"1.002735877066767360665851617908061"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1644000000","isUnderlyingSwap":false,"timestamp":"1590588580","toToken":{"symbol":"DAI"},"toTokenAmount":"1639645394656459847881","underlyingPrice":"1.002655821409758256546751225123946"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"900000000","isUnderlyingSwap":false,"timestamp":"1590580302","toToken":{"symbol":"DAI"},"toTokenAmount":"897661642394288347866","underlyingPrice":"1.002604943216103861745534698637475"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1968810883","isUnderlyingSwap":false,"timestamp":"1590573045","toToken":{"symbol":"DAI"},"toTokenAmount":"1963609027989070721087","underlyingPrice":"1.002649129707993088321885313061285"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"3700000000","isUnderlyingSwap":false,"timestamp":"1590541192","toToken":{"symbol":"DAI"},"toTokenAmount":"3690533102605425935276","underlyingPrice":"1.002565184251535548386298913781986"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1953034603","isUnderlyingSwap":false,"timestamp":"1590538069","toToken":{"symbol":"DAI"},"toTokenAmount":"1948082641845533634556","underlyingPrice":"1.002541966674357860120632310713555"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1976753245","isUnderlyingSwap":false,"timestamp":"1590525203","toToken":{"symbol":"DAI"},"toTokenAmount":"1971492630791316006134","underlyingPrice":"1.002668340792413965598817657247615"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1964930410","isUnderlyingSwap":false,"timestamp":"1590524711","toToken":{"symbol":"DAI"},"toTokenAmount":"1959736371544797712225","underlyingPrice":"1.002650376107020962635060049001"},{"fromToken":{"symbol":"USDT"},"fromTokenAmount":"1951035497","isUnderlyingSwap":false,"timestamp":"1590524042","toToken":{"symbol":"DAI"},"toTokenAmount":"1945922076443780422953","underlyingPrice":"1.002627762240903539453093652134831"}]}}' + http_version: + recorded_at: Tue, 04 Feb 2020 00:00:00 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/exchanges/curve/integration/market_spec.rb b/spec/exchanges/curve/integration/market_spec.rb new file mode 100644 index 000000000..5591a1594 --- /dev/null +++ b/spec/exchanges/curve/integration/market_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper' + +RSpec.describe 'Curve integration specs' do + let(:client) { Cryptoexchange::Client.new } + let(:pair) { Cryptoexchange::Models::MarketPair.new(base: 'DAI', target: 'USDT', market: 'curve') } + + let(:filename) { Cryptoexchange::Credentials.send(:filename) } + + before do + allow(Cryptoexchange::Credentials).to receive(:get).with('curve').and_return({ 'api_key' => 'test_key' }) + end + + it 'fetch pairs' do + pairs = client.pairs('curve') + expect(pairs).not_to be_empty + + pair = pairs.first + expect(pair.base).not_to be_nil + expect(pair.target).not_to be_nil + expect(pair.market).to eq 'curve' + end + + it 'fetch ticker' do + allow(Time).to receive(:now).and_return(Time.utc(2020, 2, 4)) + + ticker = client.ticker(pair) + + expect(ticker.base).to eq 'DAI' + expect(ticker.target).to eq 'USDT' + expect(ticker.market).to eq 'curve' + expect(ticker.last).to eq 0.9962905457670066 + expect(ticker.volume).to eq 921922.257751789 + expect(ticker.timestamp).to be nil + + expect(ticker.payload).to_not be nil + end +end diff --git a/spec/exchanges/curve/market_spec.rb b/spec/exchanges/curve/market_spec.rb new file mode 100644 index 000000000..48a3a0cda --- /dev/null +++ b/spec/exchanges/curve/market_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +RSpec.describe Cryptoexchange::Exchanges::Curve::Market do + it { expect(described_class::NAME).to eq 'curve' } +end