# Candlesticks listener
Candlesticks can be listened through the watchPeriods
and timeframes
directives.
- Example
import { marketWatcher, MidaTimeframe, } from "@reiryoku/mida";
const watcher = await marketWatcher({ tradingAccount: myAccount, });
await watcher.watch("XAUUSD", {
watchPeriods: true,
timeframes: [ MidaTimeframe.H1, ],
});
watcher.on("period-update", (event) => {
const { period, } = event.descriptor;
const goldClosePrice = period.close; // Temporary close price
});
watcher.on("period-close", (event) => {
const { period, } = event.descriptor;
const goldClosePrice = period.close; // Final close price
});