stable/freqtrade/dataprovider.py

56 lines
1.2 KiB
Python
Raw Normal View History

2018-11-30 19:42:16 +00:00
"""
Dataprovider
Responsible to provide data to the bot
including Klines, tickers, historic data
Common Interface for bot and strategy to access data.
"""
import logging
2018-12-02 08:16:35 +00:00
from pandas import DataFrame
2018-11-30 19:42:16 +00:00
from freqtrade.exchange import Exchange
logger = logging.getLogger(__name__)
class DataProvider(object):
2018-12-02 08:16:35 +00:00
def __init__(self, config: dict, exchange: Exchange) -> None:
self._config = config
self._exchange = exchange
2018-11-30 19:42:16 +00:00
def refresh() -> None:
"""
Refresh data, called with each cycle
"""
pass
2018-12-02 08:16:35 +00:00
def ohlcv(self, pair: str) -> DataFrame:
2018-11-30 19:42:16 +00:00
"""
2018-12-02 08:16:35 +00:00
get ohlcv data for the given pair as DataFrame
2018-11-30 19:42:16 +00:00
"""
2018-12-02 08:16:35 +00:00
# TODO: Should not be stored in exchange but in this class
return self._exchange.klines.get(pair)
2018-11-30 19:42:16 +00:00
2018-12-02 08:16:35 +00:00
def historic_ohlcv(self, pair: str) -> DataFrame:
2018-11-30 19:42:16 +00:00
"""
get historic ohlcv data stored for backtesting
"""
pass
2018-12-02 08:16:35 +00:00
def ticker(self, pair: str):
"""
Return last ticker data
"""
2018-11-30 19:42:16 +00:00
pass
2018-12-02 08:16:35 +00:00
def orderbook(self, pair: str, max: int):
"""
return latest orderbook data
"""
2018-11-30 19:42:16 +00:00
pass
2018-12-02 08:16:35 +00:00
def balance(self, pair):
2018-11-30 19:42:16 +00:00
# TODO: maybe use wallet directly??
pass