Added default type none to price argument in OHLCV methods

This commit is contained in:
Sam Germain
2021-10-13 18:39:49 -06:00
parent 48470e33ec
commit 06dea121fd
4 changed files with 26 additions and 18 deletions

View File

@@ -219,13 +219,15 @@ class Binance(Exchange):
raise OperationalException(e) from e
def _get_mark_price(self, pair: str, date: datetime) -> float:
# TODO-lev: implement
raise OperationalException(f'_get_mark_price has not been implemented on {self.name}')
def _get_funding_rate(self, pair: str, premium_index: float) -> Optional[float]:
def _get_funding_rate(self, pair: str, when: datetime):
"""
Get's the funding_rate for a pair at a specific date and time in the past
"""
raise OperationalException(f'_get_mark_price has not been implemented on {self.name}')
# TODO-lev: implement
raise OperationalException(f"get_funding_rate has not been implemented for {self.name}")
def _get_funding_fee(
self,
@@ -253,7 +255,7 @@ class Binance(Exchange):
timeframe: str,
since_ms: int,
is_new_pair: bool,
price: Optional[str]
price: Optional[str] = None
) -> List:
"""
Overwrite to introduce "fast new pair" functionality by detecting the pair's listing date

View File

@@ -1296,7 +1296,7 @@ class Exchange:
pair: str,
timeframe: str,
since_ms: int,
price: Optional[str]
price: Optional[str] = None
) -> DataFrame:
"""
Minimal wrapper around get_historic_ohlcv - converting the result into a dataframe
@@ -1306,14 +1306,13 @@ class Exchange:
:param price: "mark" if retrieving the mark price cnadles, "index" for index price candles
:return: OHLCV DataFrame
"""
ticks = self.get_historic_ohlcv(pair, timeframe, since_ms=since_ms)
ticks = self.get_historic_ohlcv(pair, timeframe, since_ms=since_ms, price=price)
return ohlcv_to_dataframe(
ticks,
timeframe,
pair=pair,
fill_missing=True,
drop_incomplete=self._ohlcv_partial_candle,
price=price
drop_incomplete=self._ohlcv_partial_candle
)
async def _async_get_historic_ohlcv(
@@ -1322,7 +1321,7 @@ class Exchange:
timeframe: str,
since_ms: int,
is_new_pair: bool,
price: Optional[str]
price: Optional[str] = None
) -> List:
"""
Download historic ohlcv
@@ -1368,7 +1367,7 @@ class Exchange:
pair_list: ListPairsWithTimeframes, *,
since_ms: Optional[int] = None,
cache: bool = True,
price: Optional[str]
price: Optional[str] = None
) -> Dict[Tuple[str, str], DataFrame]:
"""
Refresh in-memory OHLCV asynchronously and set `_klines` with the result