Add dp / wallets to strategy interface
This commit is contained in:
parent
d3a37db79a
commit
58f1abf287
@ -58,8 +58,13 @@ class FreqtradeBot(object):
|
|||||||
self.persistence = None
|
self.persistence = None
|
||||||
self.exchange = Exchange(self.config)
|
self.exchange = Exchange(self.config)
|
||||||
self.wallets = Wallets(self.exchange)
|
self.wallets = Wallets(self.exchange)
|
||||||
|
|
||||||
self.dataprovider = DataProvider(self.config, self.exchange)
|
self.dataprovider = DataProvider(self.config, self.exchange)
|
||||||
|
|
||||||
|
# Attach Dataprovider to Strategy baseclass
|
||||||
|
IStrategy.dp = self.dataprovider
|
||||||
|
# Attach Wallets to Strategy baseclass
|
||||||
|
IStrategy.wallets = self.wallets
|
||||||
|
|
||||||
pairlistname = self.config.get('pairlist', {}).get('method', 'StaticPairList')
|
pairlistname = self.config.get('pairlist', {}).get('method', 'StaticPairList')
|
||||||
self.pairlists = PairListResolver(pairlistname, self, self.config).pairlist
|
self.pairlists = PairListResolver(pairlistname, self, self.config).pairlist
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@ import arrow
|
|||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
|
|
||||||
from freqtrade import constants
|
from freqtrade import constants
|
||||||
|
from freqtrade.data.dataprovider import DataProvider
|
||||||
from freqtrade.persistence import Trade
|
from freqtrade.persistence import Trade
|
||||||
|
from freqtrade.wallets import Wallets
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -96,6 +98,12 @@ class IStrategy(ABC):
|
|||||||
# Dict to determine if analysis is necessary
|
# Dict to determine if analysis is necessary
|
||||||
_last_candle_seen_per_pair: Dict[str, datetime] = {}
|
_last_candle_seen_per_pair: Dict[str, datetime] = {}
|
||||||
|
|
||||||
|
# Class level variables (intentional) containing
|
||||||
|
# the dataprovider (dp) (access to other candles, historic data, ...)
|
||||||
|
# and wallets - access to the current balance.
|
||||||
|
dp: DataProvider
|
||||||
|
wallets: Wallets
|
||||||
|
|
||||||
def __init__(self, config: dict) -> None:
|
def __init__(self, config: dict) -> None:
|
||||||
self.config = config
|
self.config = config
|
||||||
self._last_candle_seen_per_pair = {}
|
self._last_candle_seen_per_pair = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user