Generate matrix of slug vs metrics supported
markdregan opened this issue · 1 comments
I'm trying to generate a matrix of:
a) metrics supported by santiment (ie. san.available_metrics()
)
b) slugs available for metrics in (a)
Is there an efficient way to achieve this without having to loop through all slugs running san.available_metrics('slug_name)
.
Best
Mark
This matrix would be extremely large (~2000+ assets multiplied by ~800 assets).
The full matrix could probably approach 100MB in size.
What can be done, though, is execute a query against the database table that holds the available metrics/assets pairings.
This can be done via the new, currently in development, online SQL Editor we are doing that gets access to our database: https://app.santiment.net/queries
In there you can execute the shown below query in order to fetch the available metrics/asset pairs. The call has a LIMIT
which you can remove. It also has a filter for end_dt
to exclude metric/asset pairs that have not been computed in the last 2 weeks:
SELECT get_asset_name(asset_id) AS asset, get_metric_name(metric_id) AS metric, start_dt, end_dt
FROM available_metrics
WHERE end_dt >= now() - interval 14 DAY
-- uncomment the next line if you want to get data for some assets only
-- AND asset_id IN (SELECT asset_id FROM asset_metadata WHERE name IN ('bitcoin', 'ethereum', 'maker'))
LIMIT 100
Direct API call of the example shown above:
mutation {
computeRawClickhouseQuery(parameters: "{}" query:"SELECT get_asset_name(asset_id) AS asset, get_metric_name(metric_id) AS metric, start_dt, end_dt FROM available_metrics WHERE end_dt >= now() - interval 14 DAY LIMIT 100") {
headers:columns
rows
}
}