Files
OpenBB/openbb_sdk/openbb/package/forex.py
2023-08-31 11:42:56 +02:00

235 lines
9.1 KiB
Python

### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###
import datetime
from typing import List, Literal, Optional, Union
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.model.obbject import OBBject
from openbb_core.app.static.container import Container
from openbb_core.app.static.filters import filter_inputs
from pydantic import validate_arguments
from typing_extensions import Annotated
class CLASS_forex(Container):
"""/forex
load
pairs
"""
def __repr__(self) -> str:
return self.__doc__ or ""
@validate_arguments
def load(
self,
symbol: Annotated[
Union[str, List[str]],
OpenBBCustomParameter(description="Symbol to get data for."),
],
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
chart: bool = False,
provider: Optional[Literal["fmp", "polygon", "yfinance"]] = None,
**kwargs
) -> OBBject[List]:
r"""Forex Intraday Price.
Parameters
----------
symbol : Union[str, List[str]]
Symbol to get data for.
start_date : Union[datetime.date, NoneType, str]
Start date of the data, in YYYY-MM-DD format.
end_date : Union[datetime.date, NoneType, str]
End date of the data, in YYYY-MM-DD format.
chart : bool
Whether to create a chart or not, by default False.
provider : Optional[Literal['fmp', 'polygon', 'yfinance']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'fmp' if there is
no default.
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
Timespan of the data. (provider: polygon)
sort : Literal['asc', 'desc']
Sort order of the data. (provider: polygon)
limit : PositiveInt
The number of data entries to return. (provider: polygon)
adjusted : bool
Whether the data is adjusted. (provider: polygon)
multiplier : PositiveInt
Multiplier of the timespan. (provider: polygon)
interval : Optional[Literal['1m', '2m', '5m', '15m', '30m', '60m', '90m', '1h', '1d', '5d', '1wk', '1mo', '3mo']]
Data granularity. (provider: yfinance)
period : Optional[Literal['1d', '5d', '1mo', '3mo', '6mo', '1y', '2y', '5y', '10y', 'ytd', 'max']]
Period of the data to return. (provider: yfinance)
prepost : bool
Include Pre and Post market data. (provider: yfinance)
adjust : bool
Adjust all the data automatically. (provider: yfinance)
back_adjust : bool
Back-adjusted data to mimic true historical prices. (provider: yfinance)
Returns
-------
OBBject
results : List[ForexEOD]
Serializable results.
provider : Optional[Literal['fmp', 'polygon', 'yfinance']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
chart : Optional[Chart]
Chart object.
metadata: Optional[Metadata]
Metadata info about the command execution.
ForexEOD
--------
date : Optional[datetime]
The date of the data.
open : Optional[PositiveFloat]
The open price of the symbol.
high : Optional[PositiveFloat]
The high price of the symbol.
low : Optional[PositiveFloat]
The low price of the symbol.
close : Optional[PositiveFloat]
The close price of the symbol.
volume : Optional[NonNegativeFloat]
The volume of the symbol.
vwap : Optional[PositiveFloat]
Volume Weighted Average Price of the symbol.
adj_close : Optional[float]
Adjusted Close Price of the symbol. (provider: fmp)
unadjusted_volume : Optional[float]
Unadjusted volume of the symbol. (provider: fmp)
change : Optional[float]
Change in the price of the symbol from the previous day. (provider: fmp)
change_percent : Optional[float]
Change \% in the price of the symbol. (provider: fmp)
label : Optional[str]
Human readable format of the date. (provider: fmp)
change_over_time : Optional[float]
Change \% in the price of the symbol over a period of time. (provider: fmp)
n : Optional[PositiveInt]
Number of transactions for the symbol in the time period. (provider: polygon)
""" # noqa: E501
inputs = filter_inputs(
provider_choices={
"provider": provider,
},
standard_params={
"symbol": ",".join(symbol) if isinstance(symbol, list) else symbol,
"start_date": start_date,
"end_date": end_date,
},
extra_params=kwargs,
chart=chart,
)
return self._command_runner.run(
"/forex/load",
**inputs,
)
@validate_arguments
def pairs(
self,
chart: bool = False,
provider: Optional[Literal["fmp", "polygon"]] = None,
**kwargs
) -> OBBject[List]:
"""Forex Available Pairs.
Parameters
----------
chart : bool
Whether to create a chart or not, by default False.
provider : Optional[Literal['fmp', 'polygon']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'fmp' if there is
no default.
symbol : Optional[str]
Symbol of the pair to search. (provider: polygon)
date : Optional[datetime.date]
A specific date to get data for. (provider: polygon)
search : Optional[str]
Search for terms within the ticker and/or company name. (provider: polygon)
active : Optional[Literal[True, False]]
Specify if the tickers returned should be actively traded on the queried date. (provider: polygon)
order : Optional[Literal['asc', 'desc']]
Order data by ascending or descending. (provider: polygon)
sort : Optional[Literal['ticker', 'name', 'market', 'locale', 'currency_symbol', 'currency_name', 'base_currency_symbol', 'base_currency_name', 'last_updated_utc', 'delisted_utc']]
Sort field used for ordering. (provider: polygon)
limit : Optional[pydantic.types.PositiveInt]
The number of data entries to return. (provider: polygon)
Returns
-------
OBBject
results : List[ForexPairs]
Serializable results.
provider : Optional[Literal['fmp', 'polygon']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
chart : Optional[Chart]
Chart object.
metadata: Optional[Metadata]
Metadata info about the command execution.
ForexPairs
----------
name : Optional[str]
Name of the currency pair.
symbol : Optional[str]
Symbol of the currency pair. (provider: fmp)
currency : Optional[str]
Base currency of the currency pair. (provider: fmp)
stock_exchange : Optional[str]
Stock exchange of the currency pair. (provider: fmp)
exchange_short_name : Optional[str]
Short name of the stock exchange of the currency pair. (provider: fmp)
market : Optional[str]
The name of the trading market. Always 'fx'. (provider: polygon)
locale : Optional[str]
The locale of the currency pair. (provider: polygon)
currency_symbol : Optional[str]
The symbol of the quote currency. (provider: polygon)
currency_name : Optional[str]
The name of the quote currency. (provider: polygon)
base_currency_symbol : Optional[str]
The symbol of the base currency. (provider: polygon)
base_currency_name : Optional[str]
The name of the base currency. (provider: polygon)
last_updated_utc : Optional[datetime]
The last updated timestamp in UTC. (provider: polygon)
delisted_utc : Optional[datetime]
The delisted timestamp in UTC. (provider: polygon)""" # noqa: E501
inputs = filter_inputs(
provider_choices={
"provider": provider,
},
standard_params={},
extra_params=kwargs,
chart=chart,
)
return self._command_runner.run(
"/forex/pairs",
**inputs,
)