mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Add useful helper methods for adjust_trade_position implementation
This commit is contained in:
parent
94631c7d64
commit
813a2cd23b
|
@ -614,6 +614,24 @@ class LocalTrade():
|
|||
else:
|
||||
return None
|
||||
|
||||
def nr_of_successful_buys(self) -> int:
|
||||
"""
|
||||
Helper function to count the number of buy orders that have been filled.
|
||||
:return: int count of buy orders that have been filled for this trade.
|
||||
"""
|
||||
return len([o for o in self.orders if o.ft_order_side == 'buy' and
|
||||
o.status in NON_OPEN_EXCHANGE_STATES and
|
||||
o.filled > 0])
|
||||
|
||||
def nr_of_successful_sells(self) -> int:
|
||||
"""
|
||||
Helper function to count the number of sell orders that have been filled.
|
||||
:return: int count of sell orders that have been filled for this trade.
|
||||
"""
|
||||
return len([o for o in self.orders if o.ft_order_side == 'sell' and
|
||||
o.status in NON_OPEN_EXCHANGE_STATES and
|
||||
o.filled > 0])
|
||||
|
||||
@staticmethod
|
||||
def get_trades_proxy(*, pair: str = None, is_open: bool = None,
|
||||
open_date: datetime = None, close_date: datetime = None,
|
||||
|
|
Loading…
Reference in New Issue
Block a user