using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MMoneyCoderSharp.Data.Request.봉차트
{
    internal class Candleforeign : ACandleData
    {
        public Candleforeign(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength, string recvStockCode) : base(recvDataType, recvDataLength)
        {

            this.mStockCode = recvStockCode;

        }

        protected override void setQuery()
        {

            #region 지수

            //this.queryIndexNow = @"select distinct a.f_input_name name, b.F_xYMD,  round(b.f_last,2) part_idx, b.f_sign chg_type, 
            //ABS(round(b.f_diff, 2))  part_chg, round(b.f_rate, 2) rate 
            //from t_world_ix_eq_master a, t_world_ix_eq_sise b 
            //where a.f_symb = b.f_symb 
            //    and a.f_input_name like '{0}' 
            //    and b.f_fdtc = '0'";

            this.queryIndexNow = @"select distinct a.f_input_name name, b.F_xYMD,  round(b.f_last, 2) part_idx, b.f_sign chg_type, 
            ABS(round(b.f_diff, 2))  part_chg, round(b.f_rate, 2) rate 
            from t_world_ix_eq_master a, t_world_ix_eq_sise b 
    where a.f_symb = b.f_symb 
        and a.f_input_name like '{0}'
        and b.f_fdtc in ('0', '1')";

            this.queryIndexLast = @"select name, F_xYMD ymd,   part_idx, chg_type,  part_chg,  rate, high, open, low 
            from(select distinct a.f_input_name name, b.F_xYMD, round(b.f_last, 2) part_idx, b.f_sign chg_type, 
                b.f_high high, b.f_open open, b.f_low low, 
                ABS(round(b.f_diff, 2))  part_chg, round(b.f_rate, 2) rate 
                from t_world_ix_eq_master a, t_world_ix_eq_his b 
                where a.f_symb = b.f_symb 
                    and a.f_input_name like '{1}'
                    and b.f_fdtc in ( '0','1') 
                    order by b.F_xYMD desc) 
                where rownum <= {0} order by ymd asc";


            

            #endregion


        }


    }
}
