public UpcomingSplitpublic string Payable; public DateTime ExDate; public string Company; public string Symbol; public string Ratio; public string AnnouncementDate;
public enum SplitProvider { Fidelity, Yahoo, Briefing, Nasdaq, NotDefined, All }
public UpcomingSplitDownloader public UpcomingSplitDownloader(SplitProvider provider)public static void UpcomingSplitDownloader.DeSerialize()public List<UpcomingSplit> Splits public UpcomingSplit FindSymbol(string symbol) public UpcomingSplit FindSymbol(string symbol, SplitProvider provider public bool IsStockSplit(string symbol, DateTime dt) public bool IsStockSplit(string symbol, DateTime dt, SplitProvider provider public double SplitFactor(string symbol, DateTime dt) public double SplitFactor(string symbol, DateTime dt, SplitProvider provider
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using Community.Components; /*** Requires installation of Community.Components Extension from www.wealth-lab.com > Extensions ***/namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { ClearDebug(); // Attempts to read splits from cache. Will download and rebuild automatically on absence or obsoleteness (every day) //var c = new UpcomingSplitDownloader(SplitProvider.All); //var c = new UpcomingSplitDownloader(); var c = new UpcomingSplitDownloader(SplitProvider.Fidelity); c = UpcomingSplitDownloader.DeSerialize(); DrawLabel(PricePane, "Upcoming splits: " + c.Splits.Count.ToString() + Environment.NewLine); ClearDebug(); PrintDebug( "Upcoming splits: " + c.Splits.Count + "\n" ); foreach( var s in c.Splits ) { PrintDebug( s ); } bool split = c.IsStockSplit( Bars.Symbol, Bars.Date[Bars.Count-1] ); DrawLabel(PricePane, "Current symbol " + (split ? "splits today!" : "doesn't split today") + Environment.NewLine); //TEST: Get ratio of AAPL 2014/06/09 split, if still present in cache double ratio = c.SplitFactor( "AAPL", new DateTime(2014,06,09) ); DrawLabel(PricePane, "AAPL 2014/06/09 split factor: " + Bars.FormatValue(ratio).ToString() + Environment.NewLine); } } }