Return date column unmodified

This commit is contained in:
Matthias 2020-07-11 15:20:50 +02:00
parent 482f1faa88
commit b93ad8840a
2 changed files with 6 additions and 4 deletions

View File

@ -548,7 +548,6 @@ class ApiServer(RPC):
results = self._rpc_analysed_history_full(pair, timeframe, timerange) results = self._rpc_analysed_history_full(pair, timeframe, timerange)
return self.rest_dump(results) return self.rest_dump(results)
@require_login @require_login
@rpc_catch_errors @rpc_catch_errors
def _plot_config(self): def _plot_config(self):

View File

@ -10,6 +10,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union
import arrow import arrow
from numpy import NAN, int64, mean from numpy import NAN, int64, mean
from pandas import DataFrame
from freqtrade.configuration.timerange import TimeRange from freqtrade.configuration.timerange import TimeRange
from freqtrade.constants import CANCEL_REASON from freqtrade.constants import CANCEL_REASON
@ -656,8 +657,9 @@ class RPC:
raise RPCException('Edge is not enabled.') raise RPCException('Edge is not enabled.')
return self._freqtrade.edge.accepted_pairs() return self._freqtrade.edge.accepted_pairs()
def _convert_dataframe_to_dict(self, pair, dataframe, last_analyzed): def _convert_dataframe_to_dict(self, pair: str, dataframe: DataFrame, last_analyzed: datetime):
dataframe['date'] = dataframe['date'].astype(int64) // 1000 // 1000
dataframe.loc[:, '__date_ts'] = dataframe.loc[:, 'date'].astype(int64) // 1000 // 1000
# Move open to seperate column when signal for easy plotting # Move open to seperate column when signal for easy plotting
if 'buy' in dataframe.columns: if 'buy' in dataframe.columns:
buy_mask = (dataframe['buy'] == 1) buy_mask = (dataframe['buy'] == 1)
@ -673,13 +675,14 @@ class RPC:
'data': dataframe.values.tolist(), 'data': dataframe.values.tolist(),
'length': len(dataframe), 'length': len(dataframe),
'last_analyzed': last_analyzed, 'last_analyzed': last_analyzed,
'last_analyzed_ts': int(last_analyzed.timestamp()),
} }
def _analysed_dataframe(self, pair: str, timeframe: str, limit: int) -> Dict[str, Any]: def _analysed_dataframe(self, pair: str, timeframe: str, limit: int) -> Dict[str, Any]:
_data, last_analyzed = self._freqtrade.dataprovider.get_analyzed_dataframe(pair, timeframe) _data, last_analyzed = self._freqtrade.dataprovider.get_analyzed_dataframe(pair, timeframe)
if limit: if limit:
_data = _data.iloc[-limit:] _data = _data.iloc[-limit:].copy()
return self._convert_dataframe_to_dict(pair, _data, last_analyzed) return self._convert_dataframe_to_dict(pair, _data, last_analyzed)
def _rpc_analysed_history_full(self, pair: str, timeframe: str, def _rpc_analysed_history_full(self, pair: str, timeframe: str,