private void 修改ToolStripMenuItem_Click(object sender, EventArgs e) { AASClient.AccountDataSet.快捷键Row 快捷键Row1 = (this.bindingSource1.Current as DataRowView).Row as AASClient.AccountDataSet.快捷键Row; ModifyShortcutForm ModifyShortcutForm1 = new ModifyShortcutForm(快捷键Row1); ModifyShortcutForm1.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { if (this.textBox键名.Text == string.Empty) { MessageBox.Show("键名不能为空"); return; } if (Program.accountDataSet.快捷键.Any(r => r.键名 == this.textBox键名.Text)) { MessageBox.Show("不能重复添加相同快捷键"); return; } AASClient.AccountDataSet.快捷键Row 快捷键Row1 = Program.accountDataSet.快捷键.New快捷键Row(); 快捷键Row1.键名 = this.textBox键名.Text; 快捷键Row1.方向 = this.comboBox方向.SelectedIndex; 快捷键Row1.价格模式 = this.comboBox价格.SelectedIndex; 快捷键Row1.价差模式 = this.comboBox价差模式.SelectedIndex; 快捷键Row1.价差数值 = this.numericUpDown价差数值.Value; 快捷键Row1.股数模式 = this.comboBox股数模式.SelectedIndex; 快捷键Row1.股数数值 = this.numericUpDown股数数值.Value; Program.accountDataSet.快捷键.Add快捷键Row(快捷键Row1); this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { AASClient.AccountDataSet.快捷键Row 快捷键Row1 = (this.bindingSource1.Current as DataRowView).Row as AASClient.AccountDataSet.快捷键Row; ModifyShortcutForm ModifyShortcutForm1 = new ModifyShortcutForm(快捷键Row1); ModifyShortcutForm1.ShowDialog(); }
private void SetInfo(AASClient.AccountDataSet.快捷键Row 快捷键Row1) { decimal BasePrice = 0; 价格模式 价格模式1 = (价格模式)快捷键Row1.价格模式; BasePrice = GetPrice(价格模式1, listView买盘, listView卖盘); if (价格模式1 == 价格模式.处理) { this.numericUpDown价格.Value = 0; } else { 价差模式 价差模式1 = (价差模式)快捷键Row1.价差模式; switch (价差模式1) { case 价差模式.百分之: this.numericUpDown价格.Value = Math.Round(BasePrice * (1 + 快捷键Row1.价差数值 / 100), 8, MidpointRounding.AwayFromZero); break; case 价差模式.数值: this.numericUpDown价格.Value = Math.Round(BasePrice + 快捷键Row1.价差数值, 8, MidpointRounding.AwayFromZero); break; } } }
private void button1_Click(object sender, EventArgs e) { AASClient.AccountDataSet.快捷键Row 快捷键Row1 = Program.accountDataSet.快捷键.First(r => r.键名 == this.textBox键名.Text); 快捷键Row1.方向 = this.comboBox方向.SelectedIndex; 快捷键Row1.价格模式 = this.comboBox价格.SelectedIndex; 快捷键Row1.价差模式 = this.comboBox价差模式.SelectedIndex; 快捷键Row1.价差数值 = this.numericUpDown价差数值.Value; 快捷键Row1.股数模式 = this.comboBox股数模式.SelectedIndex; 快捷键Row1.股数数值 = this.numericUpDown股数数值.Value; this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void comboBox代码_KeyPress(object sender, KeyPressEventArgs e) { try { KeysConverter kc = new KeysConverter(); Keys Keys1 = (Keys)kc.ConvertFromString(e.KeyChar.ToString()); AASClient.AccountDataSet.快捷键Row 快捷键Row1 = Program.accountDataSet.快捷键.FirstOrDefault(r => r.键名 == Keys1.ToString()); if (快捷键Row1 != null) { e.Handled = true; } } catch { } }
private void 除ToolStripMenuItem_Click(object sender, EventArgs e) { AASClient.AccountDataSet.快捷键Row 快捷键Row1 = (this.bindingSource1.Current as DataRowView).Row as AASClient.AccountDataSet.快捷键Row; Program.accountDataSet.快捷键.Remove快捷键Row(快捷键Row1); }
private void HqForm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape && this.panel3.Visible || (DateTime.Now - lastQuickKeyTime).TotalSeconds < 3) { panel3.Visible = false; return; } AASClient.AccountDataSet.快捷键Row 快捷键Row1 = Program.accountDataSet.快捷键.FirstOrDefault(r => r.键名 == e.KeyCode.ToString()); if (快捷键Row1 == null) { return; } 交易方向 交易方向1 = (交易方向)快捷键Row1.方向; if (交易方向1 == 交易方向.修改默认) { var SetDefaultQuantityForm1 = new SetDefaultQuantityForm(this.Zqdm); SetDefaultQuantityForm1.ShowDialog(); } else if (交易方向1 == 交易方向.取消) { this.panel3.Visible = false; } else if (交易方向1 == 交易方向.撤单) { AASClient.AASServiceReference.JyDataSet.委托Row DataRow1 = Program.jyDataSet.委托.FirstOrDefault(r => r.委托编号 == this.Last委托编号); if (DataRow1.证券代码 == this.Zqdm) { string Ret = Program.AASServiceClient.CancelOrder(Program.Current平台用户.用户名, DataRow1.组合号, DataRow1.证券代码, DataRow1.证券名称, DataRow1.市场代码, DataRow1.委托编号, DataRow1.买卖方向, DataRow1.委托数量, DataRow1.委托价格); string[] Data = Ret.Split('|'); if (Data[1] != string.Empty) { Program.logger.LogJy(Program.Current平台用户.用户名, DataRow1.证券代码, DataRow1.证券名称, DataRow1.委托编号, DataRow1.买卖方向, DataRow1.委托数量, DataRow1.委托价格, "撤单失败: {0}", Data[1]); } else { Program.logger.LogJy(Program.Current平台用户.用户名, DataRow1.证券代码, DataRow1.证券名称, DataRow1.委托编号, DataRow1.买卖方向, DataRow1.委托数量, DataRow1.委托价格, "撤单成功"); } } } else if (交易方向1 == 交易方向.全撤) { foreach (AASClient.AASServiceReference.JyDataSet.委托Row DataRow1 in Program.jyDataSet.委托) { if (DataRow1.证券代码 == this.Zqdm && DataRow1.委托数量 > DataRow1.成交数量 + DataRow1.撤单数量) { string Ret = Program.AASServiceClient.CancelOrder(Program.Current平台用户.用户名, DataRow1.组合号, DataRow1.证券代码, DataRow1.证券名称, DataRow1.市场代码, DataRow1.委托编号, DataRow1.买卖方向, DataRow1.委托数量, DataRow1.委托价格); string[] Data = Ret.Split('|'); if (Data[1] != string.Empty) { Program.logger.LogJy(Program.Current平台用户.用户名, DataRow1.证券代码, DataRow1.证券名称, DataRow1.委托编号, DataRow1.买卖方向, DataRow1.委托数量, DataRow1.委托价格, "撤单失败: {0}", Data[1]); } else { Program.logger.LogJy(Program.Current平台用户.用户名, DataRow1.证券代码, DataRow1.证券名称, DataRow1.委托编号, DataRow1.买卖方向, DataRow1.委托数量, DataRow1.委托价格, "撤单成功"); } } } } else { this.panel3.Visible = true; switch (交易方向1) { case 交易方向.买入: case 交易方向.卖出: this.comboBox买卖方向.SelectedIndex = 快捷键Row1.方向; break; case 交易方向.券池融资买入: this.comboBox买卖方向.SelectedIndex = 2; break; case 交易方向.券池融券卖出: this.comboBox买卖方向.SelectedIndex = 3; break; case 交易方向.券池现金买入: this.comboBox买卖方向.SelectedIndex = 4; break; } SetInfo(快捷键Row1); 股数模式 股数模式1 = (股数模式)快捷键Row1.股数模式; switch (股数模式1) { case 股数模式.可用股数的百分之: decimal 可用股数 = 0; if (交易方向1 == 交易方向.买入 || 交易方向1 == 交易方向.券池融资买入) { 可用股数 = this.可买股数; } else if (交易方向1 == 交易方向.卖出 || 交易方向1 == 交易方向.券池融券卖出) { 可用股数 = this.可卖股数; } decimal qty = (可用股数 * 快捷键Row1.股数数值 / 100); this.numericUpDown数量.Value = qty; break; case 股数模式.仓位的百分之: qty = GetCoinQty(快捷键Row1); this.numericUpDown数量.Value = qty; break; case 股数模式.默认值的百分之: qty = (decimal.Parse(Program.accountDataSet.参数.GetParaValue(this.Zqdm + "默认股数", "0")) * 快捷键Row1.股数数值 / 100); this.numericUpDown数量.Value = qty; break; case 股数模式.股数数值: this.numericUpDown数量.Value = 快捷键Row1.股数数值; break; case 股数模式.处理: this.numericUpDown数量.Value = 0; break; } decimal qtyMin, priceMin, notionMin; MarketAdapter.BinanceAdapter.Instance.GetFilter(Zqdm, out priceMin, out qtyMin, out notionMin); numericUpDown价格.DecimalPlaces = MarketAdapter.BinanceUtils.GetDigit(priceMin); numericUpDown价格.Increment = priceMin; numericUpDown价格.Value = numericUpDown价格.Value - numericUpDown价格.Value % priceMin; numericUpDown数量.DecimalPlaces = MarketAdapter.BinanceUtils.GetDigit(qtyMin); numericUpDown数量.Increment = qtyMin; numericUpDown数量.Value = numericUpDown数量.Value - numericUpDown数量.Value % qtyMin; } }
public ModifyShortcutForm(AASClient.AccountDataSet.快捷键Row 快捷键Row1) { InitializeComponent(); this.快捷键Row = 快捷键Row1; }