# Last live candlestick

The last live candlestick of a symbol in a timeframe can be retrieved using a MarketWatcher.

  • Example
import {
    info,
    MidaMarketWatcher,
    MidaTimeframe,
} from "@reiryoku/mida";

// Listen to the last ETHUSD live candlestick on the M30 timeframe
const marketWatcher = new MidaMarketWatcher({ tradingAccount: myAccount, }); 
let lastM30Candle = undefined;

await marketWatcher.watch("ETHUSD", {
    watchPeriods: true,
    timeframes: [ MidaTimeframe.M30, ],
});

marketWatcher.on("period-update", (event) => {
    lastM30Candle = event.descriptor.period;
    
    info(`Last live close price ${lastM30Candle.close}`);
});