Index Price¶
Historical index price time series for a single asset.
Usage¶
Sync
from datamaxi import Datamaxi
maxi = Datamaxi(api_key="YOUR_API_KEY")
data = maxi.index_price(
asset="BTC",
from_="now - 1 month",
to="now",
interval="5m",
)
Async
import asyncio
from datamaxi.aio import AsyncDatamaxi
async def main():
async with AsyncDatamaxi(api_key="YOUR_API_KEY") as client:
data = await client.index_price(
asset="BTC",
from_="now - 1 month",
to="now",
interval="5m",
)
asyncio.run(main())
Notes¶
from_is spelled with a trailing underscore becausefromis a Python keyword; the wire-level query param remainsfrom.
Bases: Resource
Client to fetch historical index price data from DataMaxi+ API.
Parameters:
-
api_key(str, default:None) –The DataMaxi+ API key
-
**kwargs(Any, default:{}) –Keyword arguments used by
datamaxi.api.API.
__call__
¶
__call__(
asset: str,
from_: Optional[str] = None,
to: Optional[str] = None,
interval: Interval = "5m",
) -> Dict[str, Any]
Fetch historical index price data for a single asset.
GET /api/v1/index-price
Parameters:
-
asset(str) –Asset (e.g.
BTC). -
from_(str, default:None) –Start time. Defaults to
now - 1 month. -
to(str, default:None) –End time. Defaults to
now. -
interval(str, default:'5m') –Sampling interval (default
5m).
Note
from_ is named with a trailing underscore because from
is a Python keyword. The wire-level query param remains from.
Returns:
-
Dict[str, Any]–Historical index price response.