namespace StockSharp.Algo.Candles
{
	using System;
	using System.Collections.Generic;

	using Ecng.ComponentModel;

	using StockSharp.BusinessEntities;

	/// <summary>
	/// Âíåøíèé èñòî÷íèê ñâå÷åê (íàïðèìåð, ïîäêëþ÷åíèå <see cref="IConnector"/>, ïðåäîñòàâëÿþùåå âîçìîæíîñòü ïîëó÷åíèÿ ãîòîâûõ ñâå÷åê).
	/// </summary>
	public interface IExternalCandleSource
	{
		/// <summary>
		/// Ïîëó÷èòü âðåìåííûå äèàïàçîíû, äëÿ êîòîðûõ ó äàííîãî èñòî÷íèêàõ äëÿ ïåðåäàâàåìîé ñåðèè ñâå÷åê åñòü äàííûå.
		/// </summary>
		/// <param name="series">Ñåðèÿ ñâå÷åê.</param>
		/// <returns>Âðåìåííûå äèàïàçîíû.</returns>
		IEnumerable<Range<DateTimeOffset>> GetSupportedRanges(CandleSeries series);

		/// <summary>
		/// Ñîáûòèå ïîÿâëåíèÿ íîâûõ ñâå÷åê, ïîëó÷åííûõ ïîñëå ïîäïèñêè ÷åðåç <see cref="SubscribeCandles"/>.
		/// </summary>
		event Action<CandleSeries, IEnumerable<Candle>> NewCandles;

		/// <summary>
		/// Ïîäïèñàòüñÿ íà ïîëó÷åíèå ñâå÷åê.
		/// </summary>
		/// <param name="series">Ñåðèÿ ñâå÷åê.</param>
		/// <param name="from">Íà÷àëüíàÿ äàòà, ñ êîòîðîé íåîáõîäèìî ïîëó÷àòü äàííûå.</param>
		/// <param name="to">Êîíå÷íàÿ äàòà, äî êîòîðîé íåîáõîäèìî ïîëó÷àòü äàííûå.</param>
		void SubscribeCandles(CandleSeries series, DateTimeOffset from, DateTimeOffset to);

		/// <summary>
		/// Îñòàíîâèòü ïîäïèñêó ïîëó÷åíèÿ ñâå÷åê, ðàíåå ñîçäàííóþ ÷åðåç <see cref="SubscribeCandles"/>.
		/// </summary>
		/// <param name="series">Ñåðèÿ ñâå÷åê.</param>
		void UnSubscribeCandles(CandleSeries series);
	}
}