Skip to content

Commit

Permalink
Add missing multiperiod fields fundamental properties (#7536)
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Molinero authored Oct 26, 2023
1 parent f8b258d commit 2e2136f
Show file tree
Hide file tree
Showing 24 changed files with 2,382 additions and 42 deletions.
114 changes: 97 additions & 17 deletions Common/Data/Fundamental/FundamentalProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,70 @@ public enum FundamentalProperty
SecurityReference_ParValue,
SecurityReference_TradingStatus,
SecurityReference_MarketDataID,
FinancialStatements_PeriodEndingDate,
FinancialStatements_FileDate,
FinancialStatements_AccessionNumber,
FinancialStatements_FormType,
FinancialStatements_PeriodAuditor,
FinancialStatements_AuditorReportStatus,
FinancialStatements_InventoryValuationMethod,
FinancialStatements_NumberOfShareHolders,
FinancialStatements_PeriodType,
FinancialStatements_PeriodEndingDate_OneMonth,
FinancialStatements_PeriodEndingDate_TwoMonths,
FinancialStatements_PeriodEndingDate_ThreeMonths,
FinancialStatements_PeriodEndingDate_SixMonths,
FinancialStatements_PeriodEndingDate_NineMonths,
FinancialStatements_PeriodEndingDate_TwelveMonths,
FinancialStatements_FileDate_OneMonth,
FinancialStatements_FileDate_TwoMonths,
FinancialStatements_FileDate_ThreeMonths,
FinancialStatements_FileDate_SixMonths,
FinancialStatements_FileDate_NineMonths,
FinancialStatements_FileDate_TwelveMonths,
FinancialStatements_AccessionNumber_OneMonth,
FinancialStatements_AccessionNumber_TwoMonths,
FinancialStatements_AccessionNumber_ThreeMonths,
FinancialStatements_AccessionNumber_SixMonths,
FinancialStatements_AccessionNumber_NineMonths,
FinancialStatements_FormType_OneMonth,
FinancialStatements_FormType_TwoMonths,
FinancialStatements_FormType_ThreeMonths,
FinancialStatements_FormType_SixMonths,
FinancialStatements_FormType_NineMonths,
FinancialStatements_FormType_TwelveMonths,
FinancialStatements_PeriodAuditor_OneMonth,
FinancialStatements_PeriodAuditor_TwoMonths,
FinancialStatements_PeriodAuditor_ThreeMonths,
FinancialStatements_PeriodAuditor_SixMonths,
FinancialStatements_PeriodAuditor_NineMonths,
FinancialStatements_PeriodAuditor_TwelveMonths,
FinancialStatements_AuditorReportStatus_OneMonth,
FinancialStatements_AuditorReportStatus_TwoMonths,
FinancialStatements_AuditorReportStatus_ThreeMonths,
FinancialStatements_AuditorReportStatus_SixMonths,
FinancialStatements_AuditorReportStatus_NineMonths,
FinancialStatements_AuditorReportStatus_TwelveMonths,
FinancialStatements_InventoryValuationMethod_OneMonth,
FinancialStatements_InventoryValuationMethod_TwoMonths,
FinancialStatements_InventoryValuationMethod_ThreeMonths,
FinancialStatements_InventoryValuationMethod_SixMonths,
FinancialStatements_InventoryValuationMethod_NineMonths,
FinancialStatements_InventoryValuationMethod_TwelveMonths,
FinancialStatements_NumberOfShareHolders_OneMonth,
FinancialStatements_NumberOfShareHolders_TwoMonths,
FinancialStatements_NumberOfShareHolders_ThreeMonths,
FinancialStatements_NumberOfShareHolders_SixMonths,
FinancialStatements_NumberOfShareHolders_NineMonths,
FinancialStatements_NumberOfShareHolders_TwelveMonths,
FinancialStatements_PeriodType_OneMonth,
FinancialStatements_PeriodType_TwoMonths,
FinancialStatements_PeriodType_ThreeMonths,
FinancialStatements_PeriodType_SixMonths,
FinancialStatements_PeriodType_NineMonths,
FinancialStatements_PeriodType_TwelveMonths,
FinancialStatements_TotalRiskBasedCapital_OneMonth,
FinancialStatements_TotalRiskBasedCapital_ThreeMonths,
FinancialStatements_TotalRiskBasedCapital_SixMonths,
FinancialStatements_TotalRiskBasedCapital_NineMonths,
FinancialStatements_TotalRiskBasedCapital_TwelveMonths,
FinancialStatements_IncomeStatement_ISFileDate,
FinancialStatements_IncomeStatement_ISFileDate_OneMonth,
FinancialStatements_IncomeStatement_ISFileDate_TwoMonths,
FinancialStatements_IncomeStatement_ISFileDate_ThreeMonths,
FinancialStatements_IncomeStatement_ISFileDate_SixMonths,
FinancialStatements_IncomeStatement_ISFileDate_NineMonths,
FinancialStatements_IncomeStatement_ISFileDate_TwelveMonths,
FinancialStatements_IncomeStatement_Amortization_OneMonth,
FinancialStatements_IncomeStatement_Amortization_TwoMonths,
FinancialStatements_IncomeStatement_Amortization_ThreeMonths,
Expand Down Expand Up @@ -957,7 +1006,9 @@ public enum FundamentalProperty
FinancialStatements_IncomeStatement_EffectiveTaxRateAsReported_SixMonths,
FinancialStatements_IncomeStatement_EffectiveTaxRateAsReported_NineMonths,
FinancialStatements_IncomeStatement_EffectiveTaxRateAsReported_TwelveMonths,
FinancialStatements_BalanceSheet_BSFileDate,
FinancialStatements_BalanceSheet_BSFileDate_OneMonth,
FinancialStatements_BalanceSheet_BSFileDate_ThreeMonths,
FinancialStatements_BalanceSheet_BSFileDate_TwelveMonths,
FinancialStatements_BalanceSheet_AccountsPayable_OneMonth,
FinancialStatements_BalanceSheet_AccountsPayable_TwoMonths,
FinancialStatements_BalanceSheet_AccountsPayable_ThreeMonths,
Expand Down Expand Up @@ -2054,7 +2105,12 @@ public enum FundamentalProperty
FinancialStatements_BalanceSheet_TotalLiabilitiesAsReported_TwelveMonths,
FinancialStatements_BalanceSheet_TotalEquityAsReported_ThreeMonths,
FinancialStatements_BalanceSheet_TotalEquityAsReported_TwelveMonths,
FinancialStatements_CashFlowStatement_CFFileDate,
FinancialStatements_CashFlowStatement_CFFileDate_OneMonth,
FinancialStatements_CashFlowStatement_CFFileDate_TwoMonths,
FinancialStatements_CashFlowStatement_CFFileDate_ThreeMonths,
FinancialStatements_CashFlowStatement_CFFileDate_SixMonths,
FinancialStatements_CashFlowStatement_CFFileDate_NineMonths,
FinancialStatements_CashFlowStatement_CFFileDate_TwelveMonths,
FinancialStatements_CashFlowStatement_Amortization_OneMonth,
FinancialStatements_CashFlowStatement_Amortization_TwoMonths,
FinancialStatements_CashFlowStatement_Amortization_ThreeMonths,
Expand Down Expand Up @@ -2986,11 +3042,35 @@ public enum FundamentalProperty
FinancialStatements_CashFlowStatement_ChangeinCashSupplementalAsReported_SixMonths,
FinancialStatements_CashFlowStatement_ChangeinCashSupplementalAsReported_NineMonths,
FinancialStatements_CashFlowStatement_ChangeinCashSupplementalAsReported_TwelveMonths,
EarningReports_PeriodEndingDate,
EarningReports_FileDate,
EarningReports_AccessionNumber,
EarningReports_FormType,
EarningReports_PeriodType,
EarningReports_PeriodEndingDate_OneMonth,
EarningReports_PeriodEndingDate_TwoMonths,
EarningReports_PeriodEndingDate_ThreeMonths,
EarningReports_PeriodEndingDate_SixMonths,
EarningReports_PeriodEndingDate_NineMonths,
EarningReports_PeriodEndingDate_TwelveMonths,
EarningReports_FileDate_OneMonth,
EarningReports_FileDate_TwoMonths,
EarningReports_FileDate_ThreeMonths,
EarningReports_FileDate_SixMonths,
EarningReports_FileDate_NineMonths,
EarningReports_FileDate_TwelveMonths,
EarningReports_AccessionNumber_OneMonth,
EarningReports_AccessionNumber_TwoMonths,
EarningReports_AccessionNumber_ThreeMonths,
EarningReports_AccessionNumber_SixMonths,
EarningReports_AccessionNumber_NineMonths,
EarningReports_FormType_OneMonth,
EarningReports_FormType_TwoMonths,
EarningReports_FormType_ThreeMonths,
EarningReports_FormType_SixMonths,
EarningReports_FormType_NineMonths,
EarningReports_FormType_TwelveMonths,
EarningReports_PeriodType_OneMonth,
EarningReports_PeriodType_TwoMonths,
EarningReports_PeriodType_ThreeMonths,
EarningReports_PeriodType_SixMonths,
EarningReports_PeriodType_NineMonths,
EarningReports_PeriodType_TwelveMonths,
EarningReports_BasicContinuousOperations_OneMonth,
EarningReports_BasicContinuousOperations_TwoMonths,
EarningReports_BasicContinuousOperations_ThreeMonths,
Expand Down
131 changes: 131 additions & 0 deletions Common/Data/Fundamental/Generated/AuditorReportStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2023 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

using System;
using System.Linq;
using Python.Runtime;
using Newtonsoft.Json;
using System.Collections.Generic;
using QuantConnect.Data.UniverseSelection;

namespace QuantConnect.Data.Fundamental
{
/// <summary>
/// Auditor opinion code will be one of the following for each annual period: Code Meaning UQ Unqualified Opinion UE Unqualified Opinion with Explanation QM Qualified - Due to change in accounting method QL Qualified - Due to litigation OT Qualified Opinion - Other AO Adverse Opinion DS Disclaim an opinion UA Unaudited
/// </summary>
public class AuditorReportStatus : MultiPeriodField<string>
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";

/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public string OneMonth => FundamentalService.Get<string>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_AuditorReportStatus_OneMonth);

/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public string TwoMonths => FundamentalService.Get<string>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_AuditorReportStatus_TwoMonths);

/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public string ThreeMonths => FundamentalService.Get<string>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_AuditorReportStatus_ThreeMonths);

/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public string SixMonths => FundamentalService.Get<string>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_AuditorReportStatus_SixMonths);

/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public string NineMonths => FundamentalService.Get<string>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_AuditorReportStatus_NineMonths);

/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public string TwelveMonths => FundamentalService.Get<string>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_AuditorReportStatus_TwelveMonths);

/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(string), FundamentalService.Get<string>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_AuditorReportStatus_TwelveMonths));

/// <summary>
/// Returns the default value for the field
/// </summary>
public override string Value
{
get
{
var defaultValue = FundamentalService.Get<string>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_AuditorReportStatus_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(string), defaultValue))
{
return defaultValue;
}
return base.Value;
}
}

/// <summary>
/// Gets a dictionary of period names and values for the field
/// </summary>
/// <returns>The dictionary of period names and values</returns>
public override IReadOnlyDictionary<string, string> GetPeriodValues()
{
var result = new Dictionary<string, string>();
foreach (var kvp in new[] { new Tuple<string, string>("1M", OneMonth), new Tuple<string, string>("2M", TwoMonths), new Tuple<string, string>("3M", ThreeMonths), new Tuple<string, string>("6M", SixMonths), new Tuple<string, string>("9M", NineMonths), new Tuple<string, string>("12M", TwelveMonths) })
{
if (!BaseFundamentalDataProvider.IsNone(typeof(string), kvp.Item2))
{
result[kvp.Item1] = kvp.Item2;
}
}
return result;
}

/// <summary>
/// Gets the value of the field for the requested period
/// </summary>
/// <param name="period">The requested period</param>
/// <returns>The value for the period</returns>
public override string GetPeriodValue(string period) => FundamentalService.Get<string>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_AuditorReportStatus_{ConvertPeriod(period)}"));

/// <summary>
/// Creates a new empty instance
/// </summary>
public AuditorReportStatus()
{
}

/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AuditorReportStatus(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}
3 changes: 2 additions & 1 deletion Common/Data/Fundamental/Generated/BalanceSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public class BalanceSheet : ReusuableCLRObject
/// Morningstar DataId: 23542
/// </remarks>
[JsonProperty("23542")]
public DateTime BSFileDate => FundamentalService.Get<DateTime>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BSFileDate);
public BalanceSheetFileDate BSFileDate => _bSFileDate ??= new(_timeProvider, _securityIdentifier);
private BalanceSheetFileDate _bSFileDate;

/// <summary>
/// Any money that a company owes its suppliers for goods and services purchased on credit and is expected to pay within the next year or operating cycle.
Expand Down
Loading

0 comments on commit 2e2136f

Please sign in to comment.