Fix test mypy errors

This commit is contained in:
Matthias 2023-03-02 06:23:01 +01:00
parent b4b8dde4fb
commit b980f45b2b
3 changed files with 8 additions and 3 deletions

View File

@ -99,6 +99,10 @@ class Order(ModelBase):
def safe_filled(self) -> float:
return self.filled if self.filled is not None else self.amount or 0.0
@property
def safe_cost(self) -> float:
return self.cost or 0.0
@property
def safe_remaining(self) -> float:
return (

View File

@ -7,6 +7,7 @@ from datetime import datetime
from pandas import DataFrame
from freqtrade.persistence.trade_model import Order
from freqtrade.strategy.interface import IStrategy
@ -35,7 +36,7 @@ class TestStrategyImplementBuyTimeout(TestStrategyNoImplementSell):
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
return super().populate_exit_trend(dataframe, metadata)
def check_buy_timeout(self, pair: str, trade, order: dict,
def check_buy_timeout(self, pair: str, trade, order: Order,
current_time: datetime, **kwargs) -> bool:
return False
@ -44,6 +45,6 @@ class TestStrategyImplementSellTimeout(TestStrategyNoImplementSell):
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
return super().populate_exit_trend(dataframe, metadata)
def check_sell_timeout(self, pair: str, trade, order: dict,
def check_sell_timeout(self, pair: str, trade, order: Order,
current_time: datetime, **kwargs) -> bool:
return False

View File

@ -197,7 +197,7 @@ class StrategyTestV3(IStrategy):
if current_profit < -0.0075:
orders = trade.select_filled_orders(trade.entry_side)
return round(orders[0].cost, 0)
return round(orders[0].safe_cost, 0)
return None