from web3 import Web3
w3 = Web3(Web3.HTTPProvider("https://YOUR_QUICKNODE_ENDPOINT_HERE.com"))
resp = w3.provider.make_request(
'v1/getHistoricalExchangeRates',
["{\"assetBase\" : \"BTC\" }", "{\"assetQuote\" : \"ETH\" }", "{\"period_id\" : \"1DAY\" }", "{\"time_start\" : \"2023-11-09T08:30:00\" }", "{\"time_end\" : \"2023-11-09T09:30:00\" }", 0]
)
print(resp)
require 'eth'
client = Eth::Client.create "https://YOUR_QUICKNODE_ENDPOINT_HERE.com"
payload = {
"id":1,
"jsonrpc":"2.0",
"method":"v1/getHistoricalExchangeRates",
"params": ["{\"assetBase\" : \"BTC\" }", "{\"assetQuote\" : \"ETH\" }", "{\"period_id\" : \"1DAY\" }", "{\"time_start\" : \"2023-11-09T08:30:00\" }", "{\"time_end\" : \"2023-11-09T09:30:00\" }", 0]
}
response = client.send(payload.to_json)
puts response
const ethers = require("ethers");
(async () : {
const provider = new ethers.providers.JsonRpcProvider("https://YOUR_QUICKNODE_ENDPOINT_HERE.com");
const network = await provider.send(
"v1/getHistoricalExchangeRates",
["{\"assetBase\" : \"BTC\" }", "{\"assetQuote\" : \"ETH\" }", "{\"period_id\" : \"1DAY\" }", "{\"time_start\" : \"2023-11-09T08:30:00\" }", "{\"time_end\" : \"2023-11-09T09:30:00\" }", 0]
);
console.log(network);
})();
curl https://YOUR_QUICKNODE_ENDPOINT_HERE.com \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"v1/getHistoricalExchangeRates","params": ["{\"assetBase\" : \"BTC\" }", "{\"assetQuote\" : \"ETH\" }", "{\"period_id\" : \"1DAY\" }", "{\"time_start\" : \"2023-11-09T08:30:00\" }", "{\"time_end\" : \"2023-11-09T09:30:00\" }", 0],"id":1,"jsonrpc":"2.0"}'
const axios = require("axios");
(() : {
const config = {
headers: {
"Content-Type": "application/json",
},
};
const data = {
jsonrpc: "2.0",
id: 1,
method: "v1/getHistoricalExchangeRates",
params: ["{\"assetBase\" : \"BTC\" }", "{\"assetQuote\" : \"ETH\" }", "{\"period_id\" : \"1DAY\" }", "{\"time_start\" : \"2023-11-09T08:30:00\" }", "{\"time_end\" : \"2023-11-09T09:30:00\" }", 0],
};
axios
.post(
"https://YOUR_QUICKNODE_ENDPOINT_HERE.com",
data,
config
)
.then(function (response) {
// handle success
console.log(response.data);
})
.catch((err) : {
// handle error
console.log(err);
});
})();
from jsonrpcclient import request, parse, Ok
import logging
import requests
response = requests.post("https://YOUR_QUICKNODE_ENDPOINT_HERE.com", json=request("v1/getHistoricalExchangeRates", ["{\"assetBase\" : \"BTC\" }", "{\"assetQuote\" : \"ETH\" }", "{\"period_id\" : \"1DAY\" }", "{\"time_start\" : \"2023-11-09T08:30:00\" }", "{\"time_end\" : \"2023-11-09T09:30:00\" }", 0]))
parsed = parse(response.json())
if isinstance(parsed, Ok):
print(parsed.result)
else:
logging.error(parsed.message)