Compare commits

...

14 Commits
16632 ... 15933

Author SHA1 Message Date
Martin Molinero
676e522d8b Fix unit test 2023-10-24 11:11:37 -03:00
Martin Molinero
a9222693b0 Minor tweaks 2023-10-24 11:11:37 -03:00
Martin Molinero
5241545e6f Fix unit test 2023-10-24 11:11:37 -03:00
Martin Molinero
afeb585b4c Change default values 2023-10-24 11:11:37 -03:00
Martin Molinero
163019286f Improvements. Add FundamentalUniverseSelectionModel 2023-10-24 11:11:36 -03:00
Martin Molinero
58ba8d9f68 Minor regression algorithm fix 2023-10-24 11:11:36 -03:00
Martin Molinero
4301f1dadc Fixes 2023-10-24 11:11:36 -03:00
Martin Molinero
274ac0c979 Performance improvements 2023-10-24 11:11:36 -03:00
Martin Molinero
0603ed1d22 Fix unit tests 2023-10-24 11:11:34 -03:00
Martin Molinero
bfcc9fde51 Add fundamental history support 2023-10-24 11:11:34 -03:00
Martin Molinero
c7ac450234 Minor coarse fundamental adjustment 2023-10-24 11:11:34 -03:00
Martin Molinero
ecf4d78c82 Handle live mode & delete unexisting properties 2023-10-24 11:11:34 -03:00
Martin Molinero
f3638d6a99 Minor CIK lookup fix 2023-10-24 11:11:34 -03:00
Martin Molinero
d7e1f5784e New Fundamental Data 2023-10-24 11:11:34 -03:00
906 changed files with 111638 additions and 62941 deletions

View File

@@ -169,7 +169,7 @@ namespace QuantConnect.Algorithm.CSharp
/// <summary>
/// Data Points count of all timeslices of algorithm
/// </summary>
public long DataPoints => 5797;
public long DataPoints => 5798;
/// <summary>
/// Data Points count of the algorithm history

View File

@@ -195,11 +195,11 @@ namespace QuantConnect.Algorithm.CSharp.Alphas
private const int _numberOfSymbolsFine = 20;
private const int _numberOfSymbolsInPortfolio = 10;
private int _lastMonth = -1;
private Dictionary<Symbol, decimal> _dollarVolumeBySymbol;
private Dictionary<Symbol, double> _dollarVolumeBySymbol;
public GreenBlattMagicFormulaUniverseSelectionModel() : base(true)
{
_dollarVolumeBySymbol = new Dictionary<Symbol, decimal>();
_dollarVolumeBySymbol = new ();
}
/// <summary>
@@ -245,7 +245,7 @@ namespace QuantConnect.Algorithm.CSharp.Alphas
where x.CompanyReference.CountryId == "USA"
where x.CompanyReference.PrimaryExchangeID == "NYS" || x.CompanyReference.PrimaryExchangeID == "NAS"
where (algorithm.Time - x.SecurityReference.IPODate).TotalDays > 180
where x.EarningReports.BasicAverageShares.ThreeMonths * x.EarningReports.BasicEPS.TwelveMonths * x.ValuationRatios.PERatio > 5e8m
where x.EarningReports.BasicAverageShares.ThreeMonths * x.EarningReports.BasicEPS.TwelveMonths * x.ValuationRatios.PERatio > 5e8
select x;
double count = filteredFine.Count();
@@ -287,4 +287,4 @@ namespace QuantConnect.Algorithm.CSharp.Alphas
}
}
}
}
}

View File

@@ -106,7 +106,7 @@ namespace QuantConnect.Algorithm.CSharp
// we want 50% allocation in each security in our universe
foreach (var security in _changes.AddedSecurities)
{
if (security.Fundamentals.EarningRatios.EquityPerShareGrowth.OneYear > 0.25m)
if (security.Fundamentals.EarningRatios.EquityPerShareGrowth.OneYear > 0.25)
{
SetHoldings(security.Symbol, 0.5m);
Debug("Purchased Stock: " + security.Symbol.Value);
@@ -159,7 +159,7 @@ namespace QuantConnect.Algorithm.CSharp
/// <summary>
/// Data Points count of all timeslices of algorithm
/// </summary>
public long DataPoints => 7239;
public long DataPoints => 7244;
/// <summary>
/// Data Points count of the algorithm history

View File

@@ -157,7 +157,7 @@ namespace QuantConnect.Algorithm.CSharp
/// <summary>
/// Data Points count of all timeslices of algorithm
/// </summary>
public long DataPoints => 998462;
public long DataPoints => 998464;
/// <summary>
/// Data Points count of the algorithm history

View File

@@ -83,7 +83,7 @@ namespace QuantConnect.Algorithm.CSharp
/// <summary>
/// Data Points count of all timeslices of algorithm
/// </summary>
public long DataPoints => 40;
public long DataPoints => 41;
/// <summary>
/// Data Points count of the algorithm history

View File

@@ -0,0 +1,201 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 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 QuantConnect.Interfaces;
using QuantConnect.Data.Market;
using System.Collections.Generic;
using QuantConnect.Data.Fundamental;
using QuantConnect.Data.UniverseSelection;
using QuantConnect.Data;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Demonstration of how to define a universe using the fundamental data
/// </summary>
public class FundamentalRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
private const int NumberOfSymbolsFundamental = 2;
private SecurityChanges _changes = SecurityChanges.None;
public override void Initialize()
{
UniverseSettings.Resolution = Resolution.Daily;
SetStartDate(2014, 03, 25);
SetEndDate(2014, 04, 07);
AddEquity("SPY");
AddEquity("AAPL");
// Request fundamental data for symbols at current algorithm time
var ibm = QuantConnect.Symbol.Create("IBM", SecurityType.Equity, Market.USA);
var ibmFundamental = Fundamentals(ibm);
if (Time != StartDate || Time != ibmFundamental.EndTime)
{
throw new Exception($"Unexpected {nameof(Fundamental)} time {ibmFundamental.EndTime}");
}
if (ibmFundamental.Price == 0)
{
throw new Exception($"Unexpected {nameof(Fundamental)} IBM price!");
}
var nb = QuantConnect.Symbol.Create("NB", SecurityType.Equity, Market.USA);
var fundamentals = Fundamentals(new List<Symbol>{ nb, ibm }).ToList();
if (fundamentals.Count != 2)
{
throw new Exception($"Unexpected {nameof(Fundamental)} count {fundamentals.Count}! Expected 2");
}
// Request historical fundamental data for symbols
var history = History<Fundamental>(Securities.Keys, new TimeSpan(1, 0, 0, 0)).ToList();
if(history.Count != 1)
{
throw new Exception($"Unexpected {nameof(Fundamental)} history count {history.Count}! Expected 1");
}
if (history[0].Values.Count != 2)
{
throw new Exception($"Unexpected {nameof(Fundamental)} data count {history[0].Values.Count}, expected 2!");
}
foreach (var ticker in new[] {"AAPL", "SPY"})
{
if (!history[0].TryGetValue(ticker, out var fundamental) || fundamental.Price == 0)
{
throw new Exception($"Unexpected {ticker} fundamental data");
}
}
// Request historical fundamental data for all symbols
var history2 = History<Fundamentals>(new TimeSpan(1, 0, 0, 0)).ToList();
if (history2.Count != 1)
{
throw new Exception($"Unexpected {nameof(Fundamentals)} history count {history.Count}! Expected 1");
}
if (history2[0].Single().Value.Data.Count < 7000)
{
throw new Exception($"Unexpected {nameof(Fundamentals)} data count {history.Count}! Expected > 7000");
}
if (history2[0].Single().Value.Data.Any(x => x.GetType() != typeof(Fundamental)))
{
throw new Exception($"Unexpected {nameof(Fundamentals)} data type!");
}
AddUniverse(FundamentalSelectionFunction);
}
// sort the data by daily dollar volume and take the top 'NumberOfSymbolsCoarse'
public IEnumerable<Symbol> FundamentalSelectionFunction(IEnumerable<Fundamental> fundamental)
{
// select only symbols with fundamental data and sort descending by daily dollar volume
var sortedByDollarVolume = fundamental
.Where(x => x.Price > 1)
.OrderByDescending(x => x.DollarVolume);
// sort descending by P/E ratio
var sortedByPeRatio = sortedByDollarVolume.OrderByDescending(x => x.ValuationRatios.PERatio);
// take the top entries from our sorted collection
var topFine = sortedByPeRatio.Take(NumberOfSymbolsFundamental);
// we need to return only the symbol objects
return topFine.Select(x => x.Symbol);
}
public override void OnData(Slice slice)
{
// if we have no changes, do nothing
if (_changes == SecurityChanges.None) return;
// liquidate removed securities
foreach (var security in _changes.RemovedSecurities)
{
if (security.Invested)
{
Liquidate(security.Symbol);
}
}
// we want allocation in each security in our universe
foreach (var security in _changes.AddedSecurities)
{
SetHoldings(security.Symbol, 0.02m);
}
_changes = SecurityChanges.None;
}
// this event fires whenever we have changes to our universe
public override void OnSecuritiesChanged(SecurityChanges changes)
{
_changes = changes;
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>
public bool CanRunLocally { get; } = true;
/// <summary>
/// This is used by the regression test system to indicate which languages this algorithm is written in.
/// </summary>
public Language[] Languages { get; } = { Language.CSharp, Language.Python };
/// <summary>
/// Data Points count of all timeslices of algorithm
/// </summary>
public long DataPoints => 85867;
/// <summary>
/// Data Points count of the algorithm history
/// </summary>
public virtual int AlgorithmHistoryDataPoints => 3;
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "2"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "-0.223%"},
{"Drawdown", "0.100%"},
{"Expectancy", "0"},
{"Net Profit", "-0.009%"},
{"Sharpe Ratio", "-6.313"},
{"Probabilistic Sharpe Ratio", "12.055%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.019"},
{"Beta", "0.027"},
{"Annual Standard Deviation", "0.004"},
{"Annual Variance", "0"},
{"Information Ratio", "1.749"},
{"Tracking Error", "0.095"},
{"Treynor Ratio", "-0.876"},
{"Total Fees", "$2.00"},
{"Estimated Strategy Capacity", "$2200000000.00"},
{"Lowest Capacity Asset", "IBM R735QTJ8XC9X"},
{"Portfolio Turnover", "0.28%"},
{"OrderListHash", "34bb9933f9d242713c0ec14c4ee586b6"}
};
}
}

View File

@@ -0,0 +1,101 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 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.Linq;
using QuantConnect.Data;
using System.Collections.Generic;
using QuantConnect.Data.Fundamental;
using QuantConnect.Data.UniverseSelection;
using QuantConnect.Algorithm.Framework.Selection;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Demonstration of how to define a universe using the fundamental data
/// </summary>
public class FundamentalUniverseSelectionRegressionAlgorithm : FundamentalRegressionAlgorithm
{
private const int NumberOfSymbolsFundamental = 2;
private SecurityChanges _changes = SecurityChanges.None;
public override void Initialize()
{
UniverseSettings.Resolution = Resolution.Daily;
SetStartDate(2014, 03, 25);
SetEndDate(2014, 04, 07);
AddEquity("SPY");
AddEquity("AAPL");
SetUniverseSelection(new FundamentalUniverseSelectionModelTest());
}
private class FundamentalUniverseSelectionModelTest : FundamentalUniverseSelectionModel
{
public override IEnumerable<Symbol> Select(QCAlgorithm algorithm, IEnumerable<Fundamental> fundamental)
{
// select only symbols with fundamental data and sort descending by daily dollar volume
var sortedByDollarVolume = fundamental
.Where(x => x.Price > 1)
.OrderByDescending(x => x.DollarVolume);
// sort descending by P/E ratio
var sortedByPeRatio = sortedByDollarVolume.OrderByDescending(x => x.ValuationRatios.PERatio);
// take the top entries from our sorted collection
var topFine = sortedByPeRatio.Take(NumberOfSymbolsFundamental);
// we need to return only the symbol objects
return topFine.Select(x => x.Symbol);
}
}
public override void OnData(Slice slice)
{
// if we have no changes, do nothing
if (_changes == SecurityChanges.None) return;
// liquidate removed securities
foreach (var security in _changes.RemovedSecurities)
{
if (security.Invested)
{
Liquidate(security.Symbol);
}
}
// we want allocation in each security in our universe
foreach (var security in _changes.AddedSecurities)
{
SetHoldings(security.Symbol, 0.02m);
}
_changes = SecurityChanges.None;
}
// this event fires whenever we have changes to our universe
public override void OnSecuritiesChanged(SecurityChanges changes)
{
_changes = changes;
}
/// <summary>
/// Data Points count of the algorithm history
/// </summary>
public override int AlgorithmHistoryDataPoints => 0;
}
}

View File

@@ -28,31 +28,35 @@ namespace QuantConnect.Algorithm.CSharp
{
public override void Initialize()
{
SetStartDate(2013, 10, 07);
SetEndDate(2013, 10, 07);
SetStartDate(2014, 06, 05);
SetEndDate(2014, 06, 05);
var spy = AddEquity("SPY").Symbol;
var equity = AddEquity("AAPL").Symbol;
var spyCusip = spy.CUSIP;
var spyCompositeFigi = spy.CompositeFIGI;
var spySedol = spy.SEDOL;
var spyIsin = spy.ISIN;
var cusip = equity.CUSIP;
var compositeFigi = equity.CompositeFIGI;
var sedol = equity.SEDOL;
var isin = equity.ISIN;
var cik = equity.CIK;
CheckSymbolRepresentation(spyCusip, "CUSIP");
CheckSymbolRepresentation(spyCompositeFigi, "Composite FIGI");
CheckSymbolRepresentation(spySedol, "SEDOL");
CheckSymbolRepresentation(spyIsin, "ISIN");
CheckSymbolRepresentation(cusip, "CUSIP");
CheckSymbolRepresentation(compositeFigi, "Composite FIGI");
CheckSymbolRepresentation(sedol, "SEDOL");
CheckSymbolRepresentation(isin, "ISIN");
CheckSymbolRepresentation($"{cik}", "CIK");
// Check Symbol API vs QCAlgorithm API
CheckAPIsSymbolRepresentations(spyCusip, CUSIP(spy), "CUSIP");
CheckAPIsSymbolRepresentations(spyCompositeFigi, CompositeFIGI(spy), "Composite FIGI");
CheckAPIsSymbolRepresentations(spySedol, SEDOL(spy), "SEDOL");
CheckAPIsSymbolRepresentations(spyIsin, ISIN(spy), "ISIN");
CheckAPIsSymbolRepresentations(cusip, CUSIP(equity), "CUSIP");
CheckAPIsSymbolRepresentations(compositeFigi, CompositeFIGI(equity), "Composite FIGI");
CheckAPIsSymbolRepresentations(sedol, SEDOL(equity), "SEDOL");
CheckAPIsSymbolRepresentations(isin, ISIN(equity), "ISIN");
CheckAPIsSymbolRepresentations($"{cik}", $"{CIK(equity)}", "CIK");
Log($"\nSPY CUSIP: {spyCusip}" +
$"\nSPY Composite FIGI: {spyCompositeFigi}" +
$"\nSPY SEDOL: {spySedol}" +
$"\nSPY ISIN: {spyIsin}");
Log($"\nAAPL CUSIP: {cusip}" +
$"\nAAPL Composite FIGI: {compositeFigi}" +
$"\nAAPL SEDOL: {sedol}" +
$"\nAAPL ISIN: {isin}" +
$"\nAAPL CIK: {cik}");
}
private static void CheckSymbolRepresentation(string symbol, string standard)

View File

@@ -55,7 +55,7 @@ namespace QuantConnect.Algorithm.CSharp
/// <summary>
/// Data Points count of all timeslices of algorithm
/// </summary>
public override long DataPoints => 544;
public override long DataPoints => 555;
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
@@ -85,7 +85,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Estimated Strategy Capacity", "$63000000.00"},
{"Lowest Capacity Asset", "AIG R735QTJ8XC9X"},
{"Portfolio Turnover", "0.80%"},
{"OrderListHash", "81128ea61f4a90afe5b9eb8a66a5bb11"}
{"OrderListHash", "97dbdaf15cd01a91bf0a262c9d8fb6bd"}
};
}
}

View File

@@ -80,7 +80,7 @@ namespace QuantConnect.Algorithm.CSharp
/// <summary>
/// Data Points count of all timeslices of algorithm
/// </summary>
public long DataPoints => 7238;
public long DataPoints => 7249;
/// <summary>
/// Data Points count of the algorithm history
@@ -92,30 +92,30 @@ namespace QuantConnect.Algorithm.CSharp
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "10"},
{"Total Trades", "11"},
{"Average Win", "0.12%"},
{"Average Loss", "-0.07%"},
{"Compounding Annual Return", "-34.838%"},
{"Drawdown", "2.100%"},
{"Compounding Annual Return", "-40.669%"},
{"Drawdown", "2.600%"},
{"Expectancy", "0.865"},
{"Net Profit", "-1.629%"},
{"Sharpe Ratio", "-4.308"},
{"Probabilistic Sharpe Ratio", "4.273%"},
{"Net Profit", "-1.982%"},
{"Sharpe Ratio", "-4.214"},
{"Probabilistic Sharpe Ratio", "3.637%"},
{"Loss Rate", "33%"},
{"Win Rate", "67%"},
{"Profit-Loss Ratio", "1.80"},
{"Alpha", "-0.196"},
{"Beta", "0.674"},
{"Annual Standard Deviation", "0.075"},
{"Annual Variance", "0.006"},
{"Information Ratio", "-2.776"},
{"Tracking Error", "0.048"},
{"Treynor Ratio", "-0.481"},
{"Total Fees", "$22.09"},
{"Estimated Strategy Capacity", "$27000000.00"},
{"Alpha", "-0.218"},
{"Beta", "0.796"},
{"Annual Standard Deviation", "0.088"},
{"Annual Variance", "0.008"},
{"Information Ratio", "-3.98"},
{"Tracking Error", "0.045"},
{"Treynor Ratio", "-0.464"},
{"Total Fees", "$23.09"},
{"Estimated Strategy Capacity", "$29000000.00"},
{"Lowest Capacity Asset", "AIG R735QTJ8XC9X"},
{"Portfolio Turnover", "8.61%"},
{"OrderListHash", "a2f005326c549bf9f8f90168369d6cb7"}
{"Portfolio Turnover", "10.03%"},
{"OrderListHash", "cf1482fed8c889a7b6f50cbea9dbb602"}
};
}
}

View File

@@ -106,7 +106,7 @@ namespace QuantConnect.Algorithm.CSharp
/// <summary>
/// Data Points count of all timeslices of algorithm
/// </summary>
public long DataPoints => 54;
public long DataPoints => 58;
/// <summary>
/// Data Points count of the algorithm history

View File

@@ -1,4 +1,4 @@
/*
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
@@ -202,7 +202,7 @@ namespace QuantConnect.Algorithm.Framework.Portfolio
/// <remarks>Other sectors can be defined using <see cref="AssetClassification"/></remarks>
protected virtual string GetSectorCode(Security security)
{
return security.Fundamentals?.CompanyReference?.IndustryTemplateCode;
return security.Fundamentals?.CompanyReference.IndustryTemplateCode;
}
}
}
}

View File

@@ -1,4 +1,4 @@
/*
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
@@ -14,26 +14,75 @@
*/
using System;
using System.Collections.Generic;
using System.Linq;
using Python.Runtime;
using QuantConnect.Securities;
using System.Collections.Generic;
using QuantConnect.Data.Fundamental;
using QuantConnect.Data.UniverseSelection;
using QuantConnect.Securities;
namespace QuantConnect.Algorithm.Framework.Selection
{
/// <summary>
/// Provides a base class for defining equity coarse/fine fundamental selection models
/// </summary>
public abstract class FundamentalUniverseSelectionModel : UniverseSelectionModel
public class FundamentalUniverseSelectionModel : UniverseSelectionModel
{
private readonly bool _fundamentalData;
private readonly bool _filterFineData;
private readonly UniverseSettings _universeSettings;
private readonly Func<IEnumerable<Fundamental>, IEnumerable<Symbol>> _selector;
/// <summary>
/// Initializes a new instance of the <see cref="FundamentalUniverseSelectionModel"/> class
/// </summary>
public FundamentalUniverseSelectionModel()
: this(null)
{
_fundamentalData = true;
}
/// <summary>
/// Initializes a new instance of the <see cref="FundamentalUniverseSelectionModel"/> class
/// </summary>
/// <param name="universeSettings">Universe settings define attributes of created subscriptions, such as their resolution and the minimum time in universe before they can be removed</param>
public FundamentalUniverseSelectionModel(UniverseSettings universeSettings)
{
_fundamentalData = true;
_universeSettings = universeSettings;
}
/// <summary>
/// Initializes a new instance of the <see cref="FundamentalUniverseSelectionModel"/> class
/// </summary>
/// <param name="selector">Selects symbols from the provided fundamental data set</param>
/// <param name="universeSettings">Universe settings define attributes of created subscriptions, such as their resolution and the minimum time in universe before they can be removed</param>
public FundamentalUniverseSelectionModel(Func<IEnumerable<Fundamental>, IEnumerable<Symbol>> selector, UniverseSettings universeSettings = null)
{
_selector = selector;
_fundamentalData = true;
_universeSettings = universeSettings;
}
/// <summary>
/// Initializes a new instance of the <see cref="FundamentalUniverseSelectionModel"/> class
/// </summary>
/// <param name="selector">Selects symbols from the provided fundamental data set</param>
/// <param name="universeSettings">Universe settings define attributes of created subscriptions, such as their resolution and the minimum time in universe before they can be removed</param>
public FundamentalUniverseSelectionModel(PyObject selector, UniverseSettings universeSettings = null) : this(universeSettings)
{
Func<IEnumerable<Fundamental>, object> selectorFunc;
if (selector.TryConvertToDelegate(out selectorFunc))
{
_selector = selectorFunc.ConvertToUniverseSelectionSymbolDelegate();
}
}
/// <summary>
/// Initializes a new instance of the <see cref="FundamentalUniverseSelectionModel"/> class
/// </summary>
/// <param name="filterFineData">True to also filter using fine fundamental data, false to only filter on coarse data</param>
[Obsolete("Fine and Coarse selection are merged, please use 'FundamentalUniverseSelectionModel()'")]
protected FundamentalUniverseSelectionModel(bool filterFineData)
: this(filterFineData, null)
{
@@ -44,6 +93,7 @@ namespace QuantConnect.Algorithm.Framework.Selection
/// </summary>
/// <param name="filterFineData">True to also filter using fine fundamental data, false to only filter on coarse data</param>
/// <param name="universeSettings">The settings used when adding symbols to the algorithm, specify null to use algorithm.UniverseSettings</param>
[Obsolete("Fine and Coarse selection are merged, please use 'FundamentalUniverseSelectionModel(UniverseSettings)'")]
protected FundamentalUniverseSelectionModel(bool filterFineData, UniverseSettings universeSettings)
{
_filterFineData = filterFineData;
@@ -57,12 +107,23 @@ namespace QuantConnect.Algorithm.Framework.Selection
/// <returns>The universe defined by this model</returns>
public override IEnumerable<Universe> CreateUniverses(QCAlgorithm algorithm)
{
var universe = CreateCoarseFundamentalUniverse(algorithm);
if (_filterFineData)
if (_fundamentalData)
{
universe = new FineFundamentalFilteredUniverse(universe, fine => SelectFine(algorithm, fine));
var universeSettings = _universeSettings ?? algorithm.UniverseSettings;
yield return new FundamentalUniverse(universeSettings, fundamental => Select(algorithm, fundamental));
}
else
{
// for backwards compatibility
var universe = CreateCoarseFundamentalUniverse(algorithm);
if (_filterFineData)
{
#pragma warning disable CS0618 // Type or member is obsolete
universe = new FineFundamentalFilteredUniverse(universe, fine => SelectFine(algorithm, fine));
#pragma warning restore CS0618 // Type or member is obsolete
}
yield return universe;
}
yield return universe;
}
/// <summary>
@@ -82,17 +143,34 @@ namespace QuantConnect.Algorithm.Framework.Selection
coarse = coarse.Where(c => c.HasFundamentalData);
}
#pragma warning disable CS0618 // Type or member is obsolete
return SelectCoarse(algorithm, coarse);
#pragma warning restore CS0618 // Type or member is obsolete
});
}
/// <summary>
/// Defines the fundamental selection function.
/// </summary>
/// <param name="algorithm">The algorithm instance</param>
/// <param name="fundamental">The fundamental data used to perform filtering</param>
/// <returns>An enumerable of symbols passing the filter</returns>
public virtual IEnumerable<Symbol> Select(QCAlgorithm algorithm, IEnumerable<Fundamental> fundamental)
{
return _selector(fundamental);
}
/// <summary>
/// Defines the coarse fundamental selection function.
/// </summary>
/// <param name="algorithm">The algorithm instance</param>
/// <param name="coarse">The coarse fundamental data used to perform filtering</param>
/// <returns>An enumerable of symbols passing the filter</returns>
public abstract IEnumerable<Symbol> SelectCoarse(QCAlgorithm algorithm, IEnumerable<CoarseFundamental> coarse);
[Obsolete("Fine and Coarse selection are merged, please use 'Select(QCAlgorithm, IEnumerable<Fundamental>)'")]
public virtual IEnumerable<Symbol> SelectCoarse(QCAlgorithm algorithm, IEnumerable<CoarseFundamental> coarse)
{
throw new NotImplementedException("Please overrride the 'Select' fundamental function");
}
/// <summary>
/// Defines the fine fundamental selection function.
@@ -100,6 +178,7 @@ namespace QuantConnect.Algorithm.Framework.Selection
/// <param name="algorithm">The algorithm instance</param>
/// <param name="fine">The fine fundamental data used to perform filtering</param>
/// <returns>An enumerable of symbols passing the filter</returns>
[Obsolete("Fine and Coarse selection are merged, please use 'Select(QCAlgorithm, IEnumerable<Fundamental>)'")]
public virtual IEnumerable<Symbol> SelectFine(QCAlgorithm algorithm, IEnumerable<FineFundamental> fine)
{
// default impl performs no filtering of fine data
@@ -111,20 +190,32 @@ namespace QuantConnect.Algorithm.Framework.Selection
/// </summary>
/// <param name="coarseSelector">Selects symbols from the provided coarse data set</param>
/// <returns>A new universe selection model that will select US equities according to the selection function specified</returns>
[Obsolete("Fine and Coarse selection are merged, please use 'Fundamental(Func<IEnumerable<Fundamental>, IEnumerable<Symbol>>)'")]
public static IUniverseSelectionModel Coarse(Func<IEnumerable<CoarseFundamental>, IEnumerable<Symbol>> coarseSelector)
{
return new CoarseFundamentalUniverseSelectionModel(coarseSelector);
}
/// <summary>
///
/// Convenience method for creating a selection model that uses coarse and fine data
/// </summary>
/// <param name="coarseSelector">Selects symbols from the provided coarse data set</param>
/// <param name="fineSelector">Selects symbols from the provided fine data set (this set has already been filtered according to the coarse selection)</param>
/// <returns>A new universe selection model that will select US equities according to the selection functions specified</returns>
[Obsolete("Fine and Coarse selection are merged, please use 'Fundamental(Func<IEnumerable<Fundamental>, IEnumerable<Symbol>>)'")]
public static IUniverseSelectionModel Fine(Func<IEnumerable<CoarseFundamental>, IEnumerable<Symbol>> coarseSelector, Func<IEnumerable<FineFundamental>, IEnumerable<Symbol>> fineSelector)
{
return new FineFundamentalUniverseSelectionModel(coarseSelector, fineSelector);
}
/// <summary>
/// Convenience method for creating a selection model that uses fundamental data
/// </summary>
/// <param name="selector">Selects symbols from the provided fundamental data set</param>
/// <returns>A new universe selection model that will select US equities according to the selection functions specified</returns>
public static IUniverseSelectionModel Fundamental(Func<IEnumerable<Fundamental>, IEnumerable<Symbol>> selector)
{
return new FundamentalUniverseSelectionModel(selector);
}
}
}

View File

@@ -1,4 +1,4 @@
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,13 +17,17 @@ class FundamentalUniverseSelectionModel:
'''Provides a base class for defining equity coarse/fine fundamental selection models'''
def __init__(self,
filterFineData,
filterFineData = None,
universeSettings = None):
'''Initializes a new instance of the FundamentalUniverseSelectionModel class
Args:
filterFineData: True to also filter using fine fundamental data, false to only filter on coarse data
filterFineData: [Obsolete] Fine and Coarse selection are merged
universeSettings: The settings used when adding symbols to the algorithm, specify null to use algorithm.UniverseSettings'''
self.filterFineData = filterFineData
if self.filterFineData == None:
self._fundamentalData = True
else:
self._fundamentalData = False
self.universeSettings = universeSettings
@@ -33,10 +37,15 @@ class FundamentalUniverseSelectionModel:
algorithm: The algorithm instance to create universes for
Returns:
The universe defined by this model'''
universe = self.CreateCoarseFundamentalUniverse(algorithm)
if self.filterFineData:
universe = FineFundamentalFilteredUniverse(universe, lambda fine: self.SelectFine(algorithm, fine))
return [universe]
if self._fundamentalData:
universeSettings = algorithm.UniverseSettings if self.universeSettings is None else self.universeSettings
universe = FundamentalUniverse(universeSettings, lambda fundamental: self.Select(algorithm, fundamental))
return [universe]
else:
universe = self.CreateCoarseFundamentalUniverse(algorithm)
if self.filterFineData:
universe = FineFundamentalFilteredUniverse(universe, lambda fine: self.SelectFine(algorithm, fine))
return [universe]
def CreateCoarseFundamentalUniverse(self, algorithm):
@@ -63,6 +72,16 @@ class FundamentalUniverseSelectionModel:
return self.SelectCoarse(algorithm, coarse)
def Select(self, algorithm, fundamental):
'''Defines the fundamental selection function.
Args:
algorithm: The algorithm instance
fundamental: The fundamental data used to perform filtering
Returns:
An enumerable of symbols passing the filter'''
raise NotImplementedError("Please overrride the 'Select' fundamental function")
def SelectCoarse(self, algorithm, coarse):
'''Defines the coarse fundamental selection function.
Args:
@@ -70,7 +89,7 @@ class FundamentalUniverseSelectionModel:
coarse: The coarse fundamental data used to perform filtering
Returns:
An enumerable of symbols passing the filter'''
raise NotImplementedError("SelectCoarse must be implemented")
raise NotImplementedError("Please overrride the 'Select' fundamental function")
def SelectFine(self, algorithm, fine):

View File

@@ -1,4 +1,4 @@
/*
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
@@ -33,7 +33,7 @@ namespace QuantConnect.Algorithm.Framework.Selection
// rebalances at the start of each month
private int _lastMonth = -1;
private readonly Dictionary<Symbol, decimal> _dollarVolumeBySymbol = new Dictionary<Symbol, decimal>();
private readonly Dictionary<Symbol, double> _dollarVolumeBySymbol = new ();
/// <summary>
/// Initializes a new default instance of the <see cref="QC500UniverseSelectionModel"/>
@@ -136,4 +136,4 @@ namespace QuantConnect.Algorithm.Framework.Selection
.Select(x => x.Symbol);
}
}
}
}

View File

@@ -0,0 +1,102 @@
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 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.
from AlgorithmImports import *
### <summary>
### Demonstration of how to define a universe using the fundamental data
### </summary>
### <meta name="tag" content="using data" />
### <meta name="tag" content="universes" />
### <meta name="tag" content="coarse universes" />
### <meta name="tag" content="regression test" />
class FundamentalRegressionAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2014, 3, 25)
self.SetEndDate(2014, 4, 7)
self.UniverseSettings.Resolution = Resolution.Daily
self.AddEquity("SPY")
self.AddEquity("AAPL")
# Request fundamental data for symbols at current algorithm time
ibm = Symbol.Create("IBM", SecurityType.Equity, Market.USA)
ibmFundamental = self.Fundamentals(ibm)
if self.Time != self.StartDate or self.Time != ibmFundamental.EndTime:
raise ValueError(f"Unexpected Fundamental time {ibmFundamental.EndTime}");
if ibmFundamental.Price == 0:
raise ValueError(f"Unexpected Fundamental IBM price!");
nb = Symbol.Create("NB", SecurityType.Equity, Market.USA)
fundamentals = self.Fundamentals([ nb, ibm ])
if len(fundamentals) != 2:
raise ValueError(f"Unexpected Fundamental count {len(fundamentals)}! Expected 2")
# Request historical fundamental data for symbols
history = self.History(Fundamental, TimeSpan(1, 0, 0, 0))
if len(history) != 2:
raise ValueError(f"Unexpected Fundamental history count {len(history)}! Expected 2")
for ticker in [ "AAPL", "SPY" ]:
data = history.loc[ticker]
if data["value"][0] == 0:
raise ValueError(f"Unexpected {data} fundamental data")
# Request historical fundamental data for all symbols
history2 = self.History(Fundamentals, TimeSpan(1, 0, 0, 0))
if len(history2) != 1:
raise ValueError(f"Unexpected Fundamentals history count {len(history2)}! Expected 1")
data = history2["data"][0]
if len(data) < 7000:
raise ValueError(f"Unexpected Fundamentals data count {len(data)}! Expected > 7000")
for fundamental in data:
if type(fundamental) is not Fundamental:
raise ValueError(f"Unexpected Fundamentals data type! {fundamental}")
self.AddUniverse(self.SelectionFunction)
self.changes = None
self.numberOfSymbolsFundamental = 2
# return a list of three fixed symbol objects
def SelectionFunction(self, fundamental):
# sort descending by daily dollar volume
sortedByDollarVolume = sorted([x for x in fundamental if x.Price > 1],
key=lambda x: x.DollarVolume, reverse=True)
# sort descending by P/E ratio
sortedByPeRatio = sorted(sortedByDollarVolume, key=lambda x: x.ValuationRatios.PERatio, reverse=True)
# take the top entries from our sorted collection
return [ x.Symbol for x in sortedByPeRatio[:self.numberOfSymbolsFundamental] ]
def OnData(self, data):
# if we have no changes, do nothing
if self.changes is None: return
# liquidate removed securities
for security in self.changes.RemovedSecurities:
if security.Invested:
self.Liquidate(security.Symbol)
self.Debug("Liquidated Stock: " + str(security.Symbol.Value))
# we want 50% allocation in each security in our universe
for security in self.changes.AddedSecurities:
self.SetHoldings(security.Symbol, 0.02)
self.changes = None
# this event fires whenever we have changes to our universe
def OnSecuritiesChanged(self, changes):
self.changes = changes

View File

@@ -0,0 +1,79 @@
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 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.
from AlgorithmImports import *
### <summary>
### Demonstration of how to define a universe using the fundamental data
### </summary>
### <meta name="tag" content="using data" />
### <meta name="tag" content="universes" />
### <meta name="tag" content="coarse universes" />
### <meta name="tag" content="regression test" />
class FundamentalUniverseSelectionAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2014, 3, 25)
self.SetEndDate(2014, 4, 7)
self.UniverseSettings.Resolution = Resolution.Daily
self.AddEquity("SPY")
self.AddEquity("AAPL")
self.SetUniverseSelection(FundamentalUniverseSelectionModel(self.Select))
self.changes = None
# return a list of three fixed symbol objects
def SelectionFunction(self, fundamental):
# sort descending by daily dollar volume
sortedByDollarVolume = sorted([x for x in fundamental if x.Price > 1],
key=lambda x: x.DollarVolume, reverse=True)
# sort descending by P/E ratio
sortedByPeRatio = sorted(sortedByDollarVolume, key=lambda x: x.ValuationRatios.PERatio, reverse=True)
# take the top entries from our sorted collection
return [ x.Symbol for x in sortedByPeRatio[:self.numberOfSymbolsFundamental] ]
def OnData(self, data):
# if we have no changes, do nothing
if self.changes is None: return
# liquidate removed securities
for security in self.changes.RemovedSecurities:
if security.Invested:
self.Liquidate(security.Symbol)
self.Debug("Liquidated Stock: " + str(security.Symbol.Value))
# we want 50% allocation in each security in our universe
for security in self.changes.AddedSecurities:
self.SetHoldings(security.Symbol, 0.02)
self.changes = None
# this event fires whenever we have changes to our universe
def OnSecuritiesChanged(self, changes):
self.changes = changes
def Select(self, fundamental):
# sort descending by daily dollar volume
sortedByDollarVolume = sorted([x for x in fundamental if x.HasFundamentalData and x.Price > 1],
key=lambda x: x.DollarVolume, reverse=True)
# sort descending by P/E ratio
sortedByPeRatio = sorted(sortedByDollarVolume, key=lambda x: x.ValuationRatios.PERatio, reverse=True)
# take the top entries from our sorted collection
return [ x.Symbol for x in sortedByPeRatio[:2] ]

View File

@@ -0,0 +1,81 @@
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 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.
from AlgorithmImports import *
from Selection.FundamentalUniverseSelectionModel import FundamentalUniverseSelectionModel
### <summary>
### Demonstration of how to define a universe using the fundamental data
### </summary>
### <meta name="tag" content="using data" />
### <meta name="tag" content="universes" />
### <meta name="tag" content="coarse universes" />
### <meta name="tag" content="regression test" />
class FundamentalUniverseSelectionRegressionAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2014, 3, 25)
self.SetEndDate(2014, 4, 7)
self.UniverseSettings.Resolution = Resolution.Daily
self.AddEquity("SPY")
self.AddEquity("AAPL")
self.SetUniverseSelection(FundamentalUniverseSelectionModelTest())
self.changes = None
# return a list of three fixed symbol objects
def SelectionFunction(self, fundamental):
# sort descending by daily dollar volume
sortedByDollarVolume = sorted([x for x in fundamental if x.Price > 1],
key=lambda x: x.DollarVolume, reverse=True)
# sort descending by P/E ratio
sortedByPeRatio = sorted(sortedByDollarVolume, key=lambda x: x.ValuationRatios.PERatio, reverse=True)
# take the top entries from our sorted collection
return [ x.Symbol for x in sortedByPeRatio[:self.numberOfSymbolsFundamental] ]
def OnData(self, data):
# if we have no changes, do nothing
if self.changes is None: return
# liquidate removed securities
for security in self.changes.RemovedSecurities:
if security.Invested:
self.Liquidate(security.Symbol)
self.Debug("Liquidated Stock: " + str(security.Symbol.Value))
# we want 50% allocation in each security in our universe
for security in self.changes.AddedSecurities:
self.SetHoldings(security.Symbol, 0.02)
self.changes = None
# this event fires whenever we have changes to our universe
def OnSecuritiesChanged(self, changes):
self.changes = changes
class FundamentalUniverseSelectionModelTest(FundamentalUniverseSelectionModel):
def Select(self, algorithm, fundamental):
# sort descending by daily dollar volume
sortedByDollarVolume = sorted([x for x in fundamental if x.HasFundamentalData and x.Price > 1],
key=lambda x: x.DollarVolume, reverse=True)
# sort descending by P/E ratio
sortedByPeRatio = sorted(sortedByDollarVolume, key=lambda x: x.ValuationRatios.PERatio, reverse=True)
# take the top entries from our sorted collection
return [ x.Symbol for x in sortedByPeRatio[:2] ]

View File

@@ -18,31 +18,35 @@ from AlgorithmImports import *
### </summary>
class IndustryStandardSecurityIdentifiersRegressionAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2013, 10, 7)
self.SetEndDate(2013, 10, 7)
self.SetStartDate(2014, 6, 5)
self.SetEndDate(2014, 6, 5)
spy = self.AddEquity("SPY").Symbol
equity = self.AddEquity("AAPL").Symbol
spyCusip = spy.CUSIP
spyCompositeFigi = spy.CompositeFIGI
spySedol = spy.SEDOL
spyIsin = spy.ISIN
cusip = equity.CUSIP
compositeFigi = equity.CompositeFIGI
sedol = equity.SEDOL
isin = equity.ISIN
cik = equity.CIK
self.CheckSymbolRepresentation(spyCusip, "CUSIP")
self.CheckSymbolRepresentation(spyCompositeFigi, "Composite FIGI")
self.CheckSymbolRepresentation(spySedol, "SEDOL")
self.CheckSymbolRepresentation(spyIsin, "ISIN")
self.CheckSymbolRepresentation(cusip, "CUSIP")
self.CheckSymbolRepresentation(compositeFigi, "Composite FIGI")
self.CheckSymbolRepresentation(sedol, "SEDOL")
self.CheckSymbolRepresentation(isin, "ISIN")
self.CheckSymbolRepresentation(f"{cik}", "CIK")
# Check Symbol API vs QCAlgorithm API
self.CheckAPIsSymbolRepresentations(spyCusip, self.CUSIP(spy), "CUSIP");
self.CheckAPIsSymbolRepresentations(spyCompositeFigi, self.CompositeFIGI(spy), "Composite FIGI");
self.CheckAPIsSymbolRepresentations(spySedol, self.SEDOL(spy), "SEDOL");
self.CheckAPIsSymbolRepresentations(spyIsin, self.ISIN(spy), "ISIN");
self.CheckAPIsSymbolRepresentations(cusip, self.CUSIP(equity), "CUSIP")
self.CheckAPIsSymbolRepresentations(compositeFigi, self.CompositeFIGI(equity), "Composite FIGI")
self.CheckAPIsSymbolRepresentations(sedol, self.SEDOL(equity), "SEDOL")
self.CheckAPIsSymbolRepresentations(isin, self.ISIN(equity), "ISIN")
self.CheckAPIsSymbolRepresentations(f"{cik}", f"{self.CIK(equity)}", "CIK")
self.Log(f"\nSPY CUSIP: {spyCusip}"
f"\nSPY Composite FIGI: {spyCompositeFigi}"
f"\nSPY SEDOL: {spySedol}"
f"\nSPY ISIN: {spyIsin}")
self.Log(f"\nAAPL CUSIP: {cusip}"
f"\nAAPL Composite FIGI: {compositeFigi}"
f"\nAAPL SEDOL: {sedol}"
f"\nAAPL ISIN: {isin}"
f"\nAAPL CIK: {cik}")
def CheckSymbolRepresentation(self, symbol: str, standard: str) -> None:
if not symbol:

View File

@@ -42,6 +42,7 @@
<PackageReference Include="QuantConnect.pythonnet" Version="2.0.23" />
</ItemGroup>
<ItemGroup>
<Content Include="FundamentalUniverseSelectionAlgorithm.py" />
<Content Include="AccumulativeInsightPortfolioRegressionAlgorithm.py" />
<Content Include="CustomDataTypeHistoryAlgorithm.py" />
<Content Include="CorrectConsolidatedBarTypeForTickTypesAlgorithm.py" />

View File

@@ -24,6 +24,7 @@ using QuantConnect.Data.Market;
using System.Collections.Generic;
using QuantConnect.Python;
using Python.Runtime;
using QuantConnect.Data.UniverseSelection;
namespace QuantConnect.Algorithm
{
@@ -331,7 +332,7 @@ namespace QuantConnect.Algorithm
DataNormalizationMode? dataNormalizationMode = null, int? contractDepthOffset = null)
where T : IBaseData
{
CheckPeriodBasedHistoryRequestResolution(symbols, resolution);
CheckPeriodBasedHistoryRequestResolution(symbols, resolution, typeof(T));
var requests = CreateBarCountHistoryRequests(symbols, typeof(T), periods, resolution, fillForward, extendedMarketHours, dataMappingMode,
dataNormalizationMode, contractDepthOffset);
return GetDataTypedHistory<T>(requests);
@@ -408,8 +409,8 @@ namespace QuantConnect.Algorithm
{
if (symbol == null) throw new ArgumentException(_symbolEmptyErrorMessage);
resolution = GetResolution(symbol, resolution);
CheckPeriodBasedHistoryRequestResolution(new[] { symbol }, resolution);
resolution = GetResolution(symbol, resolution, typeof(TradeBar));
CheckPeriodBasedHistoryRequestResolution(new[] { symbol }, resolution, typeof(TradeBar));
var marketHours = GetMarketHours(symbol);
var start = _historyRequestFactory.GetStartTimeAlgoTz(symbol, periods, resolution.Value, marketHours.ExchangeHours,
marketHours.DataTimeZone, extendedMarketHours);
@@ -439,8 +440,8 @@ namespace QuantConnect.Algorithm
int? contractDepthOffset = null)
where T : IBaseData
{
resolution = GetResolution(symbol, resolution);
CheckPeriodBasedHistoryRequestResolution(new[] { symbol }, resolution);
resolution = GetResolution(symbol, resolution, typeof(T));
CheckPeriodBasedHistoryRequestResolution(new[] { symbol }, resolution, typeof(T));
var requests = CreateBarCountHistoryRequests(new [] { symbol }, typeof(T), periods, resolution, fillForward, extendedMarketHours,
dataMappingMode, dataNormalizationMode, contractDepthOffset);
return GetDataTypedHistory<T>(requests, symbol);
@@ -518,7 +519,7 @@ namespace QuantConnect.Algorithm
Error("Calling History<TradeBar> method on a Forex or CFD security will return an empty result. Please use the generic version with QuoteBar type parameter.");
}
var resolutionToUse = resolution ?? GetResolution(symbol, resolution);
var resolutionToUse = resolution ?? GetResolution(symbol, resolution, typeof(TradeBar));
if (resolutionToUse == Resolution.Tick)
{
throw new InvalidOperationException("Calling History<TradeBar> method with Resolution.Tick will return an empty result." +
@@ -573,7 +574,7 @@ namespace QuantConnect.Algorithm
bool? extendedMarketHours = null, DataMappingMode? dataMappingMode = null, DataNormalizationMode? dataNormalizationMode = null,
int? contractDepthOffset = null)
{
CheckPeriodBasedHistoryRequestResolution(symbols, resolution);
CheckPeriodBasedHistoryRequestResolution(symbols, resolution, null);
return History(CreateBarCountHistoryRequests(symbols, periods, resolution, fillForward, extendedMarketHours, dataMappingMode,
dataNormalizationMode, contractDepthOffset)).Memoize();
}
@@ -803,44 +804,10 @@ namespace QuantConnect.Algorithm
return result.Memoize();
}
[DocumentationAttribute(HistoricalData)]
private IEnumerable<Slice> History(IEnumerable<HistoryRequest> requests, DateTimeZone timeZone)
{
var sentMessage = false;
var hasPythonDataRequest = false;
// filter out any universe securities that may have made it this far
var filteredRequests = requests.Where(hr => HistoryRequestValid(hr.Symbol)).ToList();
for (var i = 0; i < filteredRequests.Count; i++)
{
var request = filteredRequests[i];
// prevent future requests
if (request.EndTimeUtc > UtcTime)
{
var endTimeUtc = UtcTime;
var startTimeUtc = request.StartTimeUtc;
if (request.StartTimeUtc > request.EndTimeUtc)
{
startTimeUtc = request.EndTimeUtc;
}
filteredRequests[i] = new HistoryRequest(startTimeUtc, endTimeUtc,
request.DataType, request.Symbol, request.Resolution, request.ExchangeHours,
request.DataTimeZone, request.FillForwardResolution, request.IncludeExtendedMarketHours,
request.IsCustomData, request.DataNormalizationMode, request.TickType, request.DataMappingMode,
request.ContractDepthOffset);
if (!sentMessage)
{
sentMessage = true;
Debug("Request for future history modified to end now.");
}
}
if (!hasPythonDataRequest)
{
hasPythonDataRequest = request.IsCustomData && typeof(PythonData).IsAssignableFrom(request.DataType);
}
}
var filteredRequests = GetFilterestRequests(requests, out var hasPythonDataRequest);
// filter out future data to prevent look ahead bias
var history = HistoryProvider.GetHistory(filteredRequests, timeZone);
@@ -854,6 +821,61 @@ namespace QuantConnect.Algorithm
return history;
}
private List<HistoryRequest> GetFilterestRequests(IEnumerable<HistoryRequest> requests, out bool hasPythonDataRequest)
{
List<HistoryRequest> result = new();
hasPythonDataRequest = false;
var sentMessage = false;
// filter out any universe securities that may have made it this far
Dictionary<Type, HistoryRequest> baseDataCollectionTypes = null;
foreach (var request in requests.Where(hr => HistoryRequestValid(hr.Symbol)))
{
if (request.DataType.IsAssignableTo(typeof(BaseDataCollection)))
{
baseDataCollectionTypes ??= new();
if (!baseDataCollectionTypes.TryAdd(request.DataType, request))
{
// for base data collection types we allow a single history request at the time, these are universe types which return all available data
continue;
}
}
// prevent future requests
if (request.EndTimeUtc > UtcTime)
{
var endTimeUtc = UtcTime;
var startTimeUtc = request.StartTimeUtc;
if (request.StartTimeUtc > request.EndTimeUtc)
{
startTimeUtc = request.EndTimeUtc;
}
result.Add(new HistoryRequest(startTimeUtc, endTimeUtc,
request.DataType, request.Symbol, request.Resolution, request.ExchangeHours,
request.DataTimeZone, request.FillForwardResolution, request.IncludeExtendedMarketHours,
request.IsCustomData, request.DataNormalizationMode, request.TickType, request.DataMappingMode,
request.ContractDepthOffset));
if (!sentMessage)
{
sentMessage = true;
Debug("Request for future history modified to end now.");
}
}
else
{
result.Add(request);
}
if (!hasPythonDataRequest)
{
hasPythonDataRequest = request.IsCustomData && typeof(PythonData).IsAssignableFrom(request.DataType);
}
}
return result;
}
/// <summary>
/// Helper method to create history requests from a date range
/// </summary>
@@ -907,7 +929,7 @@ namespace QuantConnect.Algorithm
{
return symbols.Where(HistoryRequestValid).SelectMany(symbol =>
{
var res = GetResolution(symbol, resolution);
var res = GetResolution(symbol, resolution, requestedType);
var exchange = GetExchangeHours(symbol, requestedType);
var configs = GetMatchingSubscriptions(symbol, requestedType, resolution).ToList();
if (configs.Count == 0)
@@ -984,7 +1006,7 @@ namespace QuantConnect.Algorithm
else
{
var entry = MarketHoursDatabase.GetEntry(symbol, new []{ type });
resolution = GetResolution(symbol, resolution);
resolution = GetResolution(symbol, resolution, type);
if (!LeanData.IsCommonLeanDataType(type) && !type.IsAbstract)
{
@@ -1057,7 +1079,7 @@ namespace QuantConnect.Algorithm
return hoursEntry;
}
private Resolution GetResolution(Symbol symbol, Resolution? resolution)
private Resolution GetResolution(Symbol symbol, Resolution? resolution, Type type)
{
Security security;
if (Securities.TryGetValue(symbol, out security))
@@ -1089,7 +1111,27 @@ namespace QuantConnect.Algorithm
}
else
{
return resolution ?? UniverseSettings.Resolution;
if(resolution != null)
{
return resolution.Value;
}
if (type == null || LeanData.IsCommonLeanDataType(type) || type.IsAbstract)
{
return UniverseSettings.Resolution;
}
try
{
// for custom data types let's try to fetch the default resolution from the type definition
var instance = type.GetBaseDataInstance();
return instance.DefaultResolution();
}
catch
{
// just in case
return UniverseSettings.Resolution;
}
}
}
@@ -1120,9 +1162,9 @@ namespace QuantConnect.Algorithm
/// <summary>
/// Throws if a period bases history request is made for tick resolution, which is not allowed.
/// </summary>
private void CheckPeriodBasedHistoryRequestResolution(IEnumerable<Symbol> symbols, Resolution? resolution)
private void CheckPeriodBasedHistoryRequestResolution(IEnumerable<Symbol> symbols, Resolution? resolution, Type requestedType)
{
if (symbols.Any(symbol => GetResolution(symbol, resolution) == Resolution.Tick))
if (symbols.Any(symbol => GetResolution(symbol, resolution, requestedType) == Resolution.Tick))
{
throw new InvalidOperationException("History functions that accept a 'periods' parameter can not be used with Resolution.Tick");
}

View File

@@ -2399,7 +2399,7 @@ namespace QuantConnect.Algorithm
[DocumentationAttribute(Indicators)]
public void WarmUpIndicator(Symbol symbol, IndicatorBase<IndicatorDataPoint> indicator, Resolution? resolution = null, Func<IBaseData, decimal> selector = null)
{
resolution = GetResolution(symbol, resolution);
resolution = GetResolution(symbol, resolution, null);
var period = resolution.Value.ToTimeSpan();
WarmUpIndicator(symbol, indicator, period, selector);
}
@@ -2442,7 +2442,7 @@ namespace QuantConnect.Algorithm
public void WarmUpIndicator<T>(Symbol symbol, IndicatorBase<T> indicator, Resolution? resolution = null, Func<IBaseData, T> selector = null)
where T : class, IBaseData
{
resolution = GetResolution(symbol, resolution);
resolution = GetResolution(symbol, resolution, typeof(T));
var period = resolution.Value.ToTimeSpan();
WarmUpIndicator(symbol, indicator, period, selector);
}

View File

@@ -287,7 +287,7 @@ namespace QuantConnect.Algorithm
[DocumentationAttribute(Universes)]
public Universe AddUniverse(PyObject pyObject)
{
Func<IEnumerable<CoarseFundamental>, object> coarseFunc;
Func<IEnumerable<Fundamental>, object> coarseFunc;
Universe universe;
// TODO: to be removed when https://github.com/QuantConnect/pythonnet/issues/62 is solved
@@ -301,7 +301,7 @@ namespace QuantConnect.Algorithm
}
else if (pyObject.TryConvertToDelegate(out coarseFunc))
{
return AddUniverse(coarseFunc.ConvertToUniverseSelectionSymbolDelegate());
return AddUniverse(new FundamentalUniverse(UniverseSettings, pyObject));
}
else
{
@@ -852,6 +852,13 @@ namespace QuantConnect.Algorithm
bool? extendedMarketHours = null, DataMappingMode? dataMappingMode = null, DataNormalizationMode? dataNormalizationMode = null,
int? contractDepthOffset = null)
{
if (tickers.TryConvert<Type>(out var type))
{
var requests = CreateBarCountHistoryRequests(Securities.Keys, type, periods, resolution, fillForward, extendedMarketHours,
dataMappingMode, dataNormalizationMode, contractDepthOffset);
return GetDataFrame(History(requests.Where(x => x != null)), type);
}
var symbols = tickers.ConvertToSymbolEnumerable();
return GetDataFrame(History(symbols, periods, resolution, fillForward, extendedMarketHours, dataMappingMode, dataNormalizationMode,
contractDepthOffset));
@@ -876,9 +883,7 @@ namespace QuantConnect.Algorithm
bool? extendedMarketHours = null, DataMappingMode? dataMappingMode = null, DataNormalizationMode? dataNormalizationMode = null,
int? contractDepthOffset = null)
{
var symbols = tickers.ConvertToSymbolEnumerable();
return GetDataFrame(History(symbols, span, resolution, fillForward, extendedMarketHours, dataMappingMode, dataNormalizationMode,
contractDepthOffset));
return History(tickers, Time - span, Time, resolution, fillForward, extendedMarketHours, dataMappingMode, dataNormalizationMode, contractDepthOffset);
}
/// <summary>
@@ -900,26 +905,18 @@ namespace QuantConnect.Algorithm
bool? extendedMarketHours = null, DataMappingMode? dataMappingMode = null, DataNormalizationMode? dataNormalizationMode = null,
int? contractDepthOffset = null)
{
if (tickers.TryConvert<Type>(out var type))
{
var requests = CreateDateRangeHistoryRequests(Securities.Keys, type, start, end, resolution, fillForward, extendedMarketHours,
dataMappingMode, dataNormalizationMode, contractDepthOffset);
return GetDataFrame(History(requests.Where(x => x != null)), type);
}
var symbols = tickers.ConvertToSymbolEnumerable();
return GetDataFrame(History(symbols, start, end, resolution, fillForward, extendedMarketHours, dataMappingMode,
dataNormalizationMode, contractDepthOffset));
}
/// <summary>
/// Gets the historical data for the specified symbol between the specified dates. The symbol must exist in the Securities collection.
/// </summary>
/// <param name="tickers">The symbols to retrieve historical data for</param>
/// <param name="start">The start time in the algorithm's time zone</param>
/// <param name="end">The end time in the algorithm's time zone</param>
/// <param name="resolution">The resolution to request</param>
/// <returns>A python dictionary with pandas DataFrame containing the requested historical data</returns>
[DocumentationAttribute(HistoricalData)]
public PyObject History(PyObject tickers, DateTime start, DateTime end, Resolution? resolution = null)
{
var symbols = tickers.ConvertToSymbolEnumerable();
return GetDataFrame(History(symbols, start, end, resolution));
}
/// <summary>
/// Gets the historical data for the specified symbols between the specified dates. The symbols must exist in the Securities collection.
/// </summary>
@@ -969,9 +966,9 @@ namespace QuantConnect.Algorithm
int? contractDepthOffset = null)
{
var symbols = tickers.ConvertToSymbolEnumerable();
CheckPeriodBasedHistoryRequestResolution(symbols, resolution);
var requestedType = type.CreateType();
CheckPeriodBasedHistoryRequestResolution(symbols, resolution, requestedType);
var requests = CreateBarCountHistoryRequests(symbols, requestedType, periods, resolution, fillForward, extendedMarketHours,
dataMappingMode, dataNormalizationMode, contractDepthOffset);
@@ -1077,10 +1074,10 @@ namespace QuantConnect.Algorithm
bool? extendedMarketHours = null, DataMappingMode? dataMappingMode = null, DataNormalizationMode? dataNormalizationMode = null,
int? contractDepthOffset = null)
{
resolution = GetResolution(symbol, resolution);
CheckPeriodBasedHistoryRequestResolution(new[] { symbol }, resolution);
var managedType = type.CreateType();
resolution = GetResolution(symbol, resolution, managedType);
CheckPeriodBasedHistoryRequestResolution(new[] { symbol }, resolution, managedType);
var marketHours = GetMarketHours(symbol, managedType);
var start = _historyRequestFactory.GetStartTimeAlgoTz(symbol, periods, resolution.Value, marketHours.ExchangeHours,
marketHours.DataTimeZone, extendedMarketHours);

View File

@@ -399,9 +399,9 @@ namespace QuantConnect.Algorithm
/// </summary>
/// <param name="selector">Defines an initial coarse selection</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(Func<IEnumerable<CoarseFundamental>, IEnumerable<Symbol>> selector)
public Universe AddUniverse(Func<IEnumerable<Fundamental>, IEnumerable<Symbol>> selector)
{
return AddUniverse(new CoarseFundamentalUniverse(UniverseSettings, selector));
return AddUniverse(new FundamentalUniverse(UniverseSettings, selector));
}
/// <summary>
@@ -425,9 +425,9 @@ namespace QuantConnect.Algorithm
/// <param name="universe">The universe to be filtered with fine fundamental selection</param>
/// <param name="fineSelector">Defines a more detailed selection with access to more data</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(Universe universe, Func<IEnumerable<FineFundamental>, IEnumerable<Symbol>> fineSelector)
public Universe AddUniverse(Universe universe, Func<IEnumerable<Fundamental>, IEnumerable<Symbol>> fineSelector)
{
return AddUniverse(new FineFundamentalFilteredUniverse(universe, fineSelector));
return AddUniverse(new FundamentalFilteredUniverse(universe, fineSelector));
}
/// <summary>
@@ -471,7 +471,7 @@ namespace QuantConnect.Algorithm
var dataTimeZone = marketHoursDbEntry.DataTimeZone;
var exchangeTimeZone = marketHoursDbEntry.ExchangeHours.TimeZone;
var symbol = QuantConnect.Symbol.Create(name, securityType, market);
var config = new SubscriptionDataConfig(typeof(CoarseFundamental), symbol, resolution, dataTimeZone, exchangeTimeZone, false, false, true, isFilteredSubscription: false);
var config = new SubscriptionDataConfig(typeof(Fundamental), symbol, resolution, dataTimeZone, exchangeTimeZone, false, false, true, isFilteredSubscription: false);
return AddUniverse(new UserDefinedUniverse(config, universeSettings, resolution.ToTimeSpan(), selector));
}
@@ -633,6 +633,10 @@ namespace QuantConnect.Algorithm
/// </summary>
private SubscriptionDataConfig GetCustomUniverseConfiguration(Type dataType, string name, Resolution resolution, string market)
{
if (dataType == typeof(CoarseFundamental) || dataType == typeof(FineFundamental))
{
dataType = typeof(Fundamentals);
}
// same as 'AddData<>' 'T' type will be treated as custom/base data type with always open market hours
var universeSymbol = QuantConnect.Symbol.Create(name, SecurityType.Base, market, baseDataType: dataType);
var marketHoursDbEntry = MarketHoursDatabase.GetEntry(universeSymbol, new[] { dataType });

View File

@@ -50,6 +50,7 @@ using Index = QuantConnect.Securities.Index.Index;
using QuantConnect.Securities.CryptoFuture;
using QuantConnect.Algorithm.Framework.Alphas.Analysis;
using QuantConnect.Algorithm.Framework.Portfolio.SignalExports;
using QuantConnect.Data.Fundamental;
namespace QuantConnect.Algorithm
{
@@ -1859,7 +1860,7 @@ namespace QuantConnect.Algorithm
{
// add the expected configurations of the canonical symbol right away, will allow it to warmup and indicators register to them
var dataTypes = SubscriptionManager.LookupSubscriptionConfigDataTypes(SecurityType.Future,
GetResolution(symbol, resolution), isCanonical: false);
GetResolution(symbol, resolution, null), isCanonical: false);
var continuousUniverseSettings = new UniverseSettings(settings)
{
ExtendedMarketHours = extendedMarketHours,
@@ -3116,6 +3117,58 @@ namespace QuantConnect.Algorithm
return _securityDefinitionSymbolResolver.SEDOL(symbol);
}
/// <summary>
/// Converts a CIK identifier into <see cref="Symbol"/> array
/// </summary>
/// <param name="cik">The CIK identifier of an asset</param>
/// <param name="tradingDate">
/// The date that the stock being looked up is/was traded at.
/// The date is used to create a Symbol with the ticker set to the ticker the asset traded under on the trading date.
/// </param>
/// <returns>Symbols corresponding to the CIK. If no Symbol with a matching CIK was found, returns empty array.</returns>
[DocumentationAttribute(HandlingData)]
[DocumentationAttribute(SecuritiesAndPortfolio)]
public Symbol[] CIK(int cik, DateTime? tradingDate = null)
{
return _securityDefinitionSymbolResolver.CIK(cik, GetVerifiedTradingDate(tradingDate));
}
/// <summary>
/// Converts a <see cref="Symbol"/> into a CIK identifier
/// </summary>
/// <param name="symbol">The <see cref="Symbol"/></param>
/// <returns>CIK corresponding to the Symbol. If no matching CIK is found, returns null.</returns>
[DocumentationAttribute(HandlingData)]
[DocumentationAttribute(SecuritiesAndPortfolio)]
public int? CIK(Symbol symbol)
{
return _securityDefinitionSymbolResolver.CIK(symbol);
}
/// <summary>
/// Get the fundamental data for the requested symbol at the current time
/// </summary>
/// <param name="symbol">The <see cref="Symbol"/></param>
/// <returns>The fundamental data for the Symbol</returns>
[DocumentationAttribute(HandlingData)]
[DocumentationAttribute(SecuritiesAndPortfolio)]
public Fundamental Fundamentals(Symbol symbol)
{
return new Fundamental(Time, symbol) { EndTime = Time };
}
/// <summary>
/// Get the fundamental data for the requested symbols at the current time
/// </summary>
/// <param name="symbols">The <see cref="Symbol"/></param>
/// <returns>The fundamental data for the symbols</returns>
[DocumentationAttribute(HandlingData)]
[DocumentationAttribute(SecuritiesAndPortfolio)]
public List<Fundamental> Fundamentals(List<Symbol> symbols)
{
return symbols.Select(symbol => Fundamentals(symbol)).ToList();
}
/// <summary>
/// Set the properties and exchange hours for a given key into our databases
/// </summary>

View File

@@ -15,10 +15,11 @@
*/
using System;
using System.Collections.Generic;
using System.Linq;
using Python.Runtime;
using QuantConnect.Data;
using System.Collections.Generic;
using QuantConnect.Data.Fundamental;
using QuantConnect.Data.UniverseSelection;
namespace QuantConnect.Algorithm
@@ -344,9 +345,9 @@ namespace QuantConnect.Algorithm
universeSettings ??= _algorithm.UniverseSettings;
var symbol = Symbol.Create("us-equity-dollar-volume-top-" + count, SecurityType.Equity, Market.USA);
var config = new SubscriptionDataConfig(typeof(CoarseFundamental), symbol, Resolution.Daily, TimeZones.NewYork, TimeZones.NewYork, false, false, true);
var config = new SubscriptionDataConfig(typeof(Fundamental), symbol, Resolution.Daily, TimeZones.NewYork, TimeZones.NewYork, false, false, true);
return new FuncUniverse(config, universeSettings, selectionData => (
from c in selectionData.OfType<CoarseFundamental>()
from c in selectionData.OfType<Fundamental>()
orderby c.DollarVolume descending
select c.Symbol).Take(count)
);

View File

@@ -14,9 +14,8 @@
*/
using System;
using System.IO;
using Newtonsoft.Json;
using static QuantConnect.StringExtensions;
using System.Collections.Generic;
namespace QuantConnect.Data.Fundamental
{
@@ -41,36 +40,14 @@ namespace QuantConnect.Data.Fundamental
/// For ADR share classes, market cap is price * (ordinary shares outstanding / adr ratio).
/// </summary>
[JsonIgnore]
public long MarketCap => CompanyProfile?.MarketCap ?? 0;
/// <summary>
/// Creates the universe symbol used for fine fundamental data
/// </summary>
/// <param name="market">The market</param>
/// <param name="addGuid">True, will add a random GUID to allow uniqueness</param>
/// <returns>A fine universe symbol for the specified market</returns>
public static Symbol CreateUniverseSymbol(string market, bool addGuid = true)
{
market = market.ToLowerInvariant();
var ticker = $"qc-universe-fine-{market}";
if (addGuid)
{
ticker += $"-{Guid.NewGuid()}";
}
var sid = SecurityIdentifier.GenerateEquity(SecurityIdentifier.DefaultDate, ticker, market);
return new Symbol(sid, ticker);
}
public long MarketCap => CompanyProfile.MarketCap;
/// <summary>
/// Return the URL string source of the file. This will be converted to a stream
/// </summary>
public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
{
var basePath = Globals.GetDataFolderPath(Invariant($"equity/{config.Market}/fundamental/fine"));
var source = Path.Combine(basePath, Invariant($"{config.Symbol.Value.ToLowerInvariant()}/{date:yyyyMMdd}.zip"));
return new SubscriptionDataSource(source, SubscriptionTransportMedium.LocalFile, FileFormat.Csv);
throw new InvalidOperationException();
}
/// <summary>
@@ -79,13 +56,32 @@ namespace QuantConnect.Data.Fundamental
/// </summary>
public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode)
{
var data = JsonConvert.DeserializeObject<FineFundamental>(line);
throw new InvalidOperationException();
}
data.DataType = MarketDataType.Auxiliary;
data.Symbol = config.Symbol;
data.Time = date;
/// <summary>
/// Clones this fine data instance
/// </summary>
/// <returns></returns>
public override BaseData Clone()
{
return new FineFundamental(Time, Symbol, _fundamentalInstanceProvider);
}
return data;
/// <summary>
/// This is a daily data set
/// </summary>
public override List<Resolution> SupportedResolutions()
{
return DailyResolution;
}
/// <summary>
/// This is a daily data set
/// </summary>
public override Resolution DefaultResolution()
{
return Resolution.Daily;
}
}
}

View File

@@ -0,0 +1,128 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 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.IO;
using QuantConnect.Data.UniverseSelection;
namespace QuantConnect.Data.Fundamental
{
/// <summary>
/// Lean fundamental data class
/// </summary>
public class Fundamental : FineFundamental
{
/// <summary>
/// Gets the day's dollar volume for this symbol
/// </summary>
public override double DollarVolume => FundamentalService.Get<double>(Time, Symbol.ID, FundamentalProperty.DollarVolume);
/// <summary>
/// Gets the day's total volume
/// </summary>
public override long Volume => FundamentalService.Get<long>(Time, Symbol.ID, FundamentalProperty.Volume);
/// <summary>
/// Returns whether the symbol has fundamental data for the given date
/// </summary>
public override bool HasFundamentalData => FundamentalService.Get<bool>(Time, Symbol.ID, FundamentalProperty.HasFundamentalData);
/// <summary>
/// Gets the price factor for the given date
/// </summary>
public override decimal PriceFactor => FundamentalService.Get<decimal>(Time, Symbol.ID, FundamentalProperty.PriceFactor);
/// <summary>
/// Gets the split factor for the given date
/// </summary>
public override decimal SplitFactor => FundamentalService.Get<decimal>(Time, Symbol.ID, FundamentalProperty.SplitFactor);
/// <summary>
/// Gets the raw price
/// </summary>
public override decimal Value => FundamentalService.Get<decimal>(Time, Symbol.ID, FundamentalProperty.Value);
/// <summary>
/// Creates a new empty instance
/// </summary>
public Fundamental()
{
}
/// <summary>
/// Creates a new instance
/// </summary>
/// <param name="time">The current time</param>
/// <param name="symbol">The associated symbol</param>
public Fundamental(DateTime time, Symbol symbol)
: base(time, symbol)
{
}
/// <summary>
/// Return the URL string source of the file. This will be converted to a stream
/// </summary>
public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
{
var path = Path.Combine(Globals.DataFolder, "equity", config.Market, "fundamental", "coarse", $"{date:yyyyMMdd}.csv");
return new SubscriptionDataSource(path, SubscriptionTransportMedium.LocalFile, FileFormat.Csv);
}
/// <summary>
/// Will read a new instance from the given line
/// </summary>
/// <param name="config">The associated requested configuration</param>
/// <param name="line">The line to parse</param>
/// <param name="date">The current time</param>
/// <param name="isLiveMode">True if live mode</param>
/// <returns>A new instance or null</returns>
public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode)
{
try
{
var csv = line.Split(',');
var sid = SecurityIdentifier.Parse(csv[0]);
// This use case/Reader implementation is only for history, where the user requests specific symbols only
// and because we use the same source file as the universe Fundamentals we need to filter out other symbols
if (sid == config.Symbol.ID)
{
return new Fundamental(date, new Symbol(sid, csv[1]));
}
}
catch
{
// pass
}
return null;
}
/// <summary>
/// Will clone the current instance
/// </summary>
/// <returns>The cloned instance</returns>
public override BaseData Clone()
{
return new Fundamental(Time, Symbol);
}
/// <summary>
/// Gets the default resolution for this data and security type
/// </summary>
public override Resolution DefaultResolution()
{
return Resolution.Daily;
}
}
}

View File

@@ -0,0 +1,174 @@
/*
* 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.Collections.Generic;
using System.Runtime.CompilerServices;
namespace QuantConnect.Data.Fundamental
{
/// <summary>
/// Per symbol we will have a fundamental class provider so the instances can be reused
/// </summary>
public class FundamentalInstanceProvider
{
private static readonly Dictionary<SecurityIdentifier, FundamentalInstanceProvider> _cache = new();
private readonly FundamentalTimeProvider _timeProvider;
private readonly FinancialStatements _financialStatements;
private readonly OperationRatios _operationRatios;
private readonly SecurityReference _securityReference;
private readonly CompanyReference _companyReference;
private readonly CompanyProfile _companyProfile;
private readonly AssetClassification _assetClassification;
private readonly ValuationRatios _valuationRatios;
private readonly EarningRatios _earningRatios;
private readonly EarningReports _earningReports;
/// <summary>
/// Get's the fundamental instance provider for the requested symbol
/// </summary>
/// <param name="symbol">The requested symbol</param>
/// <returns>The unique instance provider</returns>
public static FundamentalInstanceProvider Get(Symbol symbol)
{
lock(_cache)
{
if (!_cache.TryGetValue(symbol.ID, out var result))
{
_cache[symbol.ID] = result = new FundamentalInstanceProvider(symbol);
}
return result;
}
}
/// <summary>
/// Creates a new fundamental instance provider
/// </summary>
/// <param name="symbol">The target symbol</param>
private FundamentalInstanceProvider(Symbol symbol)
{
_timeProvider = new();
_financialStatements = new(_timeProvider, symbol.ID);
_operationRatios = new(_timeProvider, symbol.ID);
_securityReference = new(_timeProvider, symbol.ID);
_companyReference = new(_timeProvider, symbol.ID);
_companyProfile = new(_timeProvider, symbol.ID);
_assetClassification = new(_timeProvider, symbol.ID);
_valuationRatios = new(_timeProvider, symbol.ID);
_earningRatios = new(_timeProvider, symbol.ID);
_earningReports = new(_timeProvider, symbol.ID);
}
/// <summary>
/// Returns the ValuationRatios instance
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ValuationRatios GetValuationRatios(DateTime time)
{
_timeProvider.Time = time;
return _valuationRatios;
}
/// <summary>
/// Returns the EarningRatios instance
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public EarningRatios GetEarningRatios(DateTime time)
{
_timeProvider.Time = time;
return _earningRatios;
}
/// <summary>
/// Returns the EarningReports instance
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public EarningReports GetEarningReports(DateTime time)
{
_timeProvider.Time = time;
return _earningReports;
}
/// <summary>
/// Returns the OperationRatios instance
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public OperationRatios GetOperationRatios(DateTime time)
{
_timeProvider.Time = time;
return _operationRatios;
}
/// <summary>
/// Returns the FinancialStatements instance
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public FinancialStatements GetFinancialStatements(DateTime time)
{
_timeProvider.Time = time;
return _financialStatements;
}
/// <summary>
/// Returns the SecurityReference instance
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public SecurityReference GetSecurityReference(DateTime time)
{
_timeProvider.Time = time;
return _securityReference;
}
/// <summary>
/// Returns the CompanyReference instance
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public CompanyReference GetCompanyReference(DateTime time)
{
_timeProvider.Time = time;
return _companyReference;
}
/// <summary>
/// Returns the CompanyProfile instance
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public CompanyProfile GetCompanyProfile(DateTime time)
{
_timeProvider.Time = time;
return _companyProfile;
}
/// <summary>
/// Returns the AssetClassification instance
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public AssetClassification GetAssetClassification(DateTime time)
{
_timeProvider.Time = time;
return _assetClassification;
}
private class FundamentalTimeProvider : ITimeProvider
{
public DateTime Time;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public DateTime GetUtcNow() => Time;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -19,36 +19,26 @@ using QuantConnect.Data.UniverseSelection;
namespace QuantConnect.Data.Fundamental
{
/// <summary>
/// Defines a merged viw of <see cref="FineFundamental"/> and <see cref="CoarseFundamental"/>
/// Lean fundamentals universe data class
/// </summary>
public class Fundamentals : FineFundamental
public class Fundamentals : BaseDataCollection
{
/// <summary>
/// Gets the market for this symbol
/// </summary>
public string Market { get; set; }
private static readonly Fundamental _factory = new();
/// <summary>
/// Gets the day's dollar volume for this symbol
/// </summary>
public decimal DollarVolume { get; set; }
/// <summary>
/// Gets the day's total volume
/// </summary>
public long Volume { get; set; }
/// <summary>
/// Returns whether the symbol has fundamental data for the given date
/// </summary>
public bool HasFundamentalData { get; set; }
/// <summary>
/// Default constructor
/// Creates a new instance
/// </summary>
public Fundamentals()
{
DataType = MarketDataType.Auxiliary;
}
/// <summary>
/// Creates a new instance
/// </summary>
/// <param name="time">The current time</param>
/// <param name="symbol">The associated symbol</param>
public Fundamentals(DateTime time, Symbol symbol) : base(time, symbol)
{
}
/// <summary>
@@ -56,16 +46,52 @@ namespace QuantConnect.Data.Fundamental
/// </summary>
public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
{
throw new NotImplementedException($"{nameof(Fundamentals)}.{nameof(GetSource)} is never intended to be invoked.");
var path = _factory.GetSource(config, date, isLiveMode).Source;
return new SubscriptionDataSource(path, SubscriptionTransportMedium.LocalFile, FileFormat.FoldingCollection);
}
/// <summary>
/// Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object
/// each time it is called. The returned object is assumed to be time stamped in the config.ExchangeTimeZone.
/// Will read a new instance from the given line
/// </summary>
/// <param name="config">The associated requested configuration</param>
/// <param name="line">The line to parse</param>
/// <param name="date">The current time</param>
/// <param name="isLiveMode">True if live mode</param>
/// <returns>A new instance or null</returns>
public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode)
{
throw new NotImplementedException($"{nameof(Fundamentals)}.{nameof(Reader)} is never intended to be invoked.");
try
{
var csv = line.Split(',');
var symbol = new Symbol(SecurityIdentifier.Parse(csv[0]), csv[1]);
return new Fundamental(date, symbol);
}
catch (Exception)
{
return null;
}
}
/// <summary>
/// Will clone the current instance
/// </summary>
/// <returns>The cloned instance</returns>
public override BaseData Clone()
{
return new Fundamentals(Time, Symbol) { Data = Data, EndTime = EndTime };
}
/// <summary>
/// Creates the symbol used for coarse fundamental data
/// </summary>
/// <param name="market">The market</param>
/// <returns>A coarse universe symbol for the specified market</returns>
public static Symbol CreateUniverseSymbol(string market)
{
market = market.ToLowerInvariant();
var ticker = $"qc-universe-fundamental-{market}-{Guid.NewGuid()}";
var sid = SecurityIdentifier.GenerateEquity(SecurityIdentifier.DefaultDate, ticker, market);
return new Symbol(sid, ticker);
}
}
}
}

View File

@@ -0,0 +1,101 @@
/*
* 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>
/// This is the simple average of the company's ROIC over the last 5 years. Return on invested capital is calculated by taking net operating profit after taxes and dividends and dividing by the total amount of capital invested and expressing the result as a percentage.
/// </summary>
public class AVG5YrsROIC : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "FiveYears";
/// <summary>
/// Gets/sets the FiveYears period value for the field
/// </summary>
[JsonProperty("5Y")]
public double FiveYears => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_AVG5YrsROIC_FiveYears);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_AVG5YrsROIC_FiveYears));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_AVG5YrsROIC_FiveYears);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("5Y",FiveYears) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"OperationRatios_AVG5YrsROIC_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AVG5YrsROIC()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AVG5YrsROIC(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// 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.
/// </summary>
public class AccountsPayableBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsPayable_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsPayable_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsPayable_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsPayable_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsPayable_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsPayable_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsPayable_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsPayable_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AccountsPayable_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AccountsPayableBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AccountsPayableBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Accounts owed to a company by customers within a year as a result of exchanging goods or services on credit.
/// </summary>
public class AccountsReceivableBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsReceivable_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsReceivable_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsReceivable_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsReceivable_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsReceivable_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsReceivable_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsReceivable_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccountsReceivable_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AccountsReceivable_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AccountsReceivableBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AccountsReceivableBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,125 @@
/*
* 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>
/// This account shows the amount of unpaid interest accrued to the date of purchase and included in the purchase price of securities purchased between interest dates.
/// </summary>
public class AccruedInterestReceivableBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedInterestReceivable_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedInterestReceivable_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedInterestReceivable_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedInterestReceivable_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedInterestReceivable_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedInterestReceivable_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedInterestReceivable_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AccruedInterestReceivable_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AccruedInterestReceivableBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AccruedInterestReceivableBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,113 @@
/*
* 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>
/// Interest, dividends, rents, ancillary and other revenues earned but not yet received by the entity on its investments.
/// </summary>
public class AccruedInvestmentIncomeBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedInvestmentIncome_ThreeMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedInvestmentIncome_SixMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedInvestmentIncome_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedInvestmentIncome_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedInvestmentIncome_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AccruedInvestmentIncome_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AccruedInvestmentIncomeBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AccruedInvestmentIncomeBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,113 @@
/*
* 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>
/// Liabilities which have occurred, but have not been paid or logged under accounts payable during an accounting PeriodAsByte. In other words, obligations for goods and services provided to a company for which invoices have not yet been received; on a Non- Differentiated Balance Sheet.
/// </summary>
public class AccruedLiabilitiesTotalBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedLiabilitiesTotal_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedLiabilitiesTotal_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedLiabilitiesTotal_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedLiabilitiesTotal_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedLiabilitiesTotal_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AccruedLiabilitiesTotal_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AccruedLiabilitiesTotalBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AccruedLiabilitiesTotalBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// Sum of accrued liabilities and deferred income (amount received in advance but the services are not provided in respect of amount).
/// </summary>
public class AccruedandDeferredIncomeBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedandDeferredIncome_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedandDeferredIncome_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedandDeferredIncome_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedandDeferredIncome_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AccruedandDeferredIncome_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AccruedandDeferredIncomeBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AccruedandDeferredIncomeBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// Sum of Accrued Liabilities and Deferred Income (amount received in advance but the services are not provided in respect of amount) due within 1 year.
/// </summary>
public class AccruedandDeferredIncomeCurrentBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedandDeferredIncomeCurrent_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedandDeferredIncomeCurrent_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedandDeferredIncomeCurrent_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedandDeferredIncomeCurrent_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AccruedandDeferredIncomeCurrent_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AccruedandDeferredIncomeCurrentBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AccruedandDeferredIncomeCurrentBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// Sum of Accrued Liabilities and Deferred Income (amount received in advance but the services are not provided in respect of amount) due after 1 year.
/// </summary>
public class AccruedandDeferredIncomeNonCurrentBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedandDeferredIncomeNonCurrent_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedandDeferredIncomeNonCurrent_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedandDeferredIncomeNonCurrent_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccruedandDeferredIncomeNonCurrent_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AccruedandDeferredIncomeNonCurrent_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AccruedandDeferredIncomeNonCurrentBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AccruedandDeferredIncomeNonCurrentBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// The cumulative amount of wear and tear or obsolescence charged against the fixed assets of a company.
/// </summary>
public class AccumulatedDepreciationBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccumulatedDepreciation_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccumulatedDepreciation_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccumulatedDepreciation_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccumulatedDepreciation_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccumulatedDepreciation_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccumulatedDepreciation_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccumulatedDepreciation_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AccumulatedDepreciation_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AccumulatedDepreciation_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AccumulatedDepreciationBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AccumulatedDepreciationBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Excess of issue price over par or stated value of the entity's capital stock and amounts received from other transactions involving the entity's stock or stockholders. Includes adjustments to additional paid in capital. There are two major categories of additional paid in capital: 1) Paid in capital in excess of par/stated value, which is the difference between the actual issue price of the shares and the shares' par/stated value. 2) Paid in capital from other transactions which includes treasury stock, retirement of stock, stock dividends recorded at market, lapse of stock purchase warrants, conversion of convertible bonds in excess of the par value of the stock, and any other additional capital from the company's own stock transactions.
/// </summary>
public class AdditionalPaidInCapitalBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdditionalPaidInCapital_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdditionalPaidInCapital_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdditionalPaidInCapital_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdditionalPaidInCapital_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdditionalPaidInCapital_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdditionalPaidInCapital_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdditionalPaidInCapital_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdditionalPaidInCapital_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AdditionalPaidInCapital_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AdditionalPaidInCapitalBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AdditionalPaidInCapitalBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,119 @@
/*
* 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>
/// This item is typically available for bank industry. It's the amount of borrowings as of the balance sheet date from the Federal Home Loan Bank, which are primarily used to cover shortages in the required reserve balance and liquidity shortages.
/// </summary>
public class AdvanceFromFederalHomeLoanBanksBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdvanceFromFederalHomeLoanBanks_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdvanceFromFederalHomeLoanBanks_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdvanceFromFederalHomeLoanBanks_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdvanceFromFederalHomeLoanBanks_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdvanceFromFederalHomeLoanBanks_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdvanceFromFederalHomeLoanBanks_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AdvanceFromFederalHomeLoanBanks_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AdvanceFromFederalHomeLoanBanksBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AdvanceFromFederalHomeLoanBanksBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// Borrowings from the central bank, which are primarily used to cover shortages in the required reserve balance and liquidity shortages.
/// </summary>
public class AdvancesfromCentralBanksBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdvancesfromCentralBanks_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdvancesfromCentralBanks_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdvancesfromCentralBanks_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AdvancesfromCentralBanks_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AdvancesfromCentralBanks_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AdvancesfromCentralBanksBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AdvancesfromCentralBanksBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,125 @@
/*
* 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>
/// Cash paid to tax authorities in operating cash flow, using the direct method
/// </summary>
public class AllTaxesPaidCashFlowStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AllTaxesPaid_OneMonth);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AllTaxesPaid_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AllTaxesPaid_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AllTaxesPaid_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AllTaxesPaid_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AllTaxesPaid_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AllTaxesPaid_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_CashFlowStatement_AllTaxesPaid_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AllTaxesPaidCashFlowStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AllTaxesPaidCashFlowStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// An Allowance for Doubtful Accounts measures receivables recorded but not expected to be collected.
/// </summary>
public class AllowanceForDoubtfulAccountsReceivableBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForDoubtfulAccountsReceivable_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForDoubtfulAccountsReceivable_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForDoubtfulAccountsReceivable_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForDoubtfulAccountsReceivable_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AllowanceForDoubtfulAccountsReceivable_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AllowanceForDoubtfulAccountsReceivableBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AllowanceForDoubtfulAccountsReceivableBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,119 @@
/*
* 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>
/// A contra account sets aside as an allowance for bad loans (e.g. customer defaults).
/// </summary>
public class AllowanceForLoansAndLeaseLossesBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForLoansAndLeaseLosses_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForLoansAndLeaseLosses_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForLoansAndLeaseLosses_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForLoansAndLeaseLosses_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForLoansAndLeaseLosses_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForLoansAndLeaseLosses_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AllowanceForLoansAndLeaseLosses_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AllowanceForLoansAndLeaseLossesBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AllowanceForLoansAndLeaseLossesBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// This item is typically available for bank industry. It represents a provision relating to a written agreement to receive money with the terms of the note (at a specified future date(s) within one year from the reporting date (or the normal operating cycle, whichever is longer), consisting of principal as well as any accrued interest) for the portion that is expected to be uncollectible.
/// </summary>
public class AllowanceForNotesReceivableBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForNotesReceivable_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForNotesReceivable_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForNotesReceivable_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AllowanceForNotesReceivable_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AllowanceForNotesReceivable_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AllowanceForNotesReceivableBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AllowanceForNotesReceivableBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// The systematic and rational apportionment of the acquisition cost of intangible operational assets to future periods in which the benefits contribute to revenue. This field is to include Amortization and any variation where Amortization is the first account listed in the line item, excluding Amortization of Intangibles.
/// </summary>
public class AmortizationCashFlowStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_Amortization_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_Amortization_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_Amortization_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_Amortization_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_Amortization_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_Amortization_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_Amortization_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_Amortization_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_CashFlowStatement_Amortization_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AmortizationCashFlowStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AmortizationCashFlowStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// The non-cash expense recognized on intangible assets over the benefit period of the asset.
/// </summary>
public class AmortizationIncomeStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_Amortization_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_Amortization_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_Amortization_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_Amortization_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_Amortization_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_Amortization_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_Amortization_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_Amortization_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_IncomeStatement_Amortization_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AmortizationIncomeStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AmortizationIncomeStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// The component of interest expense representing the non-cash expenses charged against earnings in the period to allocate debt discount and premium, and the costs to issue debt and obtain financing over the related debt instruments. This item is usually only available for bank industry.
/// </summary>
public class AmortizationOfFinancingCostsAndDiscountsCashFlowStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfFinancingCostsAndDiscounts_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfFinancingCostsAndDiscounts_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfFinancingCostsAndDiscounts_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfFinancingCostsAndDiscounts_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfFinancingCostsAndDiscounts_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfFinancingCostsAndDiscounts_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfFinancingCostsAndDiscounts_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfFinancingCostsAndDiscounts_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_CashFlowStatement_AmortizationOfFinancingCostsAndDiscounts_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AmortizationOfFinancingCostsAndDiscountsCashFlowStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AmortizationOfFinancingCostsAndDiscountsCashFlowStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// The aggregate expense charged against earnings to allocate the cost of intangible assets (nonphysical assets not used in production) in a systematic and rational manner to the periods expected to benefit from such assets.
/// </summary>
public class AmortizationOfIntangiblesCashFlowStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfIntangibles_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfIntangibles_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfIntangibles_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfIntangibles_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfIntangibles_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfIntangibles_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfIntangibles_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfIntangibles_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_CashFlowStatement_AmortizationOfIntangibles_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AmortizationOfIntangiblesCashFlowStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AmortizationOfIntangiblesCashFlowStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// The aggregate expense charged against earnings to allocate the cost of intangible assets (nonphysical assets not used in production) in a systematic and rational manner to the periods expected to benefit from such assets.
/// </summary>
public class AmortizationOfIntangiblesIncomeStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationOfIntangibles_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationOfIntangibles_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationOfIntangibles_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationOfIntangibles_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationOfIntangibles_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationOfIntangibles_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationOfIntangibles_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationOfIntangibles_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_IncomeStatement_AmortizationOfIntangibles_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AmortizationOfIntangiblesIncomeStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AmortizationOfIntangiblesIncomeStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Represents amortization of the allocation of a lump sum amount to different time periods, particularly for securities, debt, loans, and other forms of financing. Does not include amortization, amortization of capital expenditure and intangible assets.
/// </summary>
public class AmortizationOfSecuritiesCashFlowStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfSecurities_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfSecurities_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfSecurities_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfSecurities_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfSecurities_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfSecurities_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfSecurities_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AmortizationOfSecurities_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_CashFlowStatement_AmortizationOfSecurities_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AmortizationOfSecuritiesCashFlowStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AmortizationOfSecuritiesCashFlowStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,119 @@
/*
* 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>
/// The current period expense charged against earnings on intangible asset over its useful life. It is a supplemental value which would be reported outside consolidated statements.
/// </summary>
public class AmortizationSupplementalIncomeStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationSupplemental_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationSupplemental_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationSupplemental_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationSupplemental_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationSupplemental_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AmortizationSupplemental_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_IncomeStatement_AmortizationSupplemental_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AmortizationSupplementalIncomeStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AmortizationSupplementalIncomeStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
* 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.
@@ -11,278 +11,186 @@
* 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.
*
*/
//------------------------------------------------------------------------------
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//------------------------------------------------------------------------------
// To get up to date fundamental definition files for your hedgefund contact sales@quantconnect.com
using System;
using System.IO;
using System.Linq;
using Python.Runtime;
using Newtonsoft.Json;
using System.Collections.Generic;
using QuantConnect.Data.UniverseSelection;
namespace QuantConnect.Data.Fundamental
{
/// <summary>
/// Definition of the AssetClassification class
/// </summary>
public class AssetClassification
{
/// <summary>
/// The purpose of the Stock Types is to group companies according to the underlying fundamentals of their business. They answer the
/// question: If I buy this stock, what kind of company am I buying? Unlike the style box, the emphasis with the Stock Types is on
/// income statement, balance sheet, and cash-flow data-not price data or valuation multiples. We focus on the company, not the
/// stock. Morningstar calculates this figure in-house on a monthly basis.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3000
/// </remarks>
[JsonProperty("3000")]
public int StockType { get; set; }
/// <summary>
/// Definition of the AssetClassification class
/// </summary>
public class AssetClassification : ReusuableCLRObject
{
/// <summary>
/// The purpose of the Stock Types is to group companies according to the underlying fundamentals of their business. They answer the question: If I buy this stock, what kind of company am I buying? Unlike the style box, the emphasis with the Stock Types is on income statement, balance sheet, and cash-flow data-not price data or valuation multiples. We focus on the company, not the stock. Morningstar calculates this figure in-house on a monthly basis.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3000
/// </remarks>
[JsonProperty("3000")]
public int StockType => FundamentalService.Get<int>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_StockType);
/// <summary>
/// The Morningstar Equity Style Box is a grid that provides a graphical representation of the investment style of stocks and portfolios.
/// It classifies securities according to market capitalization (the vertical axis) and value-growth scores (the horizontal axis) and allows
/// us to provide analysis on a 5-by-5 Style Box as well as providing the traditional style box assignment, which is the basis for the
/// Morningstar Category. Two of the style categories, value and growth, are common to both stocks and portfolios. However, for
/// stocks, the central column of the style box represents the core style (those stocks for which neither value nor growth
/// characteristics dominate); for portfolios, it represents the blend style.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3001
/// </remarks>
[JsonProperty("3001")]
public int StyleBox { get; set; }
/// <summary>
/// The Morningstar Equity Style Box is a grid that provides a graphical representation of the investment style of stocks and portfolios. It classifies securities according to market capitalization (the vertical axis) and value-growth scores (the horizontal axis) and allows us to provide analysis on a 5-by-5 Style Box as well as providing the traditional style box assignment, which is the basis for the Morningstar Category. Two of the style categories, value and growth, are common to both stocks and portfolios. However, for stocks, the central column of the style box represents the core style (those stocks for which neither value nor growth characteristics dominate); for portfolios, it represents the blend style.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3001
/// </remarks>
[JsonProperty("3001")]
public int StyleBox => FundamentalService.Get<int>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_StyleBox);
/// <summary>
/// The growth grade is based on the trend in revenue per share using data from the past five years. For the purpose of calculating
/// revenue per share we use the past five years' revenue figures and corresponding year-end fully diluted shares outstanding; if year-
/// end fully diluted shares outstanding is not available, we calculate this figure by dividing the company's reported net income
/// applicable to common shareholders by the reported fully diluted earnings per share. A company must have a minimum of four
/// consecutive years of positive and non-zero revenue, including the latest fiscal year, to qualify for a grade.
/// In calculating the revenue per share growth rate, we calculate the slope of the regression line of historical revenue per share. We
/// then divide the slope of the regression line by the arithmetic average of historical revenue per share figures. The result of the
/// regression is a normalized historical increase or decrease in the rate of growth for sales per share. We then calculate a z-score by
/// subtracting the universe mean revenue growth from the company's revenue growth, and dividing by the standard deviation of the
/// universe's growth rates.
/// Stocks are sorted based on the z-score of their revenue per share growth rate calculated above, from the most negative z-score to
/// the most positive z-score. Stocks are then ranked based on their z-score from 1 to the total number of qualified stocks. We assign
/// grades based on this ranking. Stocks are assigned A, B, C, D, or F. Morningstar calculates this figure in-house on a monthly basis.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3002
/// </remarks>
[JsonProperty("3002")]
public string GrowthGrade { get; set; }
/// <summary>
/// The growth grade is based on the trend in revenue per share using data from the past five years. For the purpose of calculating revenue per share we use the past five years' revenue figures and corresponding year-end fully diluted shares outstanding; if year- end fully diluted shares outstanding is not available, we calculate this figure by dividing the company's reported net income applicable to common shareholders by the reported fully diluted earnings per share. A company must have a minimum of four consecutive years of positive and non-zero revenue, including the latest fiscal year, to qualify for a grade. In calculating the revenue per share growth rate, we calculate the slope of the regression line of historical revenue per share. We then divide the slope of the regression line by the arithmetic average of historical revenue per share figures. The result of the regression is a normalized historical increase or decrease in the rate of growth for sales per share. We then calculate a z-score by subtracting the universe mean revenue growth from the company's revenue growth, and dividing by the standard deviation of the universe's growth rates. Stocks are sorted based on the z-score of their revenue per share growth rate calculated above, from the most negative z-score to the most positive z-score. Stocks are then ranked based on their z-score from 1 to the total number of qualified stocks. We assign grades based on this ranking. Stocks are assigned A, B, C, D, or F. Morningstar calculates this figure in-house on a monthly basis.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3002
/// </remarks>
[JsonProperty("3002")]
public string GrowthGrade => FundamentalService.Get<string>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_GrowthGrade);
/// <summary>
/// Instead of using accounting-based ratios to formulate a measure to reflect the financial health of a firm, we use structural or
/// contingent claim models. Structural models take advantage of both market information and accounting financial information. The
/// firm's equity in such models is viewed as a call option on the value of the firm's assets. If the value of the assets is not sufficient to
/// cover the firm's liabilities (the strike price), default is expected to occur, and the call option expires worthless and the firm is turned
/// over to its creditors. To estimate a distance to default, the value of the firm's liabilities is obtained from the firm's latest balance
/// sheet and incorporated into the model. We then rank the calculated distance to default and award 10% of the universe A's, 20%
/// B's, 40% C's, 20% D's, and 10% F's. Morningstar calculates this figure in-house on a daily basis.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3003
/// </remarks>
[JsonProperty("3003")]
public string FinancialHealthGrade { get; set; }
/// <summary>
/// Instead of using accounting-based ratios to formulate a measure to reflect the financial health of a firm, we use structural or contingent claim models. Structural models take advantage of both market information and accounting financial information. The firm's equity in such models is viewed as a call option on the value of the firm's assets. If the value of the assets is not sufficient to cover the firm's liabilities (the strike price), default is expected to occur, and the call option expires worthless and the firm is turned over to its creditors. To estimate a distance to default, the value of the firm's liabilities is obtained from the firm's latest balance sheet and incorporated into the model. We then rank the calculated distance to default and award 10% of the universe A's, 20% B's, 40% C's, 20% D's, and 10% F's. Morningstar calculates this figure in-house on a daily basis.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3003
/// </remarks>
[JsonProperty("3003")]
public string FinancialHealthGrade => FundamentalService.Get<string>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_FinancialHealthGrade);
/// <summary>
/// The profitability grade for all qualified companies in Morningstar's stock universe is based on valuation of return on shareholders'
/// equity (ROE) using data from the past five years. Morningstar's universe of stocks is first filtered for adequacy of historical ROE
/// figures. Companies with less than four years of consecutive ROE figures including the ROE figure for the latest fiscal year are tossed
/// from calculations and are assigned "--" for the profitability grade. For the remaining qualified universe of stocks the profitability
/// grade is based on the valuation of the following three components, which are assigned different weights; the historical growth rate
/// of ROE, the average level of historical ROE, the level of ROE in the latest fiscal year of the company.
/// Stocks are assigned A, B, C, D, or F. Morningstar calculates this figure in-house on a monthly basis.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3004
/// </remarks>
[JsonProperty("3004")]
public string ProfitabilityGrade { get; set; }
/// <summary>
/// The profitability grade for all qualified companies in Morningstar's stock universe is based on valuation of return on shareholders' equity (ROE) using data from the past five years. Morningstar's universe of stocks is first filtered for adequacy of historical ROE figures. Companies with less than four years of consecutive ROE figures including the ROE figure for the latest fiscal year are tossed from calculations and are assigned "--" for the profitability grade. For the remaining qualified universe of stocks the profitability grade is based on the valuation of the following three components, which are assigned different weights; the historical growth rate of ROE, the average level of historical ROE, the level of ROE in the latest fiscal year of the company. Stocks are assigned A, B, C, D, or F. Morningstar calculates this figure in-house on a monthly basis.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3004
/// </remarks>
[JsonProperty("3004")]
public string ProfitabilityGrade => FundamentalService.Get<string>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_ProfitabilityGrade);
/// <summary>
/// Equities are mapped into one of 148 industries, the one which most accurately reflects the underlying business of that company.
/// This mapping is based on publicly available information about each company and uses annual reports, Form
/// 10-Ks and Morningstar Equity Analyst input as its primary source. Other secondary sources of information may include company
/// web sites, sell-side research (if available) and trade publications. By and large, equities are mapped into the industries that best
/// reflect each company's largest source of revenue and income. If the company has more than three sources of revenue and income
/// and there is no clear dominant revenue and income stream, the company is assigned to the Conglomerates industry. Based on
/// Morningstar analyst research or other third party information, Morningstar may change industry assignments to more accurately
/// reflect the changing businesses of companies.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3005
/// </remarks>
[JsonProperty("3005")]
public int MorningstarIndustryCode { get; set; }
/// <summary>
/// Equities are mapped into one of 148 industries, the one which most accurately reflects the underlying business of that company. This mapping is based on publicly available information about each company and uses annual reports, Form 10-Ks and Morningstar Equity Analyst input as its primary source. Other secondary sources of information may include company web sites, sell-side research (if available) and trade publications. By and large, equities are mapped into the industries that best reflect each company's largest source of revenue and income. If the company has more than three sources of revenue and income and there is no clear dominant revenue and income stream, the company is assigned to the Conglomerates industry. Based on Morningstar analyst research or other third party information, Morningstar may change industry assignments to more accurately reflect the changing businesses of companies.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3005
/// </remarks>
[JsonProperty("3005")]
public int MorningstarIndustryCode => FundamentalService.Get<int>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_MorningstarIndustryCode);
/// <summary>
/// Industries are mapped into 69 industry groups based on their common operational characteristics. If a particular industry has unique
/// operating characteristics-or simply lacks commonality with other industries-it would map into its own group. However, any
/// industry group containing just one single industry does not necessarily imply that that industry is dominant or otherwise important.
/// The assignment simply reflects the lack of a sufficient amount of shared traits among industries. See appendix for mappings.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3006
/// </remarks>
[JsonProperty("3006")]
public int MorningstarIndustryGroupCode { get; set; }
/// <summary>
/// Industries are mapped into 69 industry groups based on their common operational characteristics. If a particular industry has unique operating characteristics-or simply lacks commonality with other industries-it would map into its own group. However, any industry group containing just one single industry does not necessarily imply that that industry is dominant or otherwise important. The assignment simply reflects the lack of a sufficient amount of shared traits among industries. See appendix for mappings.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3006
/// </remarks>
[JsonProperty("3006")]
public int MorningstarIndustryGroupCode => FundamentalService.Get<int>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_MorningstarIndustryGroupCode);
/// <summary>
/// Industry groups are consolidated into 11 sectors. See appendix for mappings.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3007
/// </remarks>
[JsonProperty("3007")]
public int MorningstarSectorCode { get; set; }
/// <summary>
/// Industry groups are consolidated into 11 sectors. See appendix for mappings.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3007
/// </remarks>
[JsonProperty("3007")]
public int MorningstarSectorCode => FundamentalService.Get<int>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_MorningstarSectorCode);
/// <summary>
/// Sectors are consolidated into three major economic spheres or Super Sectors: Cyclical, Defensive and Sensitive. See appendix for
/// mappings.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3008
/// </remarks>
[JsonProperty("3008")]
public int MorningstarEconomySphereCode { get; set; }
/// <summary>
/// Sectors are consolidated into three major economic spheres or Super Sectors: Cyclical, Defensive and Sensitive. See appendix for mappings.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3008
/// </remarks>
[JsonProperty("3008")]
public int MorningstarEconomySphereCode => FundamentalService.Get<int>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_MorningstarEconomySphereCode);
/// <summary>
/// Standard Industrial Classification System (SIC) is a system for classifying a business according to economic activity. See separate
/// reference document for a list of Sic Codes/Mappings.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3009
/// </remarks>
[JsonProperty("3009")]
public int SIC { get; set; }
/// <summary>
/// Standard Industrial Classification System (SIC) is a system for classifying a business according to economic activity. See separate reference document for a list of Sic Codes/Mappings.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3009
/// </remarks>
[JsonProperty("3009")]
public int SIC => FundamentalService.Get<int>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_SIC);
/// <summary>
/// An acronym for North American Industry Classification System, it is a 6 digit numerical classification assigned to individual
/// companies. Developed jointly by the U.S., Canada, and Mexico to provide new comparability in statistics about business activity
/// across North America. It is intended to replace the U.S. Standard Industrial Classification (SIC) system. See separate reference
/// document for a list of NAICS Codes/Mappings.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3010
/// </remarks>
[JsonProperty("3010")]
public int NAICS { get; set; }
/// <summary>
/// An acronym for North American Industry Classification System, it is a 6 digit numerical classification assigned to individual companies. Developed jointly by the U.S., Canada, and Mexico to provide new comparability in statistics about business activity across North America. It is intended to replace the U.S. Standard Industrial Classification (SIC) system. See separate reference document for a list of NAICS Codes/Mappings.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3010
/// </remarks>
[JsonProperty("3010")]
public int NAICS => FundamentalService.Get<int>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_NAICS);
/// <summary>
/// The scores for a stock's value and growth characteristics determine its horizontal placement. The Value-Growth Score is a
/// reflection of the aggregate expectations of market participants for the future growth and required rate of return for a stock. We
/// infer these expectations from the relation between current market prices and future growth and cost of capital expectations under
/// the assumption of rational market participants and a simple model of stock value.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3011
/// </remarks>
[JsonProperty("3011")]
public decimal StyleScore { get; set; }
/// <summary>
/// The scores for a stock's value and growth characteristics determine its horizontal placement. The Value-Growth Score is a reflection of the aggregate expectations of market participants for the future growth and required rate of return for a stock. We infer these expectations from the relation between current market prices and future growth and cost of capital expectations under the assumption of rational market participants and a simple model of stock value.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3011
/// </remarks>
[JsonProperty("3011")]
public double StyleScore => FundamentalService.Get<double>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_StyleScore);
/// <summary>
/// Rather than a fixed number of large cap or small cap stocks, Morningstar uses a flexible system that isn't adversely affected by
/// overall movements in the market. The Morningstar stock universe represents approximately 99% of the U.S. market for actively
/// traded stocks. Giant-cap stocks are defined as the group that accounts for the top 40% of the capitalization of the Morningstar
/// domestic stock universe; large-cap stocks represent the next 30%; mid-cap stocks represent the next 20%; small-cap stocks
/// represent the next 7%; and micro-cap stocks represent the remaining 3%. Each stock is given a Size Score that ranges from -100
/// (very micro) to 400 (very giant). When classifying stocks to a Style Box, giant is included in large and micro is included in small.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3012
/// </remarks>
[JsonProperty("3012")]
public decimal SizeScore { get; set; }
/// <summary>
/// Rather than a fixed number of large cap or small cap stocks, Morningstar uses a flexible system that isn't adversely affected by overall movements in the market. The Morningstar stock universe represents approximately 99% of the U.S. market for actively traded stocks. Giant-cap stocks are defined as the group that accounts for the top 40% of the capitalization of the Morningstar domestic stock universe; large-cap stocks represent the next 30%; mid-cap stocks represent the next 20%; small-cap stocks represent the next 7%; and micro-cap stocks represent the remaining 3%. Each stock is given a Size Score that ranges from -100 (very micro) to 400 (very giant). When classifying stocks to a Style Box, giant is included in large and micro is included in small.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3012
/// </remarks>
[JsonProperty("3012")]
public double SizeScore => FundamentalService.Get<double>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_SizeScore);
/// <summary>
/// A high overall growth score indicates that a stock's per-share earnings, book value, revenues, and cash flow are expected to grow
/// quickly relative to other stocks in the same scoring group. A weak growth orientation does not necessarily mean that a stock has a
/// strong value orientation.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3013
/// </remarks>
[JsonProperty("3013")]
public decimal GrowthScore { get; set; }
/// <summary>
/// A high overall growth score indicates that a stock's per-share earnings, book value, revenues, and cash flow are expected to grow quickly relative to other stocks in the same scoring group. A weak growth orientation does not necessarily mean that a stock has a strong value orientation.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3013
/// </remarks>
[JsonProperty("3013")]
public double GrowthScore => FundamentalService.Get<double>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_GrowthScore);
/// <summary>
/// A high value score indicates that a stock's price is relatively low, given the anticipated per-sharing earnings, book value, revenues,
/// cash flow, and dividends that the stock provides to investors. A high price relative to these measures indicates that a stock's value
/// orientation is weak, but it does not necessarily mean that the stock is growth-oriented.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3014
/// </remarks>
[JsonProperty("3014")]
public decimal ValueScore { get; set; }
/// <summary>
/// A high value score indicates that a stock's price is relatively low, given the anticipated per-sharing earnings, book value, revenues, cash flow, and dividends that the stock provides to investors. A high price relative to these measures indicates that a stock's value orientation is weak, but it does not necessarily mean that the stock is growth-oriented.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3014
/// </remarks>
[JsonProperty("3014")]
public double ValueScore => FundamentalService.Get<double>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_ValueScore);
/// <summary>
/// NACE is a European standard classification of economic activities maintained by Eurostat.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3015
/// </remarks>
[JsonProperty("3015")]
public decimal NACE { get; set; }
/// <summary>
/// NACE is a European standard classification of economic activities maintained by Eurostat.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3015
/// </remarks>
[JsonProperty("3015")]
public double NACE => FundamentalService.Get<double>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_NACE);
/// <summary>
/// Similar to NAICS (data point 3010, above), this is specifically for Canadian classifications.
/// An acronym for North American Industry Classification System, it is a 6 digit numerical classification assigned to individual
/// companies. Developed jointly by the U.S., Canada, and Mexico to provide new comparability in statistics about business activity
/// across North America. It is intended to replace the U.S. Standard Industrial Classification (SIC) system. See separate reference
/// document for a list of NAICS Codes/Mappings.
/// The initial SIC and NAICS listed is the Primary based on revenue generation; followed by Secondary SIC and NAICS when
/// applicable. Both SIC and NAICS are manually collected and assigned.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3016
/// </remarks>
[JsonProperty("3016")]
public int CANNAICS { get; set; }
/// <summary>
/// Similar to NAICS (data point 3010, above), this is specifically for Canadian classifications. An acronym for North American Industry Classification System, it is a 6 digit numerical classification assigned to individual companies. Developed jointly by the U.S., Canada, and Mexico to provide new comparability in statistics about business activity across North America. It is intended to replace the U.S. Standard Industrial Classification (SIC) system. See separate reference document for a list of NAICS Codes/Mappings. The initial SIC and NAICS listed is the Primary based on revenue generation; followed by Secondary SIC and NAICS when applicable. Both SIC and NAICS are manually collected and assigned.
/// </summary>
/// <remarks>
/// Morningstar DataId: 3016
/// </remarks>
[JsonProperty("3016")]
public int CANNAICS => FundamentalService.Get<int>(_timeProvider.GetUtcNow(), _securityIdentifier, FundamentalProperty.AssetClassification_CANNAICS);
/// <summary>
/// Creates an instance of the AssetClassification class
/// </summary>
public AssetClassification()
{
}
private readonly ITimeProvider _timeProvider;
private readonly SecurityIdentifier _securityIdentifier;
/// <summary>
/// Applies updated values from <paramref name="update"/> to this instance
/// </summary>
/// <remarks>Used to apply data updates to the current instance. This WILL overwrite existing values. Default update values are ignored.</remarks>
/// <param name="update">The next data update for this instance</param>
public void UpdateValues(AssetClassification update)
{
if (update == null) return;
if (update.StockType != default(int)) StockType = update.StockType;
if (update.StyleBox != default(int)) StyleBox = update.StyleBox;
if (!string.IsNullOrWhiteSpace(update.GrowthGrade)) GrowthGrade = update.GrowthGrade;
if (!string.IsNullOrWhiteSpace(update.FinancialHealthGrade)) FinancialHealthGrade = update.FinancialHealthGrade;
if (!string.IsNullOrWhiteSpace(update.ProfitabilityGrade)) ProfitabilityGrade = update.ProfitabilityGrade;
if (update.MorningstarIndustryCode != default(int)) MorningstarIndustryCode = update.MorningstarIndustryCode;
if (update.MorningstarIndustryGroupCode != default(int)) MorningstarIndustryGroupCode = update.MorningstarIndustryGroupCode;
if (update.MorningstarSectorCode != default(int)) MorningstarSectorCode = update.MorningstarSectorCode;
if (update.MorningstarEconomySphereCode != default(int)) MorningstarEconomySphereCode = update.MorningstarEconomySphereCode;
if (update.SIC != default(int)) SIC = update.SIC;
if (update.NAICS != default(int)) NAICS = update.NAICS;
if (update.StyleScore != default(decimal)) StyleScore = update.StyleScore;
if (update.SizeScore != default(decimal)) SizeScore = update.SizeScore;
if (update.GrowthScore != default(decimal)) GrowthScore = update.GrowthScore;
if (update.ValueScore != default(decimal)) ValueScore = update.ValueScore;
if (update.NACE != default(decimal)) NACE = update.NACE;
if (update.CANNAICS != default(int)) CANNAICS = update.CANNAICS;
}
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AssetClassification(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier)
{
_timeProvider = timeProvider;
_securityIdentifier = securityIdentifier;
}
}
}

View File

@@ -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>
/// The charge against earnings resulting from the aggregate write down of all assets from their carrying value to their fair value.
/// </summary>
public class AssetImpairmentChargeCashFlowStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AssetImpairmentCharge_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AssetImpairmentCharge_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AssetImpairmentCharge_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AssetImpairmentCharge_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AssetImpairmentCharge_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AssetImpairmentCharge_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AssetImpairmentCharge_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_AssetImpairmentCharge_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_CashFlowStatement_AssetImpairmentCharge_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AssetImpairmentChargeCashFlowStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AssetImpairmentChargeCashFlowStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// This item is typically available for bank industry. It's a part of long-lived assets, which has been decided for sale in the future.
/// </summary>
public class AssetsHeldForSaleBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsHeldForSale_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsHeldForSale_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsHeldForSale_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsHeldForSale_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AssetsHeldForSale_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AssetsHeldForSaleBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AssetsHeldForSaleBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// Short term assets set apart for sale to liquidate in the future and are measured at the lower of carrying amount and fair value less costs to sell.
/// </summary>
public class AssetsHeldForSaleCurrentBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsHeldForSaleCurrent_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsHeldForSaleCurrent_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsHeldForSaleCurrent_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsHeldForSaleCurrent_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AssetsHeldForSaleCurrent_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AssetsHeldForSaleCurrentBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AssetsHeldForSaleCurrentBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// Long term assets set apart for sale to liquidate in the future and are measured at the lower of carrying amount and fair value less costs to sell.
/// </summary>
public class AssetsHeldForSaleNonCurrentBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsHeldForSaleNonCurrent_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsHeldForSaleNonCurrent_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsHeldForSaleNonCurrent_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsHeldForSaleNonCurrent_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AssetsHeldForSaleNonCurrent_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AssetsHeldForSaleNonCurrentBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AssetsHeldForSaleNonCurrentBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// A portion of a company's business that has been disposed of or sold.
/// </summary>
public class AssetsOfDiscontinuedOperationsBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsOfDiscontinuedOperations_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsOfDiscontinuedOperations_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsOfDiscontinuedOperations_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsOfDiscontinuedOperations_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AssetsOfDiscontinuedOperations_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AssetsOfDiscontinuedOperationsBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AssetsOfDiscontinuedOperationsBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// Total value collateral assets pledged to the bank that can be sold or used as collateral for other loans.
/// </summary>
public class AssetsPledgedasCollateralSubjecttoSaleorRepledgingTotalBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsPledgedasCollateralSubjecttoSaleorRepledgingTotal_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsPledgedasCollateralSubjecttoSaleorRepledgingTotal_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsPledgedasCollateralSubjecttoSaleorRepledgingTotal_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AssetsPledgedasCollateralSubjecttoSaleorRepledgingTotal_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AssetsPledgedasCollateralSubjecttoSaleorRepledgingTotal_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AssetsPledgedasCollateralSubjecttoSaleorRepledgingTotalBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AssetsPledgedasCollateralSubjecttoSaleorRepledgingTotalBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,113 @@
/*
* 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>
/// Revenue / Average Total Assets
/// </summary>
public class AssetsTurnover : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "OneYear";
/// <summary>
/// Gets/sets the OneYear period value for the field
/// </summary>
[JsonProperty("1Y")]
public double OneYear => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_AssetsTurnover_OneYear);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_AssetsTurnover_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_AssetsTurnover_SixMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_AssetsTurnover_OneYear));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_AssetsTurnover_OneYear);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1Y",OneYear), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"OperationRatios_AssetsTurnover_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AssetsTurnover()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AssetsTurnover(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,119 @@
/*
* 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>
/// For an unclassified balance sheet, this item represents equity securities categorized neither as held-to-maturity nor trading. Equity securities represent ownership interests or the right to acquire ownership interests in corporations and other legal entities which ownership interest is represented by shares of common or preferred stock (which is not mandatory redeemable or redeemable at the option of the holder), convertible securities, stock rights, or stock warrants. This category includes preferred stocks, available- for-sale and common stock, available-for-sale.
/// </summary>
public class AvailableForSaleSecuritiesBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AvailableForSaleSecurities_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AvailableForSaleSecurities_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AvailableForSaleSecurities_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AvailableForSaleSecurities_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AvailableForSaleSecurities_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_AvailableForSaleSecurities_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_AvailableForSaleSecurities_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AvailableForSaleSecuritiesBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AvailableForSaleSecuritiesBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,119 @@
/*
* 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>
/// Adjustments to reported net income to calculate Diluted EPS, by assuming that all convertible instruments are converted to Common Equity. The adjustments usually include the interest expense of debentures when assumed converted and preferred dividends of convertible preferred stock when assumed converted.
/// </summary>
public class AverageDilutionEarningsIncomeStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AverageDilutionEarnings_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AverageDilutionEarnings_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AverageDilutionEarnings_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AverageDilutionEarnings_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AverageDilutionEarnings_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_IncomeStatement_AverageDilutionEarnings_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_IncomeStatement_AverageDilutionEarnings_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public AverageDilutionEarningsIncomeStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public AverageDilutionEarningsIncomeStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// All indebtedness for borrowed money or the deferred purchase price of property or services, including without limitation reimbursement and other obligations with respect to surety bonds and letters of credit, all obligations evidenced by notes, bonds debentures or similar instruments, all capital lease obligations and all contingent obligations.
/// </summary>
public class BankIndebtednessBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankIndebtedness_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankIndebtedness_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankIndebtedness_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankIndebtedness_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_BankIndebtedness_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BankIndebtednessBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BankIndebtednessBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// A debt financing obligation issued by a bank or similar financial institution to a company, that entitles the lender or holder of the instrument to interest payments and the repayment of principal at a specified time within the next 12 months or operating cycle.
/// </summary>
public class BankLoansCurrentBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankLoansCurrent_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankLoansCurrent_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankLoansCurrent_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankLoansCurrent_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_BankLoansCurrent_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BankLoansCurrentBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BankLoansCurrentBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// A debt financing obligation issued by a bank or similar financial institution to a company, that entitles the lender or holder of the instrument to interest payments and the repayment of principal at a specified time beyond the current accounting PeriodAsByte.
/// </summary>
public class BankLoansNonCurrentBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankLoansNonCurrent_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankLoansNonCurrent_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankLoansNonCurrent_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankLoansNonCurrent_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_BankLoansNonCurrent_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BankLoansNonCurrentBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BankLoansNonCurrentBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// Total debt financing obligation issued by a bank or similar financial institution to a company that entitles the lender or holder of the instrument to interest payments and the repayment of principal at a specified time; in a Non-Differentiated Balance Sheet.
/// </summary>
public class BankLoansTotalBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankLoansTotal_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankLoansTotal_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankLoansTotal_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankLoansTotal_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_BankLoansTotal_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BankLoansTotalBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BankLoansTotalBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,119 @@
/*
* 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>
/// The carrying amount of a life insurance policy on an officer, executive or employee for which the reporting entity (a bank) is entitled to proceeds from the policy upon death of the insured or surrender of the insurance policy.
/// </summary>
public class BankOwnedLifeInsuranceBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankOwnedLifeInsurance_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankOwnedLifeInsurance_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankOwnedLifeInsurance_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankOwnedLifeInsurance_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankOwnedLifeInsurance_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BankOwnedLifeInsurance_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_BankOwnedLifeInsurance_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BankOwnedLifeInsuranceBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BankOwnedLifeInsuranceBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,119 @@
/*
* 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>
/// Basic EPS from the Cumulative Effect of Accounting Change is the earnings attributable to the accounting change (during the reporting period) divided by the weighted average number of common shares outstanding.
/// </summary>
public class BasicAccountingChange : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAccountingChange_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAccountingChange_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAccountingChange_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAccountingChange_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAccountingChange_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAccountingChange_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"EarningReports_BasicAccountingChange_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BasicAccountingChange()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BasicAccountingChange(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// The shares outstanding used to calculate Basic EPS, which is the weighted average common share outstanding through the whole accounting PeriodAsByte. Note: If Basic Average Shares are not presented by the firm in the Income Statement, this data point will be null.
/// </summary>
public class BasicAverageShares : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAverageShares_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAverageShares_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAverageShares_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAverageShares_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAverageShares_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAverageShares_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAverageShares_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicAverageShares_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"EarningReports_BasicAverageShares_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BasicAverageShares()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BasicAverageShares(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Basic EPS from Continuing Operations is the earnings from continuing operations reported by the company divided by the weighted average number of common shares outstanding.
/// </summary>
public class BasicContinuousOperations : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicContinuousOperations_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicContinuousOperations_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicContinuousOperations_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicContinuousOperations_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicContinuousOperations_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicContinuousOperations_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicContinuousOperations_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicContinuousOperations_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"EarningReports_BasicContinuousOperations_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BasicContinuousOperations()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BasicContinuousOperations(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Basic EPS from Discontinued Operations is the earnings from discontinued operations reported by the company divided by the weighted average number of common shares outstanding. This only includes gain or loss from discontinued operations.
/// </summary>
public class BasicDiscontinuousOperations : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicDiscontinuousOperations_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicDiscontinuousOperations_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicDiscontinuousOperations_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicDiscontinuousOperations_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicDiscontinuousOperations_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicDiscontinuousOperations_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicDiscontinuousOperations_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicDiscontinuousOperations_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"EarningReports_BasicDiscontinuousOperations_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BasicDiscontinuousOperations()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BasicDiscontinuousOperations(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Basic EPS is the bottom line net income divided by the weighted average number of common shares outstanding.
/// </summary>
public class BasicEPS : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPS_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPS_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPS_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPS_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPS_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPS_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPS_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPS_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"EarningReports_BasicEPS_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BasicEPS()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BasicEPS(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,119 @@
/*
* 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>
/// Basic EPS from the Other Gains/Losses is the earnings attributable to the other gains/losses (during the reporting period) divided by the weighted average number of common shares outstanding.
/// </summary>
public class BasicEPSOtherGainsLosses : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPSOtherGainsLosses_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPSOtherGainsLosses_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPSOtherGainsLosses_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPSOtherGainsLosses_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPSOtherGainsLosses_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicEPSOtherGainsLosses_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"EarningReports_BasicEPSOtherGainsLosses_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BasicEPSOtherGainsLosses()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BasicEPSOtherGainsLosses(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Basic EPS from the Extraordinary Gains/Losses is the earnings attributable to the gains or losses (during the reporting period) from extraordinary items divided by the weighted average number of common shares outstanding.
/// </summary>
public class BasicExtraordinary : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicExtraordinary_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicExtraordinary_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicExtraordinary_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicExtraordinary_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicExtraordinary_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicExtraordinary_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicExtraordinary_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningReports_BasicExtraordinary_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"EarningReports_BasicExtraordinary_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BasicExtraordinary()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BasicExtraordinary(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// The cash and equivalents balance at the beginning of the accounting period, as indicated on the Cash Flow statement.
/// </summary>
public class BeginningCashPositionCashFlowStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_BeginningCashPosition_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_BeginningCashPosition_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_BeginningCashPosition_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_BeginningCashPosition_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_BeginningCashPosition_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_BeginningCashPosition_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_BeginningCashPosition_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_BeginningCashPosition_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_CashFlowStatement_BeginningCashPosition_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BeginningCashPositionCashFlowStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BeginningCashPositionCashFlowStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* 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>
/// Biological assets include plants and animals.
/// </summary>
public class BiologicalAssetsBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BiologicalAssets_ThreeMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BiologicalAssets_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BiologicalAssets_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BiologicalAssets_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_BiologicalAssets_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BiologicalAssetsBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BiologicalAssetsBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,119 @@
/*
* 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>
/// The growth in the company's book value per share on a percentage basis. Morningstar calculates the growth percentage based on the common shareholder's equity reported in the Balance Sheet divided by the diluted shares outstanding within the company filings or reports.
/// </summary>
public class BookValuePerShareGrowth : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "OneYear";
/// <summary>
/// Gets/sets the OneYear period value for the field
/// </summary>
[JsonProperty("1Y")]
public double OneYear => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningRatios_BookValuePerShareGrowth_OneYear);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningRatios_BookValuePerShareGrowth_ThreeMonths);
/// <summary>
/// Gets/sets the ThreeYears period value for the field
/// </summary>
[JsonProperty("3Y")]
public double ThreeYears => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningRatios_BookValuePerShareGrowth_ThreeYears);
/// <summary>
/// Gets/sets the FiveYears period value for the field
/// </summary>
[JsonProperty("5Y")]
public double FiveYears => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningRatios_BookValuePerShareGrowth_FiveYears);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningRatios_BookValuePerShareGrowth_OneYear));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.EarningRatios_BookValuePerShareGrowth_OneYear);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1Y",OneYear), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("3Y",ThreeYears), new Tuple<string, double>("5Y",FiveYears) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"EarningRatios_BookValuePerShareGrowth_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BookValuePerShareGrowth()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BookValuePerShareGrowth(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Fixed assets that specifically deal with the facilities a company owns. Include the improvements associated with buildings.
/// </summary>
public class BuildingsAndImprovementsBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BuildingsAndImprovements_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BuildingsAndImprovements_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BuildingsAndImprovements_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BuildingsAndImprovements_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BuildingsAndImprovements_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BuildingsAndImprovements_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BuildingsAndImprovements_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_BuildingsAndImprovements_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_BuildingsAndImprovements_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public BuildingsAndImprovementsBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public BuildingsAndImprovementsBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,113 @@
/*
* 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>
/// The growth in the company's cash flow from operations on a percentage basis. Morningstar calculates the growth percentage based on the underlying cash flow from operations data reported in the Cash Flow Statement within the company filings or reports.
/// </summary>
public class CFOGrowth : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "OneYear";
/// <summary>
/// Gets/sets the OneYear period value for the field
/// </summary>
[JsonProperty("1Y")]
public double OneYear => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CFOGrowth_OneYear);
/// <summary>
/// Gets/sets the ThreeYears period value for the field
/// </summary>
[JsonProperty("3Y")]
public double ThreeYears => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CFOGrowth_ThreeYears);
/// <summary>
/// Gets/sets the FiveYears period value for the field
/// </summary>
[JsonProperty("5Y")]
public double FiveYears => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CFOGrowth_FiveYears);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CFOGrowth_OneYear));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CFOGrowth_OneYear);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1Y",OneYear), new Tuple<string, double>("3Y",ThreeYears), new Tuple<string, double>("5Y",FiveYears) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"OperationRatios_CFOGrowth_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CFOGrowth()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CFOGrowth(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,113 @@
/*
* 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>
/// The growth in the company's capital expenditures on a percentage basis. Morningstar calculates the growth percentage based on the capital expenditures reported in the Cash Flow Statement within the company filings or reports.
/// </summary>
public class CapExGrowth : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "OneYear";
/// <summary>
/// Gets/sets the OneYear period value for the field
/// </summary>
[JsonProperty("1Y")]
public double OneYear => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapExGrowth_OneYear);
/// <summary>
/// Gets/sets the ThreeYears period value for the field
/// </summary>
[JsonProperty("3Y")]
public double ThreeYears => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapExGrowth_ThreeYears);
/// <summary>
/// Gets/sets the FiveYears period value for the field
/// </summary>
[JsonProperty("5Y")]
public double FiveYears => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapExGrowth_FiveYears);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapExGrowth_OneYear));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapExGrowth_OneYear);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1Y",OneYear), new Tuple<string, double>("3Y",ThreeYears), new Tuple<string, double>("5Y",FiveYears) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"OperationRatios_CapExGrowth_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CapExGrowth()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CapExGrowth(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Capital expenditure, capitalized software development cost, maintenance capital expenditure, etc. as reported by the company.
/// </summary>
public class CapExReportedCashFlowStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapExReported_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapExReported_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapExReported_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapExReported_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapExReported_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapExReported_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapExReported_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapExReported_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_CashFlowStatement_CapExReported_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CapExReportedCashFlowStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CapExReportedCashFlowStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,101 @@
/*
* 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>
/// Capital Expenditure / Revenue
/// </summary>
public class CapExSalesRatio : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "OneYear";
/// <summary>
/// Gets/sets the OneYear period value for the field
/// </summary>
[JsonProperty("1Y")]
public double OneYear => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapExSalesRatio_OneYear);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapExSalesRatio_OneYear));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapExSalesRatio_OneYear);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1Y",OneYear) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"OperationRatios_CapExSalesRatio_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CapExSalesRatio()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CapExSalesRatio(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,113 @@
/*
* 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>
/// This is the compound annual growth rate of the company's capital spending over the last 5 years. Capital Spending is the sum of the Capital Expenditure items found in the Statement of Cash Flows.
/// </summary>
public class CapitalExpenditureAnnual5YrGrowth : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "OneYear";
/// <summary>
/// Gets/sets the OneYear period value for the field
/// </summary>
[JsonProperty("1Y")]
public double OneYear => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapitalExpenditureAnnual5YrGrowth_OneYear);
/// <summary>
/// Gets/sets the ThreeYears period value for the field
/// </summary>
[JsonProperty("3Y")]
public double ThreeYears => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapitalExpenditureAnnual5YrGrowth_ThreeYears);
/// <summary>
/// Gets/sets the FiveYears period value for the field
/// </summary>
[JsonProperty("5Y")]
public double FiveYears => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapitalExpenditureAnnual5YrGrowth_FiveYears);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapitalExpenditureAnnual5YrGrowth_OneYear));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapitalExpenditureAnnual5YrGrowth_OneYear);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1Y",OneYear), new Tuple<string, double>("3Y",ThreeYears), new Tuple<string, double>("5Y",FiveYears) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"OperationRatios_CapitalExpenditureAnnual5YrGrowth_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CapitalExpenditureAnnual5YrGrowth()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CapitalExpenditureAnnual5YrGrowth(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Funds used by a company to acquire or upgrade physical assets such as property, industrial buildings or equipment. This type of outlay is made by companies to maintain or increase the scope of their operations. Capital expenditures are generally depreciated or depleted over their useful life, as distinguished from repairs, which are subtracted from the income of the current year.
/// </summary>
public class CapitalExpenditureCashFlowStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapitalExpenditure_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapitalExpenditure_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapitalExpenditure_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapitalExpenditure_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapitalExpenditure_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapitalExpenditure_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapitalExpenditure_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CapitalExpenditure_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_CashFlowStatement_CapitalExpenditure_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CapitalExpenditureCashFlowStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CapitalExpenditureCashFlowStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,101 @@
/*
* 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>
/// Measures the amount a company is investing in its business relative to EBITDA generated in a given PeriodAsByte.
/// </summary>
public class CapitalExpendituretoEBITDA : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "OneYear";
/// <summary>
/// Gets/sets the OneYear period value for the field
/// </summary>
[JsonProperty("1Y")]
public double OneYear => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapitalExpendituretoEBITDA_OneYear);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapitalExpendituretoEBITDA_OneYear));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CapitalExpendituretoEBITDA_OneYear);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1Y",OneYear) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"OperationRatios_CapitalExpendituretoEBITDA_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CapitalExpendituretoEBITDA()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CapitalExpendituretoEBITDA(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Current Portion of Capital Lease Obligation plus Long Term Portion of Capital Lease Obligation.
/// </summary>
public class CapitalLeaseObligationsBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalLeaseObligations_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalLeaseObligations_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalLeaseObligations_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalLeaseObligations_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalLeaseObligations_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalLeaseObligations_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalLeaseObligations_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalLeaseObligations_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_CapitalLeaseObligations_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CapitalLeaseObligationsBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CapitalLeaseObligationsBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// The total amount of stock authorized for issue by a corporation, including common and preferred stock.
/// </summary>
public class CapitalStockBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalStock_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalStock_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalStock_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalStock_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalStock_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalStock_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalStock_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CapitalStock_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_CapitalStock_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CapitalStockBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CapitalStockBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,101 @@
/*
* 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>
/// Cash outlay for cash advances and loans made to other parties.
/// </summary>
public class CashAdvancesandLoansMadetoOtherPartiesCashFlowStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashAdvancesandLoansMadetoOtherParties_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashAdvancesandLoansMadetoOtherParties_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashAdvancesandLoansMadetoOtherParties_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_CashFlowStatement_CashAdvancesandLoansMadetoOtherParties_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CashAdvancesandLoansMadetoOtherPartiesCashFlowStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CashAdvancesandLoansMadetoOtherPartiesCashFlowStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Includes unrestricted cash on hand, money market instruments and other debt securities which can be converted to cash immediately.
/// </summary>
public class CashAndCashEquivalentsBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndCashEquivalents_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndCashEquivalents_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndCashEquivalents_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndCashEquivalents_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndCashEquivalents_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndCashEquivalents_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndCashEquivalents_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndCashEquivalents_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_CashAndCashEquivalents_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CashAndCashEquivalentsBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CashAndCashEquivalentsBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,119 @@
/*
* 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>
/// Includes cash on hand (currency and coin), cash items in process of collection, non-interest bearing deposits due from other financial institutions (including corporate credit unions), and balances with the Federal Reserve Banks, Federal Home Loan Banks and central banks.
/// </summary>
public class CashAndDueFromBanksBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndDueFromBanks_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndDueFromBanks_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndDueFromBanks_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndDueFromBanks_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndDueFromBanks_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashAndDueFromBanks_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_CashAndDueFromBanks_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CashAndDueFromBanksBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CashAndDueFromBanksBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Cash includes currency on hand as well as demand deposits with banks or financial institutions. It also includes other kinds of accounts that have the general characteristics of demand deposits in that the customer may deposit additional funds at any time and also effectively may withdraw funds at any time without prior notice or penalty.
/// </summary>
public class CashBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_Cash_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_Cash_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_Cash_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_Cash_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_Cash_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_Cash_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_Cash_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_Cash_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_Cash_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CashBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CashBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,125 @@
/*
* 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>
/// The aggregate amount of cash, cash equivalents, and federal funds sold.
/// </summary>
public class CashCashEquivalentsAndFederalFundsSoldBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndFederalFundsSold_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndFederalFundsSold_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndFederalFundsSold_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndFederalFundsSold_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndFederalFundsSold_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndFederalFundsSold_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndFederalFundsSold_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_CashCashEquivalentsAndFederalFundsSold_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CashCashEquivalentsAndFederalFundsSoldBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CashCashEquivalentsAndFederalFundsSoldBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// The aggregate amount of cash, cash equivalents, and marketable securities.
/// </summary>
public class CashCashEquivalentsAndMarketableSecuritiesBalanceSheet : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndMarketableSecurities_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndMarketableSecurities_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndMarketableSecurities_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndMarketableSecurities_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndMarketableSecurities_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndMarketableSecurities_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndMarketableSecurities_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_BalanceSheet_CashCashEquivalentsAndMarketableSecurities_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_BalanceSheet_CashCashEquivalentsAndMarketableSecurities_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CashCashEquivalentsAndMarketableSecuritiesBalanceSheet()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CashCashEquivalentsAndMarketableSecuritiesBalanceSheet(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,113 @@
/*
* 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>
/// Days In Inventory + Days In Sales - Days In Payment
/// </summary>
public class CashConversionCycle : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "OneYear";
/// <summary>
/// Gets/sets the OneYear period value for the field
/// </summary>
[JsonProperty("1Y")]
public double OneYear => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CashConversionCycle_OneYear);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CashConversionCycle_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CashConversionCycle_SixMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CashConversionCycle_OneYear));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.OperationRatios_CashConversionCycle_OneYear);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1Y",OneYear), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"OperationRatios_CashConversionCycle_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CashConversionCycle()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CashConversionCycle(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -0,0 +1,119 @@
/*
* 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>
/// Cash Distribution of earnings to Minority Stockholders.
/// </summary>
public class CashDividendsForMinoritiesCashFlowStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsForMinorities_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsForMinorities_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsForMinorities_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsForMinorities_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsForMinorities_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsForMinorities_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_CashFlowStatement_CashDividendsForMinorities_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CashDividendsForMinoritiesCashFlowStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CashDividendsForMinoritiesCashFlowStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

View File

@@ -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>
/// Payments for the cash dividends declared by an entity to shareholders during the PeriodAsByte. This element includes paid and unpaid dividends declared during the period for both common and preferred stock.
/// </summary>
public class CashDividendsPaidCashFlowStatement : MultiPeriodField
{
/// <summary>
/// The default period
/// </summary>
protected override string DefaultPeriod => "TwelveMonths";
/// <summary>
/// Gets/sets the OneMonth period value for the field
/// </summary>
[JsonProperty("1M")]
public double OneMonth => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsPaid_OneMonth);
/// <summary>
/// Gets/sets the TwoMonths period value for the field
/// </summary>
[JsonProperty("2M")]
public double TwoMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsPaid_TwoMonths);
/// <summary>
/// Gets/sets the ThreeMonths period value for the field
/// </summary>
[JsonProperty("3M")]
public double ThreeMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsPaid_ThreeMonths);
/// <summary>
/// Gets/sets the SixMonths period value for the field
/// </summary>
[JsonProperty("6M")]
public double SixMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsPaid_SixMonths);
/// <summary>
/// Gets/sets the NineMonths period value for the field
/// </summary>
[JsonProperty("9M")]
public double NineMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsPaid_NineMonths);
/// <summary>
/// Gets/sets the TwelveMonths period value for the field
/// </summary>
[JsonProperty("12M")]
public double TwelveMonths => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsPaid_TwelveMonths);
/// <summary>
/// Returns true if the field contains a value for the default period
/// </summary>
public override bool HasValue => !BaseFundamentalDataProvider.IsNone(typeof(double), FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsPaid_TwelveMonths));
/// <summary>
/// Returns the default value for the field
/// </summary>
public override double Value
{
get
{
var defaultValue = FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, FundamentalProperty.FinancialStatements_CashFlowStatement_CashDividendsPaid_TwelveMonths);
if (!BaseFundamentalDataProvider.IsNone(typeof(double), 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, double> GetPeriodValues()
{
var result = new Dictionary<string, double>();
foreach (var kvp in new[] { new Tuple<string, double>("1M",OneMonth), new Tuple<string, double>("2M",TwoMonths), new Tuple<string, double>("3M",ThreeMonths), new Tuple<string, double>("6M",SixMonths), new Tuple<string, double>("9M",NineMonths), new Tuple<string, double>("12M",TwelveMonths) })
{
if(!BaseFundamentalDataProvider.IsNone(typeof(double), 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 double GetPeriodValue(string period) => FundamentalService.Get<double>(TimeProvider.GetUtcNow(), SecurityIdentifier, Enum.Parse<FundamentalProperty>($"FinancialStatements_CashFlowStatement_CashDividendsPaid_{ConvertPeriod(period)}"));
/// <summary>
/// Creates a new empty instance
/// </summary>
public CashDividendsPaidCashFlowStatement()
{
}
/// <summary>
/// Creates a new instance for the given time and security
/// </summary>
public CashDividendsPaidCashFlowStatement(ITimeProvider timeProvider, SecurityIdentifier securityIdentifier) : base(timeProvider, securityIdentifier)
{
}
}
}

Some files were not shown because too many files have changed in this diff Show More