← Назад

Не приходят свечки если один и тот же инструмент использовать в двух WeightedIndexSecurity

Здравствуйте.

Решил посмотреть что из себя представляет WeightedIndexSecurity. Создал проект в котором создается CandleManager, CandleSeries и т.д. (как описано в документации http://doc.stocksharp.ru/html/b6f4b3fb-3a34-4ba8-bcea-258613f2b455.htm) и получаемые свечи рисуются на графике. Если использую один индекс, то все нормально. но если создаю два графика и хочу вывести разные индексы на разных графиках, но при этом в обоих индексах есть один и тот же инструмент, то второй индекс не строиться. Описание идеи в коде:


private const string _secCode1 = "GZM5";
private const string _secCode2 = "LKM5";
private const string _secCode3 = "SRM5";

private CandleManager _candleManager1;
private CandleManager _candleManager2;
private CandleSeries _indexSeries1;
private CandleSeries _indexSeries2;

readonly TimeSpan _timeFrame = TimeSpan.FromMinutes(1);

private ChartArea _area1;
private ChartArea _area2;
private ChartCandleElement _candlesElem1;
private ChartCandleElement _candlesElem2;
...
_area1 = new ChartArea();
_area2 = new ChartArea();
_chart.Areas.Add(_area1);
_chart.Areas.Add(_area2);

_candlesElem1 = new ChartCandleElement();
_area1.Candles.Add(_candlesElem1);
_candlesElem2 = new ChartCandleElement();
_area2.Candles.Add(_candlesElem2);
...
_candleManager1 = new CandleManager(_trader);
_candleManager1.Processing += DrawCandles1;
_candleManager2 = new CandleManager(_trader);
_candleManager2.Processing += DrawCandles2;
....
///Регистрация QuikTrader как ISecurityProvider
ConfigManager.RegisterService<ISecurityProvider>(_trader);
...

_indexInstr1 = new WeightedIndexSecurity() { Board = ExchangeBoard.Forts, Id = "IndexInstr1" };
_indexInstr1.Weights.Add([b]_instr1[/b], 1);
_indexInstr1.Weights.Add(_instr2, -1);
_indexSeries1 = new CandleSeries(typeof(TimeFrameCandle), _indexInstr1, _timeFrame1) { BuildCandlesMode = BuildCandlesModes.Build };

_indexInstr2 = new WeightedIndexSecurity() { Board = ExchangeBoard.Forts, Id = "IndexInstr2" };
_indexInstr2.Weights.Add([b]_instr1[/b], 1);
_indexInstr2.Weights.Add(_instr3, -1);
_indexSeries2 = new CandleSeries(typeof(TimeFrameCandle), _indexInstr2, _timeFrame1) { BuildCandlesMode = BuildCandlesModes.Build };
...

_candleManager1.Start(_indexSeries1);
_candleManager2.Start(_indexSeries2);

Комментарии (7)

Вход или Создать аккаунт, Войдите или зарегистрируйтесь, чтобы оставить комментарий

Support
Support

Спасибо за информацию. Приведите пожалуйста небольшой пример для воспроизведения ошибки.

Георгий
Георгий Автор

Тестовый проект.

Support
Support

После замены инструментов и перезаказа данных индексы начали строиться. Попробуйте удостовериться, что в программу поступают тиковые данные.

Георгий
Георгий Автор

В первый индекс приходит тиковые данные от двух инструментов. Во второй только от одного. Т.е. в принципе от всех трех инструментов тики приходят. На какие инструменты вы заменили?

Support
Support

Георгий: В первый индекс приходит тиковые данные от двух инструментов. Во второй только от одного. Т.е. в принципе от всех трех инструментов тики приходят. На какие инструменты вы заменили?

Добрый день,

На сентябрьские. Но сейчас нужно уже на декабрьские.

Георгий
Георгий Автор

Support: На сентябрьские. Но сейчас нужно уже на декабрьские.

В примере который прикладывал были выставлены сентябрьские. Может что-то еще было сделано?

Support
Support

Измененные строчки:

private const string _secCode1 = "GZU7";
private const string _secCode2 = "RIU7";
private const string _secCode3 = "SRU7";
_candleSeries1 = new CandleSeries(typeof(TimeFrameCandle), _index1, TimeSpan.FromMinutes(1)) { BuildCandlesMode = BuildCandlesModes.Build };