private void AutoOrdersUpdateGrid() { dataGridViewAOList.GuiAsync(() => { dataGridViewAOList.Rows.Clear(); var list = ObjAutoOrders.ToArray; //ВЫбрать по инструменту if (checkBoxAOSelectSec.Checked) { if (AutoOrderSec.NotIsNull()) { list = list.Where(o => o.SecAndCode == AutoOrderSec.ToString()).ToArray(); } } foreach (var ord in list) { if (ord.NotIsNull()) { var newRow = (DataGridViewRow)dataGridViewAOList.Rows[0].Clone(); newRow.Cells[0].Value = ord.SecAndCode + " " + ord.SecName; newRow.Cells[1].Value = ord.PriceCondition.ToString() + " (" + ord.Volume.ToString() + ")";; newRow.Cells[2].Value = ord.IsBuy() ? "BUY" : "SELL"; newRow.Cells[3].Value = ord.Comment; newRow.Tag = ord; dataGridViewAOList.Rows.Add(newRow); } } }); }
/// <summary> /// /// </summary> private void AutoSLUpdateGrid() { dataGridViewASLList.GuiAsync(() => { dataGridViewASLList.Rows.Clear(); var list = ASLObject.ToArray; //ВЫбрать по инструменту if (checkBoxASLBySec.Checked) { if (StopLossSec.NotIsNull()) { list = list.Where(o => o.SecAndCode == StopLossSec.ToString()).ToArray(); } } foreach (var itemControl in list) { if (itemControl.NotIsNull()) { var newRow = (DataGridViewRow)dataGridViewASLList.Rows[0].Clone(); newRow.Cells[0].Value = itemControl.SecAndCode + " " + itemControl.SecName; newRow.Cells[1].Value = itemControl.Tiks.ToString(); newRow.Cells[2].Value = itemControl.Comment; newRow.Tag = itemControl; dataGridViewASLList.Rows.Add(newRow); } } }); }
private void ControlEvent() { //Контроль расхождения if (numericUpDownDiffPriceControll.Value < DataArb.diffPrice && DataArb.diffPrice > 0 && numericUpDownDiffPriceControll.Value > 0 && numericUpDownFutPos.Value > 0 && checkBoxEnableControl.Checked ) { CountEvent++; if (CountEvent >= 3) { var now = DateTime.Now; if (LastSignal.AddMinutes(PERIOD_SIGNAL) < now) { LastSignal = now; if (checkBoxEnableTrade.Enabled && DataArb.baseCurPos == 0 && DataArb.futCurPos == 0) { activeTrade(); } Form_MessageSignal.Show("Arbitration " + SecFut.ToString() + " <=> " + SecBase.ToString() + " diff: " + DataArb.diffPrice.ToString(), SecFut.ToString(), true); } } } else { //Если за 3 такта не сохранилось расхождение, то сбрасываем CountEvent = 0; } }
/// <summary> /// Удалить все ордера по инструменту /// </summary> /// <param name="sec"></param> public void Delete(Securities sec) { var foundOrd = ListOrders.Where(o => o.SecAndCode == sec.ToString()).ToArray(); if (foundOrd.NotIsNull() && foundOrd.Count() > 0) { foreach (var delOrd in foundOrd) { Delete(delOrd); } } }
/// <summary> /// Проверка, яв-ся рабочим данный инструмент. /// </summary> /// <param name="sec"></param> /// <param name="reloadSec"></param> /// <returns></returns> public bool CheckWorkingSec(Securities sec, bool reloadSec = false) { var list = Global.GetWorkingListSec(reloadSec); foreach (var el in list.ToArray()) { if (el.ToUpper().Contains(sec.ToString().ToUpper())) { return(true); } } return(false); }
private void buttonAddSign_Click(object sender, EventArgs e) { SignalMarket.CondSignal cond = SignalMarket.CondSignal.MoreOrEquals;; var strCond = (string)comboBoxCond.SelectedItem; if (strCond == ">=") { cond = SignalMarket.CondSignal.MoreOrEquals; } else if (strCond == ">") { cond = SignalMarket.CondSignal.More; } else if (strCond == "<=") { cond = SignalMarket.CondSignal.LessOrEquals; } else if (strCond == "<") { cond = SignalMarket.CondSignal.Less; } else if (strCond == "==") { cond = SignalMarket.CondSignal.Equals; } var sec = LastSecSignal.NotIsNull() ? LastSecSignal.ToString() : null; var newSign = new SignalMarket() { Type = SignalMarket.TypeSignal.ByPrice, SecClass = sec, Price = numericUpDownPrice.Value, Condition = cond, Comment = textBoxSignComment.Text }; SignalView.GSMSignaler.AddSignal(newSign); textBoxSignComment.Text = ""; }
private void EventNewSec(IEnumerable <Securities> listSec) { Qlog.CatchException(() => { Securities last = null; foreach (var s in listSec) { var el = DataTrading.AddOrFind(s); last = s; } if (last.NotIsNull()) { ChangeTextMainStatusBar(Trader.Objects.tSecurities.Count + " " + last.ToString()); } }); }
/// <summary> /// /// </summary> private void UpdateGridSignals() { SignalView.constructGridSignals(dataGridViewSignal, Securities.ToString(), () => { LastIndexSelectRow = LastIndexSelectRow < 0 ? 0 : LastIndexSelectRow; LastIndexSelectRow = LastIndexSelectRow >= dataGridViewSignal.Rows.Count ? dataGridViewSignal.Rows.Count - 1 : LastIndexSelectRow; dataGridViewSignal.Rows.ForEach <DataGridViewRow>((row) => { row.Selected = false; if (row.Index == LastIndexSelectRow) { row.Selected = true; dataGridViewSignal.FirstDisplayedScrollingRowIndex = LastIndexSelectRow; } }); /*foreach (DataGridViewRow row in dataGridViewSignal.Rows) * { * * }*/ }); }
/// <summary> /// Обновляем сигналы для графика /// </summary> private void InitGraphicSignals() { Action updateSingnals = () => { GraphicStock.LevelsSignal.SetLevels( SignalView.GSMSignaler.ToArray(). Where(s => s.SecClass == Securities.ToString()). Select(s => s.Price).ToArray() ); UpdateGraphic(); }; SignalView.GSMSignaler.OnAdd += (sig) => { updateSingnals(); }; SignalView.GSMSignaler.OnRemove += (sig) => { updateSingnals(); }; updateSingnals(); }
public static SettingsFormSec New(Securities sec) { var filename = getFilename(sec.ToString()); return(new SettingsFormSec(filename)); }