using MMoneyCoderSharp.Data.Request;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static MMoneyCoderSharp.DBDefine;

namespace MMoneyCoderSharp.DB
{
    /// <summary>
    /// </summary>
    internal class MapAsia : ADataObject
    {
     
        /// <summary>
        /// 금일 데이터 쿼리
        /// </summary>
         string queryToday = @"SELECT 
                '한국' NAME, 
                round(f_part_idx/100,2) curr_price, 
                round(f_part_chg/100,2) net_chg, 
                f_chg_type chg_type, 
                round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg)) * 100, 2) rate 
            FROM t_index 
            WHERE f_part_code = '001' 
            UNION 
            SELECT 
                decode(f_symb, 'SHS@000001', '중국', 'HSI@HSI', '홍콩', 'NII@NI225', '일본', 'TWS@TI01', '대만') NAME, 
                to_number(f_last) curr_price, 
                to_number(f_diff) net_chg, 
                f_sign chg_type, 
                to_number(f_rate) rate 
            FROM t_world_ix_eq_sise 
            WHERE f_symb in('SHS@000001', 'HSI@HSI', 'NII@NI225', 'TWS@TI01')";

        public override IDataRequest buildData()
        {

            string bufQuery = "";

            bufQuery += String.Format(queryToday);

            mRequestQuery.Add("", bufQuery);

            return this;
        }
    }
}
