Implement reloading of chart

This commit is contained in:
Matthias 2022-12-05 18:29:02 +01:00
parent e9478bfaab
commit 9a714cf082
2 changed files with 15 additions and 3 deletions

View File

@ -826,7 +826,13 @@ export function createBotSubStore(botId: string, botName: string) {
break;
case FtWsMessageTypes.newCandle:
console.log('exitFill', msg);
showAlert(`New Candle`, 'success');
const [pair, timeframe] = msg.data.key;
// TODO: check for active bot ...
if (pair === this.selectedPair) {
showAlert(`New Candle for ${pair}`, 'success');
// Reload pair candles
this.getPairCandles({ pair, timeframe, limit: 500 });
}
break;
default:
// Unhandled events ...
@ -870,7 +876,7 @@ export function createBotSubStore(botId: string, botName: string) {
FtWsMessageTypes.whitelist,
FtWsMessageTypes.entryFill,
FtWsMessageTypes.exitFill,
// FtWsMessageTypes.newCandle,
FtWsMessageTypes.newCandle,
/*'new_candle' /*'analyzed_df'*/
],
}),

View File

@ -2,7 +2,7 @@ export enum FtWsMessageTypes {
whitelist = 'whitelist',
entryFill = 'entry_fill',
exitFill = 'exit_fill',
newCandle = 'newCandle',
newCandle = 'new_candle',
}
export interface FtBaseWsMessage {
@ -29,8 +29,14 @@ export interface FtExitFillMessage extends FtBaseWsMessage {
// ...
}
export interface NewCandleMessage {
/** Pair, timeframe, candletype*/
key: [string, string, string];
}
export interface FtNewCandleMessage extends FtBaseWsMessage {
type: FtWsMessageTypes.newCandle;
data: NewCandleMessage;
// ...
}