Beispiel #1
0
        public static void SaveIncomeStatements( string fileName, CompanyInfo ci )
        {
            fileName = fileName.Contains( ".xslx" ) ? fileName : fileName + ".xlsx";
            System.IO.FileInfo fi = new System.IO.FileInfo( fileName );
            pck = new ExcelPackage( fi );

            foreach ( IncomeStatement IS in ci.IncomeStatements )
            {
                CreateIndividualIncomeStatement( IS );
            }
            pck.Save( );
            pck = null;
        }
Beispiel #2
0
        public static void SaveCashFlowStatements( string fileName, CompanyInfo ci )
        {
            fileName = fileName.Contains( ".xslx" ) ? fileName : fileName + ".xlsx";
            System.IO.FileInfo fi = new System.IO.FileInfo( fileName );
            pck = new ExcelPackage( fi );

            foreach ( CashFlowStatement cfs in ci.CashFlowStatements )
            {
                SaveCashFlowStatement( cfs );
            }
            pck.Save( );
            pck = null;
        }
Beispiel #3
0
        public static void SaveBalanceSheets( string fileName, CompanyInfo ci )
        {
            fileName = fileName.Contains( ".xslx" ) ? fileName : fileName + ".xlsx";
            System.IO.FileInfo fi = new System.IO.FileInfo( fileName );
            pck = new ExcelPackage( fi );

            foreach ( BalanceSheet bs in ci.BalanceSheets )
            {
                CreateIndividualBalanceSheet( bs );
            }
            pck.Save( );
            pck = null;
        }
Beispiel #4
0
        public Canvas CompanyInfoCanvas(CompanyInfo ci)
        {
            var canvas = new Canvas( );
            canvas.Name = "summaryCanvas";

            var name = new Label( );
            name.FontSize = 10;
            name.Content = ci.Name;
            canvas.Children.Add( name );
            Canvas.SetLeft( name, 0 );
            Canvas.SetTop( name, 0 );

            var ticker = new Label( );
            ticker.FontSize = 10;
            ticker.Content = ci.Ticker;
            canvas.Children.Add( ticker );
            Canvas.SetLeft( ticker, 0 );
            Canvas.SetTop( ticker, 15 );

            var exchange = new Label( );
            exchange.FontSize = 10;
            exchange.Content = "(" + ci.Exchange +")";
            canvas.Children.Add( exchange );
            Canvas.SetLeft( exchange, ci.Ticker.Length * 8 );
            Canvas.SetTop( exchange, 15 );

            var oLbl = new Label( );
            oLbl.FontSize = 10;
            oLbl.Content = "Open";
            canvas.Children.Add( oLbl );
            Canvas.SetLeft( oLbl, 0 );
            Canvas.SetTop( oLbl, 30 );

            var Open = new Label( );
            Open.FontSize = 10;
            Open.Content = FormattedCurrencyString( ci.Open );
            canvas.Children.Add( Open );
            Canvas.SetLeft( Open, "Open".Length * 7 );
            Canvas.SetTop( Open, 30 );

            var cLbl = new Label( );
            cLbl.FontSize = 10;
            cLbl.Content = "Close";
            canvas.Children.Add( cLbl );
            Canvas.SetLeft( cLbl, "Open".Length * 7 + FormattedCurrencyString( ci.Open ).Length * 7 );
            Canvas.SetTop( cLbl, 30 );

            var Close = new Label( );
            Close.FontSize = 10;
            Close.Content = FormattedCurrencyString( ci.Close );
            canvas.Children.Add( Close);
            Canvas.SetLeft( Close, "Open".Length * 7 + "Close".Length * 7 + FormattedCurrencyString( ci.Open ).Length * 7);
            Canvas.SetTop( Close, 30 );

            var mcLbl = new Label( );
            mcLbl.FontSize = 10;
            mcLbl.Content = "Market Cap:";
            canvas.Children.Add( mcLbl );
            Canvas.SetLeft( mcLbl, 0 );
            Canvas.SetTop( mcLbl, 45 );

            var mc = new Label( );
            mc.FontSize = 10;
            mc.Content = FormattedCurrencyString( ci.MarketCap );
            canvas.Children.Add( mc );
            Canvas.SetLeft( mc, "Market Cap:".Length * 6 );
            Canvas.SetTop( mc, 45 );

            var SharesLbl = new Label( );
            SharesLbl.FontSize = 10;
            SharesLbl.Content = "Shares:";
            canvas.Children.Add( SharesLbl );
            Canvas.SetLeft( SharesLbl, 0 );
            Canvas.SetTop( SharesLbl, 60 );

            var Shares = new Label( );
            Shares.FontSize = 10;
            Shares.Content = FormattedString( ci.Shares );
            canvas.Children.Add( Shares );
            Canvas.SetLeft( Shares, "Shares:".Length * 7 );
            Canvas.SetTop( Shares, 60 );

            var vaLbl = new Label( );
            vaLbl.FontSize = 10;
            vaLbl.Content = "Vol. Avg:";
            canvas.Children.Add( vaLbl );
            Canvas.SetLeft( vaLbl, 0 );
            Canvas.SetTop( vaLbl, 75 );

            var VolAvg = new Label( );
            VolAvg.FontSize = 10;
            VolAvg.Content = FormattedString( ci.VolumeAverage );
            canvas.Children.Add( VolAvg );
            Canvas.SetLeft( VolAvg, "Vol. AVg:".Length * 6 );
            Canvas.SetTop( VolAvg, 75 );

            var vdLbl = new Label( );
            vdLbl.FontSize = 10;
            vdLbl.Content = "Vol. Day";
            canvas.Children.Add( vdLbl );
            Canvas.SetLeft( vdLbl, "Vol. AVg:".Length * 6 + FormattedString( ci.VolumeAverage ).Length * 6 );
            Canvas.SetTop( vdLbl, 75 );

            var VolDay = new Label( );
            VolDay.FontSize = 10;
            VolDay.Content = FormattedString( ci.VolumeAverage );
            canvas.Children.Add( VolDay );
            Canvas.SetLeft( VolDay, "Vol. Avg:".Length * 12 + FormattedString( ci.VolumeAverage ).Length * 6 );
            Canvas.SetTop( VolDay, 75 );

            var rlLbl = new Label( );
            rlLbl.FontSize = 10;
            rlLbl.Content = "Low:";
            canvas.Children.Add( rlLbl );
            Canvas.SetLeft( rlLbl, 0 );
            Canvas.SetTop( rlLbl, 90 );

            var RangeLow = new Label( );
            RangeLow.FontSize = 10;
            RangeLow.Content = FormattedCurrencyString( ci.RangeLow );
            canvas.Children.Add( RangeLow );
            Canvas.SetLeft( RangeLow, "Low:".Length * 6 );
            Canvas.SetTop( RangeLow, 90 );

            var rhLbl = new Label( );
            rhLbl.FontSize = 10;
            rhLbl.Content = "High";
            canvas.Children.Add( rhLbl );
            Canvas.SetLeft( rhLbl, "Low:".Length * 6 + FormattedCurrencyString( ci.RangeLow ).Length * 6 );
            Canvas.SetTop( rhLbl, 90 );

            var RangeHigh = new Label( );
            RangeHigh.FontSize = 10;
            RangeHigh.Content = FormattedCurrencyString( ci.RangeHigh );
            canvas.Children.Add( RangeHigh );
            Canvas.SetLeft( RangeHigh, "High:".Length * 6 + "Low:".Length * 6 + FormattedString( ci.RangeLow ).Length * 6 );
            Canvas.SetTop( RangeHigh, 90 );

            var w52LLbl = new Label( );
            w52LLbl.FontSize = 10;
            w52LLbl.Content = "52 Week Low:";
            canvas.Children.Add( w52LLbl );
            Canvas.SetLeft( w52LLbl, 0 );
            Canvas.SetTop( w52LLbl, 105 );

            var Week52Low = new Label( );
            Week52Low.FontSize = 10;
            Week52Low.Content = FormattedCurrencyString( ci.FiftyTwoWeekLow );
            canvas.Children.Add( Week52Low );
            Canvas.SetLeft( Week52Low, "52 Week Low:".Length * 6 );
            Canvas.SetTop( Week52Low, 105 );

            var w52HLbl = new Label( );
            w52HLbl.FontSize = 10;
            w52HLbl.Content = "52 Week High:";
            canvas.Children.Add( w52HLbl );
            Canvas.SetLeft( w52HLbl, "52 Week Low:".Length * 6 + FormattedCurrencyString( ci.FiftyTwoWeekLow ).Length * 6 );
            Canvas.SetTop( w52HLbl, 105 );

            var Week52High = new Label( );
            Week52High.FontSize = 10;
            Week52High.Content = FormattedCurrencyString( ci.FiftyTwoWeekHigh );
            canvas.Children.Add( Week52High );
            Canvas.SetLeft( Week52High, "52 Week Low:".Length * 6 + "52 Week High:".Length * 6 + FormattedString( ci.FiftyTwoWeekLow ).Length * 6 );
            Canvas.SetTop( Week52High, 105 );

            var PELLbl = new Label( );
            PELLbl.FontSize = 10;
            PELLbl.Content = "P/E:";
            canvas.Children.Add( PELLbl );
            Canvas.SetLeft( PELLbl, 0 );
            Canvas.SetTop( PELLbl, 120 );

            var PE = new Label( );
            PE.FontSize = 10;
            PE.Content = FormattedString( ci.PriceEarnings );
            canvas.Children.Add( PE );
            Canvas.SetLeft( PE, "P/E".Length*6 );
            Canvas.SetTop( PE, 120 );

            var EPSLLbl = new Label( );
            EPSLLbl.FontSize = 10;
            EPSLLbl.Content = "EPS:";
            canvas.Children.Add( EPSLLbl );
            Canvas.SetLeft( EPSLLbl, "P/E".Length * 6 + FormattedString(ci.PriceEarnings).Length*6 );
            Canvas.SetTop( EPSLLbl, 120 );

            var EPS = new Label( );
            EPS.FontSize = 10;
            EPS.Content = FormattedCurrencyString( ci.EarningsPerShare );
            canvas.Children.Add( EPS );
            Canvas.SetLeft( EPS, "EPS".Length * 6 + "PE:".Length * 6 + FormattedString( ci.PriceEarnings ).Length * 6 );
            Canvas.SetTop( EPS, 120 );

            var BetaLLbl = new Label( );
            BetaLLbl.FontSize = 10;
            BetaLLbl.Content = "Beta:";
            canvas.Children.Add( BetaLLbl );
            Canvas.SetLeft( BetaLLbl, 0 );
            Canvas.SetTop( BetaLLbl, 135 );

            var Beta = new Label( );
            Beta.FontSize = 10;
            Beta.Content = FormattedString( ci.Beta );
            canvas.Children.Add( Beta );
            Canvas.SetLeft( Beta, "Beta:".Length * 6 );
            Canvas.SetTop( Beta, 135 );

            var InstOwnLLbl = new Label( );
            InstOwnLLbl.FontSize = 10;
            InstOwnLLbl.Content = "Institutional Ownership:";
            canvas.Children.Add( InstOwnLLbl );
            Canvas.SetLeft( InstOwnLLbl, FormattedString( ci.Beta ).Length * 6 + "Beta:" .Length*6);
            Canvas.SetTop( InstOwnLLbl, 135 );

            var InstOwn = new Label( );
            InstOwn.FontSize = 10;
            InstOwn.Content = FormattedString( ci.InstitutionalOwnership );
            canvas.Children.Add( InstOwn );
            Canvas.SetLeft( InstOwn, FormattedString( ci.Beta ).Length * 6 + "Institutional Ownership:" .Length*6 + "Beta:".Length*6);
            Canvas.SetTop( InstOwn, 135 );

            var DivLLbl = new Label( );
            DivLLbl.FontSize = 10;
            DivLLbl.Content = "Div:";
            canvas.Children.Add( DivLLbl );
            Canvas.SetLeft( DivLLbl, 0 );
            Canvas.SetTop( DivLLbl, 150 );

            var Div = new Label( );
            Div.FontSize = 10;
            Div.Content = FormattedString( ci.Dividend );
            canvas.Children.Add( Div );
            Canvas.SetLeft( Div, "Div:".Length * 6 );
            Canvas.SetTop( Div, 150 );

            var DivYieldLLbl = new Label( );
            DivYieldLLbl.FontSize = 10;
            DivYieldLLbl.Content = "Yield:";
            canvas.Children.Add( DivYieldLLbl );
            Canvas.SetLeft( DivYieldLLbl, FormattedString( ci.Dividend ).Length * 6 + "Div:".Length * 6 );
            Canvas.SetTop( DivYieldLLbl, 150 );

            var DivYield = new Label( );
            DivYield.FontSize = 10;
            DivYield.Content = FormattedCurrencyString( ci.DividendYield );
            canvas.Children.Add( DivYield );
            Canvas.SetLeft( DivYield, FormattedString( ci.Dividend ).Length * 6 + "Yield:".Length * 6 + "Div:".Length * 6 );
            Canvas.SetTop( DivYield, 150 );

            var IndustryLLbl = new Label( );
            IndustryLLbl.FontSize = 10;
            IndustryLLbl.Content = "Industry:";
            canvas.Children.Add( IndustryLLbl );
            Canvas.SetLeft( IndustryLLbl, 0 );
            Canvas.SetTop( IndustryLLbl, 165 );

            var Industry = new Label( );
            Industry.FontSize = 10;
            Industry.Content = ci.Industry;
            canvas.Children.Add( Industry );
            Canvas.SetLeft( Industry, "Industry:".Length * 6 );
            Canvas.SetTop( Industry, 165 );

            var SectorLLbl = new Label( );
            SectorLLbl.FontSize = 10;
            SectorLLbl.Content = "Sector:";
            canvas.Children.Add( SectorLLbl );
            Canvas.SetLeft( SectorLLbl, 0 );
            Canvas.SetTop( SectorLLbl, 180 );

            var Sector = new Label( );
            Sector.FontSize = 10;
            Sector.Content = ci.Sector;
            canvas.Children.Add( Sector );
            Canvas.SetLeft( Sector, "Sector:".Length * 6 );
            Canvas.SetTop( Sector, 180 );

            return canvas;
        }
Beispiel #5
0
 public GoogleFinanceUI( CompanyInfo ci )
 {
     CachedCompaniesTicker.Add( ci.Ticker, ci );
     CachedCompaniesName.Add( ci.Name, ci );
 }
Beispiel #6
0
 public CompanyInfo QueryCompanyTicker(string tickerName)
 {
     if ( !CachedCompaniesTicker.ContainsKey( tickerName.ToUpper( ) ) )
     {
         CompanyInfo ci = new CompanyInfo( tickerName, true );
         if ( ci == null || ci.Ticker == null|| ci.Ticker == string.Empty )
         {
             return null;
         }
         else
         {
             CachedCompaniesTicker.Add( ci.Ticker, ci );
             CachedCompaniesName.Add( ci.Name, ci );
             return ci;
         }
     }else{
         return CachedCompaniesTicker [ tickerName.ToUpper( ) ];
     }
 }
Beispiel #7
0
 public CompanyInfo QueryCompanyName( string companyName )
 {
     if ( !CachedCompaniesName.ContainsKey( companyName ) )
     {
         CompanyInfo ci = new CompanyInfo( companyName, true );
         if ( ci == null || ci.Ticker == null || ci.Ticker == string.Empty )
         {
             return null;
         }
         else
         {
             CachedCompaniesTicker.Add( ci.Ticker, ci );
             CachedCompaniesName.Add( ci.Name, ci );
             return ci;
         }
     }
     else
     {
         return CachedCompaniesName [ companyName ];
     }
 }