Esempio n. 1
0
        public FormPlaceOrder(OTCDataSet ds)
        {
            this.redis_db = ds.CreateRedisConnection();
            InitializeComponent();
            this.timer.Interval = 500;
            this.timer.Tick    += new EventHandler(timer_Update);
            this.comboBoxEntityCode.SelectedIndexChanged     += new EventHandler(SetMaxQuantity);
            this.comboBoxOrderType.SelectedIndexChanged      += new EventHandler(SetMaxQuantity);
            this.comboBoxTargetClientID.SelectedIndexChanged += new EventHandler(SetMaxQuantity);

            this.comboBoxContractCode.SelectedIndexChanged += new EventHandler(SetMaxQuantity);
            this.comboBoxContractCode.SelectedIndexChanged += new EventHandler(SetCloseTargetIDs);
            this.comboBoxContractCode.SelectedIndexChanged += new EventHandler(updateContractInfo);

            this.comboBoxLongShort.SelectedIndexChanged += new EventHandler(SetMaxQuantity);
            this.comboBoxLongShort.SelectedIndexChanged += new EventHandler(SetCloseTargetIDs);

            this.comboBoxOpenClose.SelectedIndexChanged += new EventHandler(SetMaxQuantity);

            this.numericUpDownPrice.ValueChanged += new EventHandler(SetMaxQuantity);
            this.numericUpDownPrice.ValueChanged += new EventHandler(ComputeValue);

            this.numericUpDownQuantity.ValueChanged += new EventHandler(ComputeValue);

            this.dataset = ds;
            this.comboBoxOrderType.Items.AddRange(new String[] { "期权", "期货" });
            this.comboBoxLongShort.Items.AddRange(new String[] { "买入", "卖出" });
            this.comboBoxLongShort.Text = "买入";
            this.comboBoxOpenClose.Items.AddRange(new String[] { "开仓", "平仓" });
            this.comboBoxOpenClose.Text          = "开仓";
            this.comboBoxOrderType.SelectedIndex = 0;
            timer.Start();
        }
Esempio n. 2
0
 public FormAddClient(OTCDataSet ds)
 {
     InitializeComponent();
     this.dataset = ds;
     table        = this.dataset.Tables["client_info"];
     InitializeInfo();
 }
 public FormAddOptionsType(OTCDataSet ds)
 {
     InitializeComponent();
     this.dataset = ds;
     table = this.dataset.Tables["options_types"];
     
 }
 public FormTradingDatesSetting(OTCDataSet ds):this()
 { 
     this.dataset = ds;
     this.listBoxNonTradeDay.DataSource = ds.Tables["non_trade_dates"];
     this.listBoxNonTradeDay.ValueMember = "non_trade_dates";
     this.listBoxNonTradeDay.DisplayMember = "non_trade_dates";
 }
 public FormAddOptionsContract(OTCDataSet ds)
 {
     InitializeComponent();
     this.dataset = ds;
     table = this.dataset.Tables["options_contracts"];
     foreach (DataRow row in this.dataset.Tables["futures_contracts"].Rows)
     {
         this.comboBoxUnderlyingCode.Items.Add(row["合约代码"].ToString());
     }
     if (this.comboBoxUnderlyingCode.Items.Count != 0)
     {
         this.comboBoxUnderlyingCode.SelectedIndex = 0;
     }
     foreach (DataRow row in this.dataset.Tables["options_types"].Rows)
     {
         this.comboBoxOptionsType.Items.Add(row[0].ToString()+'-'+row[1].ToString());
     }
     if (this.comboBoxOptionsType.Items.Count != 0)
     {
         this.comboBoxOptionsType.SelectedIndex = 0;
     }
     this.comboBoxOptionsDirection.Items.AddRange(new String[]{ "认购","认沽"});
     this.comboBoxOptionsDirection.SelectedIndex = 0;
     this.dateTimePickerMaturityDate.Value = DateTime.Today.AddDays(1);
 }
Esempio n. 6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            DatabaseManager dbManager = new DatabaseManager();

            try {
                if (new Login(dbManager).ShowDialog() == DialogResult.OK)
                {
                    var        logging_form = new FormLogging();
                    OTCDataSet dataset      = new OTCDataSet("otc", dbManager);
                    logging_form.Close();
                    Application.Run(new MainWindow(dataset));
                }
            }
            catch (StackExchange.Redis.RedisConnectionException e)
            {
                MessageBox.Show(string.Format("Redis连接错误:请重新登录。\n错误信息:{0}", e.Message), "错误");
                if (new Login(dbManager).ShowDialog() == DialogResult.OK)
                {
                    OTCDataSet dataset = new OTCDataSet("otc", dbManager);
                    Application.Run(new MainWindow(dataset));
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException e)
            {
                MessageBox.Show(string.Format("Mysql错误。\n错误信息:{0}", e.Message), "错误");
                if (new Login(dbManager).ShowDialog() == DialogResult.OK)
                {
                    OTCDataSet dataset = new OTCDataSet("otc", dbManager);
                    Application.Run(new MainWindow(dataset));
                }
            }
        }
 public FormTradingDatesSetting(OTCDataSet ds) : this()
 {
     this.dataset = ds;
     this.listBoxNonTradeDay.DataSource    = ds.Tables["non_trade_dates"];
     this.listBoxNonTradeDay.ValueMember   = "non_trade_dates";
     this.listBoxNonTradeDay.DisplayMember = "non_trade_dates";
 }
Esempio n. 8
0
        public FormPlaceOrder(OTCDataSet ds)
        {

            this.redis_db = ds.CreateRedisConnection();
            InitializeComponent();
            this.timer.Interval = 500;
            this.timer.Tick += new EventHandler(timer_Update);
            this.comboBoxEntityCode.SelectedIndexChanged += new EventHandler(SetMaxQuantity);
            this.comboBoxOrderType.SelectedIndexChanged += new EventHandler(SetMaxQuantity);
            this.comboBoxTargetClientID.SelectedIndexChanged += new EventHandler(SetMaxQuantity);

            this.comboBoxContractCode.SelectedIndexChanged += new EventHandler(SetMaxQuantity);
            this.comboBoxContractCode.SelectedIndexChanged += new EventHandler(SetCloseTargetIDs);
            this.comboBoxContractCode.SelectedIndexChanged += new EventHandler(updateContractInfo);

            this.comboBoxLongShort.SelectedIndexChanged += new EventHandler(SetMaxQuantity);
            this.comboBoxLongShort.SelectedIndexChanged += new EventHandler(SetCloseTargetIDs);

            this.comboBoxOpenClose.SelectedIndexChanged += new EventHandler(SetMaxQuantity);

            this.numericUpDownPrice.ValueChanged += new EventHandler(SetMaxQuantity);
            this.numericUpDownPrice.ValueChanged += new EventHandler(ComputeValue);

            this.numericUpDownQuantity.ValueChanged += new EventHandler(ComputeValue);

            this.dataset = ds;
            this.comboBoxOrderType.Items.AddRange(new String[]{"期权","期货"});
            this.comboBoxLongShort.Items.AddRange(new String[] { "买入", "卖出" });
            this.comboBoxLongShort.Text = "买入";
            this.comboBoxOpenClose.Items.AddRange(new String[] { "开仓", "平仓" });
            this.comboBoxOpenClose.Text = "开仓";
            this.comboBoxOrderType.SelectedIndex = 0;
            timer.Start();
        }
Esempio n. 9
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     DatabaseManager dbManager = new DatabaseManager();
     try {
         if (new Login(dbManager).ShowDialog() == DialogResult.OK)
         {
             var logging_form = new FormLogging();
             OTCDataSet dataset = new OTCDataSet("otc", dbManager);
             logging_form.Close();
             Application.Run(new MainWindow(dataset));
         }
     }
     catch (StackExchange.Redis.RedisConnectionException e)
     {
         MessageBox.Show(string.Format("Redis连接错误:请重新登录。\n错误信息:{0}", e.Message), "错误");
         if (new Login(dbManager).ShowDialog() == DialogResult.OK)
         {
             OTCDataSet dataset = new OTCDataSet("otc", dbManager);
             Application.Run(new MainWindow(dataset));
         }
     }
     catch (MySql.Data.MySqlClient.MySqlException e)
     {
         MessageBox.Show(string.Format("Mysql错误。\n错误信息:{0}", e.Message), "错误");
         if (new Login(dbManager).ShowDialog() == DialogResult.OK)
         {
             OTCDataSet dataset = new OTCDataSet("otc", dbManager);
             Application.Run(new MainWindow(dataset));
         }
     }
 }
Esempio n. 10
0
 public FormAddClient(OTCDataSet ds)
 {
     InitializeComponent();
     this.dataset = ds;
     table = this.dataset.Tables["client_info"];
     InitializeInfo();
 }
Esempio n. 11
0
 public FormQuotes(OTCDataSet ds)
 {
     InitializeComponent();
     dataset = ds;
     linkEvents();
     InitilizeUserComponent();
 }
Esempio n. 12
0
 public FormQuotes(OTCDataSet ds)
 {
     InitializeComponent();
     dataset = ds;
     linkEvents();
     InitilizeUserComponent();
 }
Esempio n. 13
0
 public FormAddOptionsContract(OTCDataSet ds)
 {
     InitializeComponent();
     this.dataset = ds;
     table        = this.dataset.Tables["options_contracts"];
     foreach (DataRow row in this.dataset.Tables["futures_contracts"].Rows)
     {
         this.comboBoxUnderlyingCode.Items.Add(row["合约代码"].ToString());
     }
     if (this.comboBoxUnderlyingCode.Items.Count != 0)
     {
         this.comboBoxUnderlyingCode.SelectedIndex = 0;
     }
     foreach (DataRow row in this.dataset.Tables["options_types"].Rows)
     {
         this.comboBoxOptionsType.Items.Add(row[0].ToString() + '-' + row[1].ToString());
     }
     if (this.comboBoxOptionsType.Items.Count != 0)
     {
         this.comboBoxOptionsType.SelectedIndex = 0;
     }
     this.comboBoxOptionsDirection.Items.AddRange(new String[] { "认购", "认沽" });
     this.comboBoxOptionsDirection.SelectedIndex = 0;
     this.dateTimePickerMaturityDate.Value       = DateTime.Today.AddDays(1);
 }
Esempio n. 14
0
 public MainWindow(OTCDataSet dataset)
 {
     InitializeComponent();
     this.dataset = dataset;
     SetDataSource();
     FormatTable();
     LinkEventsHandlers();
     this.timerUpdate.Start();
 }
Esempio n. 15
0
 public MainWindow(OTCDataSet dataset)
 {
     InitializeComponent();
     this.dataset = dataset;
     SetDataSource();
     FormatTable();
     LinkEventsHandlers();
     this.timerUpdate.Start();
 }
 public void GenerateBusinessReportTest()
 {
     string sql_conn_str = "server = 10.2.7.210; user id = tanzehuan; password = 80027111t; database = otc_test; characterset = utf8; port = 3306";
     string redis_conn_str = "10.2.7.210:6379, password=Finders6";
     OTCDataSet dataset = new OTCDataSet(sql_conn_str, redis_conn_str);
     SettlementReports sr = new SettlementReports(dataset);
     sr.GenerateBusinessReport(new DateTime(2016, 5, 23));
     sr.GenerateOptionReport(new DateTime(2016, 5, 23));
     sr.GenerateDetailedReport(new DateTime(2016, 5, 23));
 }
Esempio n. 17
0
 public FormSettlement(OTCDataSet ds)
 {
     InitializeComponent();
     dataset = ds;
     this.dateTimePickerSettleDate.Value    = DateTime.Today;
     this.dataGridViewOptionInfo.DataSource = dataset;
     this.dataGridViewOptionInfo.DataMember = "option_settle_info_view";
     this.dataGridViewFutureInfo.DataSource = dataset;
     this.dataGridViewFutureInfo.DataMember = "future_settle_info_view";
 }
Esempio n. 18
0
 public FormSettlement(OTCDataSet ds)
 {
     InitializeComponent();
     dataset = ds;
     this.dateTimePickerSettleDate.Value = DateTime.Today;
     this.dataGridViewOptionInfo.DataSource = dataset;
     this.dataGridViewOptionInfo.DataMember = "option_settle_info_view";
     this.dataGridViewFutureInfo.DataSource = dataset;
     this.dataGridViewFutureInfo.DataMember = "future_settle_info_view";
 }
 public FormModifyOptionsType(OTCDataSet ds)
 {
     InitializeComponent();
     this.dataset = ds;
     table = this.dataset.Tables["options_types"];
     foreach (DataRow row in table.Rows)
     {
         this.comboBoxOptionsTypeCode.Items.Add(row[0].ToString());
     }
     if (this.comboBoxOptionsTypeCode.Items.Count > 0)
     {
         this.comboBoxOptionsTypeCode.SelectedIndex = 0;
     }
 }
 public FormModifyOptionsType(OTCDataSet ds)
 {
     InitializeComponent();
     this.dataset = ds;
     table        = this.dataset.Tables["options_types"];
     foreach (DataRow row in table.Rows)
     {
         this.comboBoxOptionsTypeCode.Items.Add(row[0].ToString());
     }
     if (this.comboBoxOptionsTypeCode.Items.Count > 0)
     {
         this.comboBoxOptionsTypeCode.SelectedIndex = 0;
     }
 }
Esempio n. 21
0
 public FormFuturesAccountCashflow(OTCDataSet ds, uint future_account_no)
 {
     InitializeComponent();
     this.dataset = ds;
     this.comboBoxCashFlowType.SelectedIndex = 0;
     this.table = this.dataset.Tables["futures_cashflow"];
     foreach (DataRow row in this.dataset.Tables["futures_account_info"].Rows)
     {
         this.comboBoxFuturesAccount.Items.Add(row["期货账号"].ToString());
     }
     if (this.comboBoxFuturesAccount.Items.Count > 0)
     {
         this.comboBoxFuturesAccount.SelectedIndex = this.comboBoxFuturesAccount.FindString(future_account_no.ToString("00000000"));
     }
 }
 public FormFuturesAccountCashflow(OTCDataSet ds, uint future_account_no)
 {
     InitializeComponent();
     this.dataset = ds;
     this.comboBoxCashFlowType.SelectedIndex = 0;
     this.table = this.dataset.Tables["futures_cashflow"];
     foreach (DataRow row in this.dataset.Tables["futures_account_info"].Rows)
     {
         this.comboBoxFuturesAccount.Items.Add(row["期货账号"].ToString());
     }
     if (this.comboBoxFuturesAccount.Items.Count>0)
     {
         this.comboBoxFuturesAccount.SelectedIndex = this.comboBoxFuturesAccount.FindString(future_account_no.ToString("00000000"));
     }
 }
Esempio n. 23
0
 public FormClientCashFlow(OTCDataSet ds, uint client_id)
 {
     InitializeComponent();
     this.dataset = ds;
     this.table   = dataset.Tables["client_cashflow"];
     this.comboBoxCashFlowType.SelectedIndex = 0;
     foreach (DataRow row in this.dataset.Tables["client_info"].Rows)
     {
         this.comboBoxClientInfo.Items.Add(row.Field <uint>("客户编号").ToString("00000000") + '-' + row["客户名称"].ToString());
     }
     if (this.comboBoxClientInfo.Items.Count > 0)
     {
         this.comboBoxClientInfo.SelectedIndex = this.comboBoxClientInfo.FindString(client_id.ToString("00000000"));
     }
 }
 public FormAddFuturesContract(OTCDataSet ds)
 {
     InitializeComponent();
     this.dataset = ds;
     table        = this.dataset.Tables["futures_contracts"];
     this.radioButtonAbsCommission.Select();
     foreach (DataRow row in this.dataset.Tables["commodity_category"].Rows)
     {
         this.comboBoxUnderlyingCode.Items.Add(row[1].ToString() + '-' + row[0].ToString());
     }
     if (this.comboBoxUnderlyingCode.Items.Count != 0)
     {
         this.comboBoxUnderlyingCode.SelectedIndex = 0;
     }
 }
 public FormAddFuturesContract(OTCDataSet ds)
 {
     InitializeComponent();
     this.dataset = ds;
     table = this.dataset.Tables["futures_contracts"];
     this.radioButtonAbsCommission.Select();
     foreach (DataRow row in this.dataset.Tables["commodity_category"].Rows)
     {
         this.comboBoxUnderlyingCode.Items.Add(row[1].ToString()+'-'+row[0].ToString());
     }
     if (this.comboBoxUnderlyingCode.Items.Count != 0)
     {
         this.comboBoxUnderlyingCode.SelectedIndex = 0;
     }
 }
 public FormClientCashFlow(OTCDataSet ds, uint client_id)
 {
     InitializeComponent();
     this.dataset = ds;
     this.table = dataset.Tables["client_cashflow"];
     this.comboBoxCashFlowType.SelectedIndex = 0;
     foreach (DataRow row in this.dataset.Tables["client_info"].Rows)
     {
         this.comboBoxClientInfo.Items.Add(row.Field<uint>("客户编号").ToString("00000000") + '-' + row["客户名称"].ToString());
     }
     if (this.comboBoxClientInfo.Items.Count > 0)
     {
         this.comboBoxClientInfo.SelectedIndex = this.comboBoxClientInfo.FindString(client_id.ToString("00000000"));
     }
     
 }
Esempio n. 27
0
 public FormModifyClient(OTCDataSet ds, uint client_id)
 {
     InitializeComponent();
     this.dataset = ds;
     DataTable table = this.dataset.Tables["client_info"];
     foreach (DataRow dr in dataset.Tables["futures_account_info"].Rows)
     {
         this.comboBoxFuturesAccount.Items.Add(dr["期货账号"]);
     }
     foreach (DataRow row in table.Rows)
     {
         this.comboBoxClientID.Items.Add(row.Field<uint>("客户编号").ToString("00000000"));
     }
     if (this.comboBoxClientID.Items.Count > 0)
     {
         this.comboBoxClientID.SelectedIndex = this.comboBoxClientID.FindStringExact(client_id.ToString("00000000"));
     }
 }
Esempio n. 28
0
        public FormModifyClient(OTCDataSet ds, uint client_id)
        {
            InitializeComponent();
            this.dataset = ds;
            DataTable table = this.dataset.Tables["client_info"];

            foreach (DataRow dr in dataset.Tables["futures_account_info"].Rows)
            {
                this.comboBoxFuturesAccount.Items.Add(dr["期货账号"]);
            }
            foreach (DataRow row in table.Rows)
            {
                this.comboBoxClientID.Items.Add(row.Field <uint>("客户编号").ToString("00000000"));
            }
            if (this.comboBoxClientID.Items.Count > 0)
            {
                this.comboBoxClientID.SelectedIndex = this.comboBoxClientID.FindStringExact(client_id.ToString("00000000"));
            }
        }
 public FormModifyOptionsContract(OTCDataSet ds, string contract_code)
 {
     InitializeComponent();
     this.dataset = ds;
     table        = this.dataset.Tables["options_contracts"];
     foreach (DataRow row in this.dataset.Tables["futures_contracts"].Rows)
     {
         this.comboBoxUnderlyingCode.Items.Add(row["合约代码"].ToString());
     }
     foreach (DataRow row in this.dataset.Tables["options_types"].Rows)
     {
         this.comboBoxOptionsType.Items.Add(row[0].ToString() + '-' + row[1].ToString());
     }
     this.comboBoxOptionsDirection.Items.AddRange(new String[] { "认购", "认沽" });
     foreach (DataRow row in table.Rows)
     {
         this.comboBoxOptionsContractCode.Items.Add(row["合约代码"]);
     }
     if (this.comboBoxOptionsContractCode.Items.Count > 0)
     {
         this.comboBoxOptionsContractCode.SelectedIndex = this.comboBoxOptionsContractCode.FindStringExact(contract_code);
     }
 }
 public FormModifyOptionsContract(OTCDataSet ds, string contract_code)
 {
     InitializeComponent();
     this.dataset = ds;
     table = this.dataset.Tables["options_contracts"];
     foreach (DataRow row in this.dataset.Tables["futures_contracts"].Rows)
     {
         this.comboBoxUnderlyingCode.Items.Add(row["合约代码"].ToString());
     }
     foreach (DataRow row in this.dataset.Tables["options_types"].Rows)
     {
         this.comboBoxOptionsType.Items.Add(row[0].ToString()+'-'+row[1].ToString());
     }
     this.comboBoxOptionsDirection.Items.AddRange(new String[]{ "认购","认沽"});
     foreach (DataRow row in table.Rows)
     {
         this.comboBoxOptionsContractCode.Items.Add(row["合约代码"]);
     }
     if (this.comboBoxOptionsContractCode.Items.Count > 0)
     {
         this.comboBoxOptionsContractCode.SelectedIndex = this.comboBoxOptionsContractCode.FindStringExact(contract_code);
     }
 }
Esempio n. 31
0
        public FormPlaceOrder(OTCDataSet ds, String instrType, DataGridViewRow row) : this(ds)
        {
            this.textBoxClientName.Enabled = false;

            this.numericUpDownPrice.ValueChanged -= new EventHandler(ComputeValue);

            this.dataset = ds;
            this.comboBoxOpenClose.Text          = "平仓";
            this.comboBoxOrderType.SelectedIndex = 0;
            if (instrType == "期货")
            {
                this.SetAsFuturesCloseOrderForm(row);
            }
            else if (instrType == "期权")
            {
                this.SetAsOptionsCloseOrderForm(row);
            }
            else
            {
                MessageBox.Show("未知的产品种类。", "错误");
                this.Close();
            }
        }
Esempio n. 32
0
        public FormPlaceOrder(OTCDataSet ds, String instrType, DataGridViewRow row):this(ds)
        {

            this.textBoxClientName.Enabled = false;

            this.numericUpDownPrice.ValueChanged -= new EventHandler(ComputeValue);

            this.dataset = ds;
            this.comboBoxOpenClose.Text = "平仓";
            this.comboBoxOrderType.SelectedIndex = 0;
            if (instrType == "期货")
            {
                this.SetAsFuturesCloseOrderForm(row);
            }
            else if (instrType == "期权")
            {
                this.SetAsOptionsCloseOrderForm(row);
            }
            else
            {
                MessageBox.Show("未知的产品种类。", "错误");
                this.Close();
            }
        }
 public FormAddOptionsType(OTCDataSet ds)
 {
     InitializeComponent();
     this.dataset = ds;
     table        = this.dataset.Tables["options_types"];
 }
Esempio n. 34
0
 public SettlementReports(OTCDataSet ds)
 {
     dataset = ds;
 }
Esempio n. 35
0
 public SettlementReports(OTCDataSet ds)
 {
     dataset = ds;
 }