About this question
Hard · machine_learning · Quant Researcher interview question · labeling, pandas, finance, triple-barrier
The Triple Barrier Method is a labeling technique used in financial machine learning to characterize the outcome of a trade based on profit-taking, stop-loss, and time limits. By defining dynamic upper and lower price barriers alongside a fixed time horizon, this approach captures the path dependency of returns and aligns training labels with realistic trading constraints. Task Implement a function solution(prices, events, horizon, pt, sl) that determines the outcome label and realized return f