Beispiel #1
0
 public void SetFutureInfo_2(UsdFutureInfo ufi2)
 {
     this.UFI2 = ufi2;
 }
Beispiel #2
0
 public void SetFutureInfo_1(UsdFutureInfo ufi)
 {
     this.UFI = ufi;
 }
 UsdFutureInfo GetUsdFutureInfo2_Raw()
 {
     if (_ufi2 == null)
     {
         _ufi2 = GetUsdFutureInfoFromDB(1);
     }
     return _ufi2;
 }
        UsdFutureInfo GetUsdFutureInfoFromDB(short futureSeriesOffset)
        {
            DBManager dbManager = new DBManager();
            MySqlConnection con = null;

            try
            {
                String ip = ConfigManager.Ins().Config.GetValue(ConfigKeyConst.DB_SERVER_IP);
                con = dbManager.CreateConnection(ip, CommonConst.DATABASE_MADVIPER);
                con.Open();

                String query = "select * from usd_future_info order by maturity";

                MySqlCommand cmd = new MySqlCommand(query, con);
                MySqlDataAdapter dataAdapter = new MySqlDataAdapter(cmd);

                DataSet ds = new DataSet("query_result");

                dataAdapter.Fill(ds, "query_result");
                DataRowCollection drc = ds.Tables["query_result"].Rows;

                if (drc.Count != 2)
                {
                    logger.Error("DB에 Usd future 정보가 두개가 아닙니다.");
                    Util.KillWithNotice("DB에 Usd future 정보가 두개가 아닙니다.");
                }

                Trace.Assert(futureSeriesOffset == 0 || futureSeriesOffset == 1);

                DataRow dr = drc[futureSeriesOffset];

                String code = dr["code"].ToString();
                DateTime maturity = Convert.ToDateTime(dr["maturity"]);

                UsdFutureInfo ufi = new UsdFutureInfo();
                ufi.Code = code;
                ufi.Maturity = maturity;

                ds.Clear();

                return ufi;
            }
            catch (System.Exception ex)
            {
                logger.Warn(ex.ToString());
            }
            finally
            {
                dbManager.Close(con);
            }
            return null;
        }
 UsdFutureInfo GetUsdFutureInfo_Raw()
 {
     if (_ufi1 == null)
     {
         _ufi1 = GetUsdFutureInfoFromDB(0);
     }
     return _ufi1;
 }