Emit a simple "new candle" message to allow UI's to refresh charts

This commit is contained in:
Matthias
2022-10-26 20:22:58 +02:00
parent b0f430b5ac
commit 5e533b550f
4 changed files with 17 additions and 9 deletions

View File

@@ -101,16 +101,13 @@ class DataProvider:
"""
return self.__producer_pairs.get(producer_name, []).copy()
def _emit_df(
self,
pair_key: PairWithTimeframe,
dataframe: DataFrame
) -> None:
def _emit_df(self, pair_key: PairWithTimeframe, dataframe: DataFrame, new_candle: bool) -> None:
"""
Send this dataframe as an ANALYZED_DF message to RPC
:param pair_key: PairWithTimeframe tuple
:param data: Tuple containing the DataFrame and the datetime it was cached
:param dataframe: Dataframe to emit
:param new_candle: This is a new candle
"""
if self.__rpc:
self.__rpc.send_msg(
@@ -123,6 +120,15 @@ class DataProvider:
}
}
)
if new_candle:
self.__rpc.send_msg(
{
'type': RPCMessageType.NEW_CANDLE,
'data': {
'key': pair_key,
}
}
)
def _add_external_df(
self,