Syntax
public Spinoff
public string ParentName;
public string ParentTicker;
public string SpinoffName;
public string SpinoffTicker;
public string ExpectedDate;
public StockSpinoffDownloader
public static void StockSpinoffDownloader.DeSerialize()
public List Spinoffs()
public Spinoff FindSymbol(string symbol)
Parameter Description
symbol | A valid U.S. stock symbol to look for the corresponding Spinoff object |
Description
Builds a database of upcoming U.S. stock spinoffs using
StockSpinoffs website as the data source. Call
DeSerialize to download and to cache the data in an XML file in Wealth-Lab's AppData directory. On the first call, there's a slight delay while classification data is being downloaded from the web service. Subsequent calls are instant provided that the cache exists. If the stored data is older than 1 day, on next call it will be automatically refreshed.
An instance of the
Spinoff class contains the following properties for a U.S. stock that is about to have a spinoff: parent company name, parent ticker, spinoff company name, spinoff ticker, expected spinoff date (as text). Before calling the
FindSymbol method with a stock
symbol to return an instance of
Spinoff, call
DeSerialize to avoid delays caused by refreshing the data from the internet.
Finally, the complete database of all stocks about to spinoff is accessible in the
Spinoffs property.
Example
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 spinoffs from cache. Will download and rebuild automatically on absence or obsoleteness.
StockSpinoffDownloader c = StockSpinoffDownloader.DeSerialize();
DrawLabel(PricePane, "Upcoming spinoffs: " + c.Spinoffs.Count.ToString() + Environment.NewLine);
ClearDebug();
PrintDebug( "Upcoming spinoffs: " + c.Spinoffs.Count + "\n" );
foreach( var s in c.Spinoffs ) {
PrintDebug( s );
}
}
}
}