Forex¶
Foreign exchange spot rates.
Usage¶
Sync
from datamaxi import Datamaxi
maxi = Datamaxi(api_key="YOUR_API_KEY")
symbols = maxi.forex.symbols()
data = maxi.forex(symbol="USD-KRW")
Async
import asyncio
from datamaxi.aio import AsyncDatamaxi
async def main():
async with AsyncDatamaxi(api_key="YOUR_API_KEY") as client:
symbols = await client.forex.symbols()
data = await client.forex(symbol="USD-KRW")
asyncio.run(main())
Notes¶
- Set
pandas=Falseto return the raw dict response.
Bases: Resource
Client to fetch forex 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__(
symbol: str, pandas: bool = True
) -> Union[pd.DataFrame, ForexRow]
Fetch forex data
GET /api/v1/forex
https://docs.datamaxiplus.com/rest/forex/forex
Parameters:
-
symbol(str) –Symbol name
-
pandas(bool, default:True) –Return data as pandas DataFrame
Returns:
-
Union[DataFrame, ForexRow]–Forex data in pandas DataFrame
symbols
¶
symbols() -> List[str]
Fetch supported symbols for forex data.
GET /api/v1/forex/symbols
https://docs.datamaxiplus.com/rest/forex/symbols
Returns:
-
List[str]–List of supported symbols