Skip to content

Commit

Permalink
Use FineFundamental.Value for Market Cap Calculations
Browse files Browse the repository at this point in the history
Uses `MarketCap = Value * EarningReports.BasicAverageShares.ThreeMonths`. Since the previous calculations as using `BasicEPS` that can be negative, market cap got negative values which is not realistic.

Moves `MarketCap` code from the generated file to  another one that shares the partial class.
  • Loading branch information
AlexCatarino committed Jan 6, 2020
1 parent 9fa415a commit 87b7f22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
9 changes: 9 additions & 0 deletions Common/Data/Fundamental/FineFundamental.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ public override DateTime EndTime
set { Time = value - QuantConnect.Time.OneDay; }
}

/// <summary>
/// Market capitalization is the aggregate market value of a company represented in dollar amount.
/// </summary>
/// <remarks>
/// Returns zero if <see cref="BasicAverageShares"/> is null
/// </remarks>
[JsonIgnore]
public decimal MarketCap => EarningReports?.BasicAverageShares?.ThreeMonths * Value ?? 0;

/// <summary>
/// Creates the universe symbol used for fine fundamental data
/// </summary>
Expand Down
10 changes: 0 additions & 10 deletions Common/Data/Fundamental/Generated/FineFundamental.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,6 @@ public partial class FineFundamental : BaseData
/// </summary>
public AssetClassification AssetClassification { get; set; }

/// <summary>
/// Market capitalization is the aggregate market value of a company represented in dollar amount.
/// </summary>
/// <remarks>
/// Returns zero if any of the members is null
/// </remarks>
public decimal MarketCap => ValuationRatios?.PERatio *
EarningReports?.BasicEPS?.TwelveMonths *
EarningReports?.BasicAverageShares?.ThreeMonths ?? 0;

/// <summary>
/// Creates an instance of the FineFundamental class
/// </summary>
Expand Down

0 comments on commit 87b7f22

Please sign in to comment.