Initial Commit
This commit is contained in:
4
MarketDataUnitTests/.gitignore
vendored
Normal file
4
MarketDataUnitTests/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/TestResults
|
||||
/bin
|
||||
/obj
|
||||
/packages
|
||||
BIN
MarketDataUnitTests/.vs/MarketDataUnitTests/v16/.suo
Normal file
BIN
MarketDataUnitTests/.vs/MarketDataUnitTests/v16/.suo
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
23
MarketDataUnitTests/App.config
Normal file
23
MarketDataUnitTests/App.config
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="market_data" value="Database=market_data;Datasource=localhost;Username=root;Password=dbas"/>
|
||||
<add key="portfolio_data" value="Database=portfolio_data;Datasource=localhost;Username=root;Password=dbas"/>
|
||||
<add key="sms_smtpaddress" value="smtp.gmail.com"/>
|
||||
<add key="sms_smsusername" value="skessler1964@gmail.com"/>
|
||||
<add key="sms_smspassword" value="xjfo isnf gmyi zovr"/>
|
||||
<!--<add key="sms_smsrecipients" value="6315252496@vtext.com"/>-->
|
||||
<add key="sms_smsrecipients" value="skessler1964sms@gmail.com"/>
|
||||
<add key="proxy_address" value="http://127.0.0.1:8182"/>
|
||||
<add key="proxy_GetLatestPriceYahoo" value="false"/>
|
||||
<add key="proxy_GetLatestPriceFidelity" value="true"/>
|
||||
<add key="proxy_GetLatestPriceBigCharts" value="false"/>
|
||||
<add key="proxy_GetETFHoldings" value="false"/>
|
||||
<add key="proxy_GetAnalystPriceTargetYahoo" value="true"/>
|
||||
<add key="proxy_GetDailyPrices" value="false"/>
|
||||
<add key="proxy_GetCompanyHeadlines" value="true"/>
|
||||
<!--<add key="proxy_GetFundamentalEx" value="true"/>-->
|
||||
<add key="proxy_GetDividendHistory" value="false"/>
|
||||
<!--<add key="proxy_GetAnalystPriceTargetMarketBeat" value="false"/>-->
|
||||
</appSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
|
||||
373
MarketDataUnitTests/MarketDataFeedTests.cs
Normal file
373
MarketDataUnitTests/MarketDataFeedTests.cs
Normal file
@@ -0,0 +1,373 @@
|
||||
using MarketData;
|
||||
using MarketData.DataAccess;
|
||||
using MarketData.Helper;
|
||||
using MarketData.MarketDataModel;
|
||||
using MarketData.Utils;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MarketDataUnitTests
|
||||
{
|
||||
[TestClass]
|
||||
public class MarketDataFeedTests
|
||||
{
|
||||
|
||||
[TestMethod]
|
||||
// [Ignore]
|
||||
public void ETFHoldsingsYahooRetrieval() // The feed layout has chnaged
|
||||
{
|
||||
String etfSymbol="ACWX";
|
||||
ETFHoldings etfHoldings=MarketDataHelper.GetETFHoldings(etfSymbol);
|
||||
Assert.IsTrue(null!=etfHoldings && etfHoldings.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void LatestPriceYahoo2Retrieval() // The feed layout has changed
|
||||
{
|
||||
// String symbol="AAPL";
|
||||
// String symbol="JFNNX";
|
||||
String symbol="1234";
|
||||
Price price=MarketDataHelper.GetLatestPriceYahoo2(symbol);
|
||||
Assert.IsTrue(null!=price,"No Price");
|
||||
Assert.IsTrue(price.IsValid,"Invalid Price");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Ignore]
|
||||
public void LatestPriceYahooRetrieval() // The feed layout has changed
|
||||
{
|
||||
String symbol="AAPL";
|
||||
Price price=MarketDataHelper.GetLatestPriceYahoo(symbol);
|
||||
Assert.IsTrue(null!=price,"No Price");
|
||||
Assert.IsTrue(price.IsValid,"Invalid Price");
|
||||
}
|
||||
|
||||
// This test only passes when the web proxy is bypassed
|
||||
[TestMethod]
|
||||
public void FundamentalYahooRetrieval()
|
||||
{
|
||||
String symbol = "MIDD";
|
||||
Fundamental fundamental=MarketDataHelper.GetFundamental(symbol);
|
||||
Assert.IsTrue(null!=fundamental);
|
||||
// Assert.IsTrue(!Utility.IsEpoch(fundamental.NextEarningsDate),"NextEarningsDate");
|
||||
// Assert.IsTrue(!double.IsNaN(fundamental.Beta),"Beta");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.Low52),"Low52");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.High52),"High52");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.Volume),"Volume");
|
||||
// Assert.IsTrue(!double.IsNaN(fundamental.MarketCap),"MarketCap");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.PE),"PE");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.EPS),"EPS");
|
||||
// Assert.IsTrue(!double.IsNaN(fundamental.PEG),"PEG");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.ReturnOnAssets),"ReturnOnAssets");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.ReturnOnEquity),"ReturnOnEquity");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.TotalCash),"TotalCash");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.TotalDebt),"TotalDebt");
|
||||
// Assert.IsTrue(!double.IsNaN(fundamental.SharesOutstanding),"SharesOutstanding");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.Revenue),"Revenue");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.RevenuePerShare),"RevenuePerShare");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.QtrlyRevenueGrowth),"QtrlyRevenueGrowth");
|
||||
// Assert.IsTrue(!double.IsNaN(fundamental.GrossProfit),"GrossProfit");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.EBITDA),"EBITDA");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.NetIncomeAvailableToCommon),"NetIncomeAvailableToCommon");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.BookValuePerShare),"BookValuePerShare");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.OperatingCashflow),"OperatingCashflow");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.LeveragedFreeCashflow),"LeveragedFreeCashflow");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.Equity),"Equity");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.TrailingPE),"TrailingPE");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.EnterpriseValue),"EnterpriseValue");
|
||||
// Assert.IsTrue(!double.IsNaN(fundamental.EBIT),"EBIT");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.DebtToEquity),"DebtToEquity");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DividendHistoryRetrieval()
|
||||
{
|
||||
Dictionary<String,bool> items=new Dictionary<String,bool>();
|
||||
String dividendSymbol="AAPL";
|
||||
DividendHistory dividendHistory=MarketDataHelper.GetDividendHistory(dividendSymbol);
|
||||
Assert.IsTrue(null!=dividendHistory && dividendHistory.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PremarketRetrieval()
|
||||
{
|
||||
PremarketElements premarketElements = MarketDataHelper.GetPremarketData();
|
||||
Assert.IsTrue(null!=premarketElements && premarketElements.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EarningsAnnouncementsaRetrieval()
|
||||
{
|
||||
String symbol="MIDD";
|
||||
EarningsAnnouncements earningsAnnouncements=MarketDataHelper.GetEarningsAnnouncements(symbol);
|
||||
Assert.IsTrue(null!=earningsAnnouncements && earningsAnnouncements.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ZacksRankRetrieval()
|
||||
{
|
||||
String symbol="MIDD";
|
||||
ZacksRank zacksRank=MarketDataHelper.GetZacksRank(symbol);
|
||||
Assert.IsTrue(null!=zacksRank && null!=zacksRank.Rank);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetSplitsRetrieval()
|
||||
{
|
||||
Splits splits=MarketDataHelper.GetSplits();
|
||||
Assert.IsTrue(null!=splits && splits.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GDPPerCapitaRetrieval()
|
||||
{
|
||||
EconomicIndicators economicIndicators=MarketDataHelper.GetGDPPerCapita();
|
||||
Assert.IsTrue(null!=economicIndicators && economicIndicators.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void LatestAnalystRatingsRetrieval()
|
||||
{
|
||||
AnalystRatings analystRatings=MarketDataHelper.GetLatestAnalystRatings();
|
||||
Assert.IsTrue(null!=analystRatings && analystRatings.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AnalystRatingsMarketBeatRetrieval()
|
||||
{
|
||||
String symbol="AAPL";
|
||||
AnalystRatings analystRatings=MarketDataHelper.GetAnalystRatingsMarketBeat(symbol);
|
||||
Assert.IsTrue(null!=analystRatings && analystRatings.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SECCIKRetrieval()
|
||||
{
|
||||
String symbol="AAPL";
|
||||
String strCik=MarketDataHelper.GetCIK(symbol);
|
||||
Assert.IsTrue(null!=strCik);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SECFilingsRetrieval()
|
||||
{
|
||||
String symbol="AAPL";
|
||||
String strCik=MarketDataHelper.GetCIK(symbol);
|
||||
Assert.IsTrue(null!=strCik);
|
||||
SECFilings secFilings=MarketDataHelper.GetSECFilings(symbol,strCik,1);
|
||||
Assert.IsTrue(null!=secFilings && secFilings.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void YieldCurveRetrieval()
|
||||
{
|
||||
DateGenerator dateGenerator= new DateGenerator();
|
||||
DateTime analysisDate=dateGenerator.FindPrevBusinessDay(DateTime.Now);
|
||||
YieldCurve yieldCurve=MarketDataHelper.GetYieldCurve(analysisDate.Year);
|
||||
Assert.IsTrue(null!=yieldCurve && yieldCurve.Count>0);
|
||||
Assert.IsTrue(yieldCurve[yieldCurve.Count-1].Date.Month.Equals(analysisDate.Month));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void InsiderTransactionRetrieval()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
DateGenerator dateGenerator = new DateGenerator();
|
||||
InsiderTransactions insiderTransactions = InsiderTransactionDA.GetLatestInsiderTransactions();
|
||||
Assert.IsTrue(null!=insiderTransactions && insiderTransactions.Count>0);
|
||||
InsiderTransaction insiderTransaction = insiderTransactions[0];
|
||||
int daysBetween = dateGenerator.DaysBetween(now, insiderTransaction.TransactionDate)+1;
|
||||
Assert.IsTrue(daysBetween<10);
|
||||
InsiderTransactions latestTransactions=MarketDataHelper.GetInsiderTransactions(insiderTransaction.Symbol,daysBetween);
|
||||
Assert.IsTrue(null!=latestTransactions && latestTransactions.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CompanyProfileRetrieval()
|
||||
{
|
||||
String symbol="MIDD";
|
||||
CompanyProfile companyProfile=MarketDataHelper.GetCompanyProfile(symbol);
|
||||
Assert.IsTrue(null!=companyProfile);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HeadlinesRetrieval()
|
||||
{
|
||||
String symbol="MIDD";
|
||||
Headlines headlines = HeadlinesDA.GetLatestHeadlines();
|
||||
Assert.IsTrue(null!=headlines && headlines.Count>0);
|
||||
Headline headline = headlines[0];
|
||||
Headlines companyHeadlines = HeadlinesMarketDataHelper.GetHeadlinesEx(headline.Symbol);
|
||||
Assert.IsTrue(null!=companyHeadlines && companyHeadlines.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AnalystPriceTargetMarketBeatRetrieval()
|
||||
{
|
||||
String symbol="MGPI";
|
||||
AnalystPriceTarget analystPriceTarget=MarketDataHelper.GetAnalystPriceTargetMarketBeat(symbol);
|
||||
Assert.IsTrue(null!=analystPriceTarget);
|
||||
Assert.IsTrue(!Double.IsNaN(analystPriceTarget.HighTargetPrice));
|
||||
Assert.IsTrue(!Double.IsNaN(analystPriceTarget.LowTargetPrice));
|
||||
Assert.IsTrue(!Double.IsNaN(analystPriceTarget.MeanTargetPrice));
|
||||
Assert.IsTrue(!Double.IsNaN(analystPriceTarget.MedianTargetPrice));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void HistoricalRetrieval()
|
||||
{
|
||||
String symbol="AAPL";
|
||||
Dictionary<TimeSeriesElement.ElementType, TimeSeriesCollection> timeSeries=MarketDataHelper.GetHistoricalValues(symbol);
|
||||
Assert.IsTrue(null!=timeSeries);
|
||||
Assert.IsTrue(timeSeries.ContainsKey(TimeSeriesElement.ElementType.ROA),"Missing ROA");
|
||||
Assert.IsTrue(timeSeries.ContainsKey(TimeSeriesElement.ElementType.ROIC),"Missing ROIC");
|
||||
Assert.IsTrue(timeSeries.ContainsKey(TimeSeriesElement.ElementType.BVPS),"Missing BVPS");
|
||||
Assert.IsTrue(timeSeries.ContainsKey(TimeSeriesElement.ElementType.Inventory),"Missing Inventory");
|
||||
Assert.IsTrue(timeSeries.ContainsKey(TimeSeriesElement.ElementType.AccountsReceivable),"Missing AccountsReceivable");
|
||||
Assert.IsTrue(timeSeries.ContainsKey(TimeSeriesElement.ElementType.COGS),"Missing COGS");
|
||||
Assert.IsTrue(timeSeries.ContainsKey(TimeSeriesElement.ElementType.OperatingIncome),"Missing OperatingIncome");
|
||||
Assert.IsTrue(timeSeries.ContainsKey(TimeSeriesElement.ElementType.InterestExpense),"Missing InterestExpense");
|
||||
Assert.IsTrue(timeSeries.ContainsKey(TimeSeriesElement.ElementType.TaxRate),"Missing TaxRate");
|
||||
Assert.IsTrue(timeSeries.ContainsKey(TimeSeriesElement.ElementType.Revenue),"Missing Revenue");
|
||||
Assert.IsTrue(timeSeries.ContainsKey(TimeSeriesElement.ElementType.NetIncomeAvailableToCommonShareholders),"Missing NetIncomeAvailableToCommonShareholders");
|
||||
Assert.IsTrue(timeSeries.ContainsKey(TimeSeriesElement.ElementType.OperatingCashflow),"Missing OperatingCashflow");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IncomeStatementNASDAQRetrievsl()
|
||||
{
|
||||
String symbol="MIDD";
|
||||
List<IncomeStatement> incomeStatements=MarketDataHelper.GetIncomeStatementNASDAQ(symbol,IncomeStatement.PeriodType.Annual);
|
||||
Assert.IsTrue(null!=incomeStatements && incomeStatements.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IncomeStatementFinVizRetrievsl()
|
||||
{
|
||||
String symbol="MIDD";
|
||||
List<IncomeStatement> incomeStatements=MarketDataHelper.GetIncomeStatementFinViz(symbol,IncomeStatement.PeriodType.Annual);
|
||||
Assert.IsTrue(null!=incomeStatements && incomeStatements.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void BalanceSheetNASDAQRetrieval()
|
||||
{
|
||||
String symbol="MIDD";
|
||||
List<BalanceSheet> balanceSheets = MarketDataHelper.GetBalanceSheetNASDAQ(symbol, BalanceSheet.PeriodType.Annual);
|
||||
Assert.IsTrue(null != balanceSheets && balanceSheets.Count > 0);
|
||||
BalanceSheet balanceSheet = balanceSheets[0];
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.CashAndCashEquivalents),"CashAndCashEquivalents");
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.DeferredLongTermLiabilities),"DeferredLongTermLiabilities");
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.IntangibleAssets),"IntangibleAssets");
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.Inventory),"Inventory");
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.LongTermDebt),"LongTermDebt");
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.NetCurrentAssetValue),"NetCurrentAssetValue");
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.NetFixedAssets),"NetFixedAssets");
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.OtherLiabilities),"OtherLiabilities");
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.PropertyPlantAndEquipment),"PropertyPlantAndEquipment");
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.TotalAssets),"TotalAssets");
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.TotalCurrentAssets),"TotalCurrentAssets");
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.TotalCurrentLiabilities),"TotalCurrentLiabilities");
|
||||
Assert.IsTrue(!double.IsNaN(balanceSheet.TotalLiabilities),"TotalLiabilities");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CashflowStatementMorningStarRetrieval()
|
||||
{
|
||||
String symbol="MIDD";
|
||||
List<CashflowStatement> cashflowStatements = MarketDataHelper.GetCashflowStatement(symbol, CashflowStatement.PeriodType.Annual);
|
||||
Assert.IsTrue(null != cashflowStatements && cashflowStatements.Count > 0);
|
||||
CashflowStatement cashflowStatement = cashflowStatements[0];
|
||||
Assert.IsTrue(!double.IsNaN(cashflowStatement.DepreciationAndAmortization),"DepreciationAndAmortization");
|
||||
Assert.IsTrue(!double.IsNaN(cashflowStatement.DeferredIncomeTaxes),"DeferredIncomeTaxes");
|
||||
Assert.IsTrue(!double.IsNaN(cashflowStatement.StockBasedCompensation),"StockBasedCompensation");
|
||||
Assert.IsTrue(!double.IsNaN(cashflowStatement.AccountsReceivable),"AccountsReceivable");
|
||||
Assert.IsTrue(!double.IsNaN(cashflowStatement.Inventory),"Inventory");
|
||||
Assert.IsTrue(!double.IsNaN(cashflowStatement.AccountsPayable),"AccountsPayable");
|
||||
Assert.IsTrue(!double.IsNaN(cashflowStatement.AccruedLiabilities),"AccruedLiabilities");
|
||||
Assert.IsTrue(!double.IsNaN(cashflowStatement.OperatingCashflow),"OperatingCashflow");
|
||||
Assert.IsTrue(!double.IsNaN(cashflowStatement.FreeCashflow),"FreeCashflow");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CurrencyConversionXERetrieval()
|
||||
{
|
||||
DateGenerator dateGenerator = new DateGenerator();
|
||||
String sourceCurrency="USD";
|
||||
DateTime analysisDate = DateTime.Now;
|
||||
analysisDate = dateGenerator.GetPrevBusinessDay(analysisDate);
|
||||
CurrencyConversionCollection currencyConversionCollection = MarketDataHelper.GetCurrencyConversion(sourceCurrency,analysisDate);
|
||||
Assert.IsTrue(null!=currencyConversionCollection && currencyConversionCollection.Count>0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FundamentalFinVizRetrieval()
|
||||
{
|
||||
String symbol = "MIDD";
|
||||
Fundamental fundamental=MarketDataHelper.GetFundamentalFinViz(symbol);
|
||||
Assert.IsTrue(null!=fundamental);
|
||||
Assert.IsTrue(!Utility.IsEpoch(fundamental.NextEarningsDate),"NextEarningsDate");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.Beta),"Beta");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.Low52),"Low52");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.High52),"High52");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.Volume),"Volume");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.MarketCap),"MarketCap");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.PE),"PE");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.EPS),"EPS");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.PEG),"PEG");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.ReturnOnAssets),"ReturnOnAssets");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.ReturnOnEquity),"ReturnOnEquity");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.TotalCash),"TotalCash");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.TotalDebt),"TotalDebt");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.SharesOutstanding),"SharesOutstanding");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.Revenue),"Revenue");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.RevenuePerShare),"RevenuePerShare");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.QtrlyRevenueGrowth),"QtrlyRevenueGrowth");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.GrossProfit),"GrossProfit");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.EBITDA),"EBITDA");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.NetIncomeAvailableToCommon),"NetIncomeAvailableToCommon");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.BookValuePerShare),"BookValuePerShare");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.OperatingCashflow),"OperatingCashflow");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.LeveragedFreeCashflow),"LeveragedFreeCashflow");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.Equity),"Equity");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.TrailingPE),"TrailingPE");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.EnterpriseValue),"EnterpriseValue");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.EBIT),"EBIT");
|
||||
Assert.IsTrue(!double.IsNaN(fundamental.DebtToEquity),"DebtToEquity");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void LatestPriceBigChartsRetrieval()
|
||||
{
|
||||
String symbol="MIDD";
|
||||
Price price=MarketDataHelper.GetLatestPriceBigCharts(symbol);
|
||||
Assert.IsTrue(null!=price,"No Price");
|
||||
Assert.IsTrue(price.IsValid,"Invalid Price");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetPriceAsOfBigChartsRetrieval()
|
||||
{
|
||||
String symbol="MIDD";
|
||||
DateTime analysisDate=DateTime.Now;
|
||||
DateGenerator dateGenerator = new DateGenerator();
|
||||
analysisDate=dateGenerator.GetPrevBusinessDay(analysisDate);
|
||||
Price price=MarketDataHelper.GetPriceAsOf(symbol,analysisDate);
|
||||
Assert.IsTrue(null!=price,"No Price");
|
||||
Assert.IsTrue(price.IsValid,"Invalid Price");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetDailyPricesYahooRetrieval()
|
||||
{
|
||||
String symbol="MIDD";
|
||||
DateTime analysisDate=DateTime.Now;
|
||||
DateGenerator dateGenerator = new DateGenerator();
|
||||
analysisDate=dateGenerator.GetPrevBusinessDay(analysisDate);
|
||||
Prices prices=MarketDataHelper.GetDailyPrices(symbol,analysisDate,analysisDate);
|
||||
Assert.IsTrue(null!=prices && prices.Count>0,"No Price");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
75
MarketDataUnitTests/MarketDataUnitTests.csproj
Normal file
75
MarketDataUnitTests/MarketDataUnitTests.csproj
Normal file
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{FB4261E1-0A5D-4A36-8550-0D19AB180E15}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MarketDataUnitTests</RootNamespace>
|
||||
<AssemblyName>MarketDataUnitTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MarketDataFeedTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MarketDataLib\MarketDataLib.csproj">
|
||||
<Project>{e807f1ca-9d9c-484a-8e83-269d57707b4b}</Project>
|
||||
<Name>MarketDataLib</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
||||
31
MarketDataUnitTests/MarketDataUnitTests.sln
Normal file
31
MarketDataUnitTests/MarketDataUnitTests.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32126.315
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarketDataUnitTests", "MarketDataUnitTests.csproj", "{FB4261E1-0A5D-4A36-8550-0D19AB180E15}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarketDataLib", "..\MarketDataLib\MarketDataLib.csproj", "{E807F1CA-9D9C-484A-8E83-269D57707B4B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FB4261E1-0A5D-4A36-8550-0D19AB180E15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FB4261E1-0A5D-4A36-8550-0D19AB180E15}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FB4261E1-0A5D-4A36-8550-0D19AB180E15}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FB4261E1-0A5D-4A36-8550-0D19AB180E15}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E807F1CA-9D9C-484A-8E83-269D57707B4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E807F1CA-9D9C-484A-8E83-269D57707B4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E807F1CA-9D9C-484A-8E83-269D57707B4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E807F1CA-9D9C-484A-8E83-269D57707B4B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {05DC6CA7-0B19-4FD8-83C4-7602F080A624}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
20
MarketDataUnitTests/Properties/AssemblyInfo.cs
Normal file
20
MarketDataUnitTests/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("MarketDataUnitTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MarketDataUnitTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("fb4261e1-0a5d-4a36-8550-0d19ab180e15")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
5
MarketDataUnitTests/packages.config
Normal file
5
MarketDataUnitTests/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net462" />
|
||||
<package id="MSTest.TestFramework" version="2.1.2" targetFramework="net462" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user