Ejemplo n.º 1
0
 public static IEnumerable<StockDividend> GetLatest(DynamicNodeContext nodeContext, int count)
 {
     using (var service = new DividendService())
     {
         return service.GetLatest(count).ToList();
     }
 }
Ejemplo n.º 2
0
        public static IEnumerable<StockDividend> GetUpcoming(DynamicNodeContext context, int count)
        {
            using (var service = new DividendService())
            {
                var startDate = DateTime.UtcNow.AddDays(-1);

                return service.GetLatest(count, startDate).ToList();
            }
        }
Ejemplo n.º 3
0
        public static StockDividend Get(DynamicNodeContext nodeContext)
        {
            using (var service = new DividendService())
            {
                var stockCode = GetStockCode();
                var exDate = GetExDate();

                return service.Get(stockCode, exDate);
            }
        }
        //public static void Import()
        //{
        //    var csv = File.ReadAllText(@"D:\Dev\git\FatDividends\_documentation\complete_dividends.csv");
        //}
        public static void Import(StockDividend dividend)
        {
            var dividends = new List<StockDividend> { dividend };

            UpdateClosingPrices(dividends);

            using (var service = new DividendService())
            {
                service.Add(dividends);
            }
        }
Ejemplo n.º 5
0
        public static IEnumerable<StockDividend> Get(DynamicNodeContext nodeContext, int count)
        {
            using (var service = new DividendService())
            {
                var stockCode = GetStockCode();

                if (string.IsNullOrEmpty(stockCode))
                {
                    return service.GetLatest(count).ToList();
                }

                return service.Get(stockCode, count).ToList();
            }
        }
        public static void Import(string csv)
        {
            var csvMapper = new CsvMapper();
            var mappings = new Dictionary<string, int>
                {
                    {"StockCode", 0},
                    {"ExDate", 1},
                    {"Amount", 2},
                    {"Franked", 3},
                    {"FrankingCredit", 4},
                    {"PayableDate", 5}
                };

            var stockDividends = csvMapper.MapCsvTo<StockDividend>(mappings, csv, true).ToList();

            UpdateClosingPrices(stockDividends);

            using (var service = new DividendService())
            {
                service.Add(stockDividends);
            }
        }
Ejemplo n.º 7
0
 public DividendController()
 {
     _dividendService = new DividendService();
 }