(indexes)
Indexes section of the API is in the Alpha release cycle. Use only for testing, evaluaton and feedback.
- get_v1_indexes - List of available indexes
- post_v1_indexes_json - Create index
- get_v1_indexes_index_id - Get index data
- put_v1_indexes_index_id_json - Update index
- get_v1_indexes_index_id_history - Retrieve Historical Index Value and Composition
- get_v1_indexes_index_id_timeseries - Retrieve Historical Index Value Timeseries
- get_v1_indexes_index_id_timeseries_to_be_announced - Retrieve Historical Composition Value Timeseries Retrieves historical timeseries for the specific composition value for an index
List of available indexes
import coinapi
s = coinapi.CoinAPI(
api_key="<YOUR_API_KEY_HERE>",
)
res = s.indexes.get_v1_indexes()
if res.content is not None:
# handle response
pass
operations.GetV1IndexesResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.CoinAPIError | 4x-5xx | / |
Create index
import coinapi
from coinapi.models import components
s = coinapi.CoinAPI(
api_key="<YOUR_API_KEY_HERE>",
)
req = components.V1IndexData()
res = s.indexes.post_v1_indexes_json(req)
if res.content is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.V1IndexData | ✔️ | The request object to use for the request. |
operations.PostV1IndexesJSONResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.CoinAPIError | 4x-5xx | / |
Get index data
import coinapi
s = coinapi.CoinAPI(
api_key="<YOUR_API_KEY_HERE>",
)
res = s.indexes.get_v1_indexes_index_id(index_id='<value>')
if res.content is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
index_id |
str | ✔️ | N/A |
operations.GetV1IndexesIndexIDResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.CoinAPIError | 4x-5xx | / |
Update index
import coinapi
from coinapi.models import components
s = coinapi.CoinAPI(
api_key="<YOUR_API_KEY_HERE>",
)
res = s.indexes.put_v1_indexes_index_id_json(index_id='<value>', v1_index_data=components.V1IndexData())
if res.content is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
index_id |
str | ✔️ | N/A |
v1_index_data |
Optional[components.V1IndexData] | ➖ | N/A |
operations.PutV1IndexesIndexIDJSONResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.CoinAPIError | 4x-5xx | / |
Retrieve Historical Index Value and Composition
import coinapi
import dateutil.parser
s = coinapi.CoinAPI(
api_key="<YOUR_API_KEY_HERE>",
)
res = s.indexes.get_v1_indexes_index_id_history(index_id='<value>', time_start=dateutil.parser.isoparse('2024-10-21T14:08:54.780Z'), time_end=dateutil.parser.isoparse('2022-08-14T15:13:35.032Z'), limit=100)
if res.content is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
index_id |
str | ✔️ | N/A |
time_start |
date | ➖ | N/A |
time_end |
date | ➖ | N/A |
limit |
Optional[int] | ➖ | N/A |
operations.GetV1IndexesIndexIDHistoryResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.CoinAPIError | 4x-5xx | / |
Retrieve Historical Index Value Timeseries
import coinapi
import dateutil.parser
s = coinapi.CoinAPI(
api_key="<YOUR_API_KEY_HERE>",
)
res = s.indexes.get_v1_indexes_index_id_timeseries(index_id='<value>', time_start=dateutil.parser.isoparse('2022-09-29T06:10:23.640Z'), time_end=dateutil.parser.isoparse('2022-11-21T03:10:01.688Z'), limit=100)
if res.content is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
index_id |
str | ✔️ | N/A |
time_start |
date | ➖ | N/A |
time_end |
date | ➖ | N/A |
limit |
Optional[int] | ➖ | N/A |
operations.GetV1IndexesIndexIDTimeseriesResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.CoinAPIError | 4x-5xx | / |
Retrieve Historical Composition Value Timeseries Retrieves historical timeseries for the specific composition value for an index
import coinapi
from coinapi.models import operations
s = coinapi.CoinAPI(
api_key="<YOUR_API_KEY_HERE>",
)
req = operations.GetV1IndexesIndexIDTimeseriesTOBEANNOUNCEDRequest(
index_id='<value>',
)
res = s.indexes.get_v1_indexes_index_id_timeseries_to_be_announced(req)
if res.content is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetV1IndexesIndexIDTimeseriesTOBEANNOUNCEDRequest | ✔️ | The request object to use for the request. |
operations.GetV1IndexesIndexIDTimeseriesTOBEANNOUNCEDResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.CoinAPIError | 4x-5xx | / |