Skip to main content

get_request / post_request

Using get_request, post_request in backtest is not recommended.

Input

  • get_request
url
params: {key: value}
args
  • post_request
url
data: {key: value}
json: {key: value}
args

Supported URLs (Third party APIs):

WebsiteAPI EndpointsAPI Documentation
Etherscanhttps://api.etherscan.io/https://docs.etherscan.io/
Glassnodehttps://api.glassnode.com/https://docs.glassnode.com/
CryptoQuanthttps://api.cryptoquant.com/https://cryptoquant.com/docs
Twitterhttps://api.twitter.com/https://developer.twitter.com/en/docs/twitter-api
APILayerhttps://api.apilayer.comhttps://apilayer.com/docs
Luabasehttps://api.luabase.com/https://luabase.notion.site/Luabase-Docs-e9c2c5338c47494cb35294b47ce4b744
Santimenthttps://santiment.net/https://academy.santiment.net/

Example

  url = "https://api.apilayer.com/currency_data/live?source=USD&currencies=EUR"
payload = {}
headers= {
"apikey": "[YOUR_API_KEY]"
}
response = CA.get_request(url, headers=headers, data=payload)

status_code = response.status_code
result = response.json()
CA.log(str(status_code))
CA.log(str(result))
CA.log(str(result['quotes']['USDEUR']))

logging:

200
{'success': True, 'timestamp': 1655851923, 'source': 'USD', 'quotes': {'USDEUR': 0.948897}}
0.948897