diff --git a/datamaxi/aio/cex.py b/datamaxi/aio/cex.py index e1e949d..90f38db 100644 --- a/datamaxi/aio/cex.py +++ b/datamaxi/aio/cex.py @@ -37,8 +37,8 @@ async def __call__( symbol: str, currency: str = USD, interval: Interval = INTERVAL_1D, - from_unix: str = None, - to_unix: str = None, + from_unix: Optional[str] = None, + to_unix: Optional[str] = None, pandas: bool = True, ) -> Union[pd.DataFrame, CandleResponse]: """Fetch candle data (async). See ``datamaxi.Datamaxi.cex.candle``.""" @@ -79,7 +79,7 @@ async def exchanges(self, market: Market) -> List[str]: return await self.request_endpoint("cex_candle_exchanges", market=market) async def symbols( - self, exchange: str = None, market: Optional[Market] = None + self, exchange: Optional[str] = None, market: Optional[Market] = None ) -> List[Dict]: if market is not None and market not in [SPOT, FUTURES]: raise ValueError("market must be either spot or futures") @@ -97,8 +97,8 @@ async def get( exchange: str, symbol: str, market: Market, - currency: str = None, - conversion_base: str = None, + currency: Optional[str] = None, + conversion_base: Optional[str] = None, include_source: bool = False, pandas: bool = True, ) -> Union[pd.DataFrame, TickerResponse]: @@ -154,8 +154,8 @@ async def symbols(self, exchange: str, market: Market) -> List[str]: class AsyncCexFee(AsyncResource): async def __call__( self, - exchange: str = None, - symbol: str = None, + exchange: Optional[str] = None, + symbol: Optional[str] = None, ) -> List[Dict]: return await self.request_endpoint("cex_fees", exchange=exchange, symbol=symbol) diff --git a/datamaxi/aio/funding_rate.py b/datamaxi/aio/funding_rate.py index 15b5ed6..4b0e6c1 100644 --- a/datamaxi/aio/funding_rate.py +++ b/datamaxi/aio/funding_rate.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Callable, Tuple, List, Union, TYPE_CHECKING +from typing import Callable, Tuple, List, Union, Optional, TYPE_CHECKING from datamaxi.aio._core import AsyncResource from datamaxi.lib.utils import check_required_parameter, check_required_parameters @@ -20,8 +20,8 @@ async def history( symbol: str, page: int = 1, limit: int = 1000, - fromDateTime: str = None, - toDateTime: str = None, + fromDateTime: Optional[str] = None, + toDateTime: Optional[str] = None, sort: SortOrder = DESC, pandas: bool = True, ) -> Union[Tuple[pd.DataFrame, Callable], Tuple[FundingHistoryResponse, Callable]]: @@ -75,8 +75,8 @@ async def next_request(): async def latest( self, - exchange: str = None, - symbol: str = None, + exchange: Optional[str] = None, + symbol: Optional[str] = None, pandas: bool = True, ) -> Union[pd.DataFrame, LatestFundingRate]: res = await self.request_endpoint( diff --git a/datamaxi/aio/premium.py b/datamaxi/aio/premium.py index f34c1ff..d412c0c 100644 --- a/datamaxi/aio/premium.py +++ b/datamaxi/aio/premium.py @@ -15,27 +15,27 @@ class AsyncPremium(AsyncResource): async def __call__( # noqa: C901 self, - source_exchange: str = None, - target_exchange: str = None, - asset: str = None, - source_quote: str = None, - target_quote: str = None, + source_exchange: Optional[str] = None, + target_exchange: Optional[str] = None, + asset: Optional[str] = None, + source_quote: Optional[str] = None, + target_quote: Optional[str] = None, sort: Optional[SortOrder] = None, - key: str = None, + key: Optional[str] = None, page: int = 1, limit: int = 100, - currency: str = None, - conversion_base: str = None, - min_sv: str = None, - min_tv: str = None, + currency: Optional[str] = None, + conversion_base: Optional[str] = None, + min_sv: Optional[str] = None, + min_tv: Optional[str] = None, source_market: Optional[Market] = None, target_market: Optional[Market] = None, only_transferable: bool = False, - network: str = None, - premium_type: str = None, - token_include: str = None, - token_exclude: str = None, - query: str = None, + network: Optional[str] = None, + premium_type: Optional[str] = None, + token_include: Optional[str] = None, + token_exclude: Optional[str] = None, + query: Optional[str] = None, pandas: bool = True, ) -> Union[pd.DataFrame, PremiumResponse]: params = {} diff --git a/datamaxi/resources/cex_candle.py b/datamaxi/resources/cex_candle.py index b687a1a..ebb3402 100644 --- a/datamaxi/resources/cex_candle.py +++ b/datamaxi/resources/cex_candle.py @@ -34,8 +34,8 @@ def __call__( symbol: str, currency: str = USD, interval: Interval = INTERVAL_1D, - from_unix: str = None, - to_unix: str = None, + from_unix: Optional[str] = None, + to_unix: Optional[str] = None, pandas: bool = True, ) -> Union[pd.DataFrame, CandleResponse]: """Fetch candle data @@ -108,7 +108,7 @@ def exchanges(self, market: Market) -> List[str]: return self.request_endpoint("cex_candle_exchanges", market=market) def symbols( - self, exchange: str = None, market: Optional[Market] = None + self, exchange: Optional[str] = None, market: Optional[Market] = None ) -> List[Dict]: """Fetch supported symbols for candle data. diff --git a/datamaxi/resources/cex_fee.py b/datamaxi/resources/cex_fee.py index cad3c26..e93e251 100644 --- a/datamaxi/resources/cex_fee.py +++ b/datamaxi/resources/cex_fee.py @@ -1,4 +1,4 @@ -from typing import Any, List, Dict +from typing import Any, List, Dict, Optional from datamaxi.api import Resource from datamaxi.lib.utils import check_required_parameter @@ -17,8 +17,8 @@ def __init__(self, api_key=None, **kwargs: Any): def __call__( self, - exchange: str = None, - symbol: str = None, + exchange: Optional[str] = None, + symbol: Optional[str] = None, ) -> List[Dict]: """Fetch trading fee data diff --git a/datamaxi/resources/cex_ticker.py b/datamaxi/resources/cex_ticker.py index b9beca7..9b4978e 100644 --- a/datamaxi/resources/cex_ticker.py +++ b/datamaxi/resources/cex_ticker.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Any, List, Union, TYPE_CHECKING +from typing import Any, List, Union, Optional, TYPE_CHECKING from datamaxi.api import Resource from datamaxi.lib.utils import check_required_parameters from datamaxi.resources.responses import TickerResponse @@ -27,8 +27,8 @@ def get( exchange: str, symbol: str, market: Market, - currency: str = None, - conversion_base: str = None, + currency: Optional[str] = None, + conversion_base: Optional[str] = None, include_source: bool = False, pandas: bool = True, ) -> Union[pd.DataFrame, TickerResponse]: diff --git a/datamaxi/resources/funding_rate.py b/datamaxi/resources/funding_rate.py index 89c399b..c62a241 100644 --- a/datamaxi/resources/funding_rate.py +++ b/datamaxi/resources/funding_rate.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Any, Callable, Tuple, List, Union, TYPE_CHECKING +from typing import Any, Callable, Tuple, List, Union, Optional, TYPE_CHECKING from datamaxi.api import Resource from datamaxi.lib.utils import check_required_parameter from datamaxi.lib.utils import check_required_parameters @@ -30,8 +30,8 @@ def history( symbol: str, page: int = 1, limit: int = 1000, - fromDateTime: str = None, - toDateTime: str = None, + fromDateTime: Optional[str] = None, + toDateTime: Optional[str] = None, sort: SortOrder = DESC, pandas: bool = True, ) -> Union[Tuple[pd.DataFrame, Callable], Tuple[FundingHistoryResponse, Callable]]: @@ -107,8 +107,8 @@ def next_request(): def latest( self, - exchange: str = None, - symbol: str = None, + exchange: Optional[str] = None, + symbol: Optional[str] = None, pandas: bool = True, ) -> Union[pd.DataFrame, LatestFundingRate]: """Fetch latest funding rate data diff --git a/datamaxi/resources/premium.py b/datamaxi/resources/premium.py index edcb828..3196c2b 100644 --- a/datamaxi/resources/premium.py +++ b/datamaxi/resources/premium.py @@ -26,27 +26,27 @@ def __init__(self, api_key=None, **kwargs: Any): def __call__( # noqa: C901 self, - source_exchange: str = None, - target_exchange: str = None, - asset: str = None, - source_quote: str = None, - target_quote: str = None, + source_exchange: Optional[str] = None, + target_exchange: Optional[str] = None, + asset: Optional[str] = None, + source_quote: Optional[str] = None, + target_quote: Optional[str] = None, sort: Optional[SortOrder] = None, - key: str = None, + key: Optional[str] = None, page: int = 1, limit: int = 100, - currency: str = None, - conversion_base: str = None, - min_sv: str = None, - min_tv: str = None, + currency: Optional[str] = None, + conversion_base: Optional[str] = None, + min_sv: Optional[str] = None, + min_tv: Optional[str] = None, source_market: Optional[Market] = None, target_market: Optional[Market] = None, only_transferable: bool = False, - network: str = None, - premium_type: str = None, - token_include: str = None, - token_exclude: str = None, - query: str = None, + network: Optional[str] = None, + premium_type: Optional[str] = None, + token_include: Optional[str] = None, + token_exclude: Optional[str] = None, + query: Optional[str] = None, pandas: bool = True, ) -> Union[pd.DataFrame, PremiumResponse]: """Fetch premium data