Exemplo n.º 1
0
        public static List <FundAssetConfig> GetFundAssetConfigs(string fundCode)
        {
            var configs = DataDao.GetFundAssetConfigs(fundCode);

            if (DataHelper.IsDataReady(configs?.LastOrDefault()))
            {
                return(configs);
            }
            else
            {
                configs = EmService.GetFundAssetConfigs(fundCode);
                DataDao.UpdateFundAssetConfigs(configs);
                return(configs);
            }
        }
Exemplo n.º 2
0
        public static async Task <List <FundStockPosition> > GetFundStockPositions(string fundCode, DateTime date)
        {
            var positions = DataDao.GetFundStockPositions(fundCode, date);

            if (DataHelper.IsDataReady(positions?.FirstOrDefault()))
            {
                return(positions);
            }
            else
            {
                positions = await EmService.GetFundStockPositions(fundCode, date);

                DataDao.UpdateFundStockPositions(positions);
                return(positions);
            }
        }
Exemplo n.º 3
0
        public static async Task <List <FundScale> > GetFundScales(string fundCode)
        {
            var scales = DataDao.GetFundScales(fundCode);

            if (DataHelper.IsDataReady(scales?.LastOrDefault()))
            {
                return(scales);
            }
            else
            {
                scales = await EmService.GetFundScales(fundCode);

                DataDao.UpdateFundScales(scales);
                return(scales);
            }
        }
Exemplo n.º 4
0
        public static async Task <List <FundNav> > GetFundNavs(string fundCode)
        {
            var navs = DataDao.GetFundNavs(fundCode);

            if (DataHelper.IsDataReady(navs?.LastOrDefault()))
            {
                return(navs);
            }
            else
            {
                navs = await EmService.GetFundNavs(fundCode);

                DataDao.UpdateFundNavs(navs);
                return(navs);
            }
        }
Exemplo n.º 5
0
        public static FundInfo GetFundInfo(string fundCode)
        {
            var info = DataDao.GetFundInfo(fundCode);

            if (DataHelper.IsDataReady(info))
            {
                return(info);
            }
            else
            {
                var noData = info == null;
                info = EmService.GetFundInfo(fundCode);
                if (noData)
                {
                    DataDao.InsertFundInfo(info);
                }
                else
                {
                    DataDao.UpdateFundInfo(info);
                }
                return(info);
            }
        }