Last active
October 12, 2021 07:31
-
-
Save evanaze/9e9c012d157e974d55be24320b59feea to your computer and use it in GitHub Desktop.
Using Amberdata to get the daily Sharpe Ratio of BTC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# our first token to try out | |
token = "btc" | |
# the url for our token | |
url = f"https://web3api.io/api/v2/market/metrics/{token}/historical/sharpe" | |
# our API key | |
headers = {'x-api-key': api_key["AMBERDATA_API_KEY"]} | |
# the start and end of the period | |
end = dt.datetime.today().isoformat() | |
start = (dt.datetime.today() + dt.timedelta(-365)).isoformat() | |
print("Start:", start, "\n", "End:", end) | |
# a querystring, indicating the time period | |
querystring = { | |
"startDate": start, | |
"endDate": end, | |
"timeFrame": "1d" | |
} | |
# get the response | |
response = get_response(url, headers) | |
print("\nFirst five lines of the result:") | |
for i in range(5): | |
print(response["data"][i]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment