Example #1
0
        public async Task <IActionResult> PutFinancialStatements(int id, FinancialStatements financialStatements)
        {
            if (id != financialStatements.TransactionId)
            {
                return(BadRequest());
            }

            _context.Entry(financialStatements).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FinancialStatementsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public bool TryGetFinancialData(string ticker, Exchange?exchange, out FinancialStatements financialData, out string message)
        {
            /*
             * Sources
             * *******
             *
             * Nasdaq - 4 years, from 2016 to 2019
             * https://api.nasdaq.com/api/company/AAPL/financials?frequency=1
             *
             * Reuters - 6 years, from 2014 to 2019
             * https://www.reuters.com/companies/api/getFetchCompanyFinancials/AAPL.OQ
             *
             * Financial statement from Apple site
             * https://investor.apple.com/sec-filings/sec-filings-details/default.aspx?FilingId=13709514
             * http://d18rn0p25nwr6d.cloudfront.net/CIK-0000320193/c0dc1bce-6ba9-4131-af22-54dab3277c8e.html#
             *
             * The problem is that neither of both are usefull to calculate future cashflows.
             * I have to use EDGAR, but:
             * Pending to parse, store and read the datasets
             * Pending to parse, store and read the file indexes
             * Pending to access the files
             */

            return(financialDataSource.TryGetFinancialData(ticker, exchange, out financialData, out message));
        }
Example #3
0
        public bool TryGetFinancialData(string ticker, Exchange?exchange, out FinancialStatements financialData, out string errorMessage)
        {
            //Example
            //https://api.nasdaq.com/api/company/AAPL/financials?frequency=1
            bool    ok      = NasdaqApiCaller.GetFinancialData(ticker, out string jsonResponse, out errorMessage);
            dynamic rawdata = JsonConvert.DeserializeObject(jsonResponse);

            throw new NotImplementedException();
        }
Example #4
0
 /// <summary>
 /// Creates an instance of the FineFundamental class
 /// </summary>
 public FineFundamental()
 {
     CompanyReference    = new CompanyReference();
     SecurityReference   = new SecurityReference();
     FinancialStatements = new FinancialStatements();
     EarningReports      = new EarningReports();
     OperationRatios     = new OperationRatios();
     EarningRatios       = new EarningRatios();
     ValuationRatios     = new ValuationRatios();
 }
Example #5
0
		/// <summary>
		/// Creates an instance of the FineFundamental class
		/// </summary>
		public FineFundamental()
		{
			CompanyReference = new CompanyReference();
			SecurityReference = new SecurityReference();
			FinancialStatements = new FinancialStatements();
			EarningReports = new EarningReports();
			OperationRatios = new OperationRatios();
			EarningRatios = new EarningRatios();
			ValuationRatios = new ValuationRatios();
		}
Example #6
0
 /// <summary>
 /// Sets values for non existing periods from a previous instance
 /// </summary>
 /// <remarks>Used to fill-forward values from previous dates</remarks>
 /// <param name="previous">The previous instance</param>
 public void UpdateValues(FineFundamental previous)
 {
     CompanyReference.UpdateValues(previous.CompanyReference);
     SecurityReference.UpdateValues(previous.SecurityReference);
     FinancialStatements.UpdateValues(previous.FinancialStatements);
     EarningReports.UpdateValues(previous.EarningReports);
     OperationRatios.UpdateValues(previous.OperationRatios);
     EarningRatios.UpdateValues(previous.EarningRatios);
     ValuationRatios.UpdateValues(previous.ValuationRatios);
 }
Example #7
0
        /// <summary>
        /// Creates an instance of the FineFundamental class
        /// </summary>
        public FineFundamental()
        {
            DataType = MarketDataType.Auxiliary;

            CompanyReference    = new CompanyReference();
            SecurityReference   = new SecurityReference();
            FinancialStatements = new FinancialStatements();
            EarningReports      = new EarningReports();
            OperationRatios     = new OperationRatios();
            EarningRatios       = new EarningRatios();
            ValuationRatios     = new ValuationRatios();
        }
Example #8
0
        /// <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(FineFundamental update)
        {
            if (update == null)
            {
                return;
            }

            CompanyReference?.UpdateValues(update.CompanyReference);
            SecurityReference?.UpdateValues(update.SecurityReference);
            FinancialStatements?.UpdateValues(update.FinancialStatements);
            EarningReports?.UpdateValues(update.EarningReports);
            OperationRatios?.UpdateValues(update.OperationRatios);
            EarningRatios?.UpdateValues(update.EarningRatios);
            ValuationRatios?.UpdateValues(update.ValuationRatios);
            CompanyProfile?.UpdateValues(update.CompanyProfile);
            AssetClassification?.UpdateValues(update.AssetClassification);
        }
Example #9
0
        /// <summary>
        /// Sets values for non existing periods from a previous instance
        /// </summary>
        /// <remarks>Used to fill-forward values from previous dates</remarks>
        /// <param name="previous">The previous instance</param>
        public void UpdateValues(FineFundamental previous)
        {
            if (previous == null)
            {
                return;
            }

            if (CompanyReference != null)
            {
                CompanyReference.UpdateValues(previous.CompanyReference);
            }
            if (SecurityReference != null)
            {
                SecurityReference.UpdateValues(previous.SecurityReference);
            }
            if (FinancialStatements != null)
            {
                FinancialStatements.UpdateValues(previous.FinancialStatements);
            }
            if (EarningReports != null)
            {
                EarningReports.UpdateValues(previous.EarningReports);
            }
            if (OperationRatios != null)
            {
                OperationRatios.UpdateValues(previous.OperationRatios);
            }
            if (EarningRatios != null)
            {
                EarningRatios.UpdateValues(previous.EarningRatios);
            }
            if (ValuationRatios != null)
            {
                ValuationRatios.UpdateValues(previous.ValuationRatios);
            }
            if (CompanyProfile != null)
            {
                CompanyProfile.UpdateValues(previous.CompanyProfile);
            }
            if (AssetClassification != null)
            {
                AssetClassification.UpdateValues(previous.AssetClassification);
            }
        }
 public bool TryGetFinancialData(string ticker, Exchange?exchange, out FinancialStatements financialData, out string message)
 {
     throw new NotImplementedException();
 }
Example #11
0
        public async Task <ActionResult <FinancialStatements> > PostFinancialStatements(FinancialStatements financialStatements)
        {
            _context.TransactionLog.Add(financialStatements);
            await _context.SaveChangesAsync();

            //return CreatedAtAction("GetFinancialStatements", new { id = financialStatements.Id }, financialStatements);
            return(CreatedAtAction(nameof(GetFinancialStatements), new { id = financialStatements.TransactionId }, financialStatements));
        }
 public bool TryGetFinancialData(string ticker, Exchange?exchange, out FinancialStatements financialData, out string message)
 {
     //https://financialmodelingprep.com/developer/docs/#Company-Financial-Statements
     throw new NotImplementedException();
 }
Example #13
0
        public bool TryGetFinancialData(string ticker, Exchange?exchange, out FinancialStatements financialData, out string errorMessage)
        {
            //Example
            //https://www.reuters.com/companies/api/getFetchCompanyFinancials/AAPL.OQ

            bool   ok             = false;
            string jsonResponse   = "{}";
            string internalTicker = "";

            internalTicker = $"{ticker}{Translate(exchange.Value)}";
            ok             = ReutersApiCaller.GetFinancialData(internalTicker, out jsonResponse, out errorMessage);

            //If it fails the first try, it tries with all exchanges
            if (ok == false)
            {
                internalTicker = $"{ticker}";
                ok             = ReutersApiCaller.GetFinancialData(internalTicker, out jsonResponse, out errorMessage);

                Exchange[] exchanges = (Exchange[])Enum.GetValues(typeof(Exchange));
                int        i         = 0;
                while (ok == false && i < exchanges.Length)
                {
                    Exchange ex = exchanges[i];
                    internalTicker = $"{ticker}{Translate(ex)}";
                    ok             = ReutersApiCaller.GetSummary(internalTicker, out jsonResponse, out errorMessage);
                    i++;
                }
            }

            if (ok)
            {
                dynamic rawdata = JsonConvert.DeserializeObject(jsonResponse);
                financialData = new FinancialStatements()
                {
                    IncomeStatement = new AccountingItem()
                    {
                        IsAnnual = true, Childs = new List <AccountingItem>(),
                    },
                    BalanceSheet = new AccountingItem()
                    {
                        IsAnnual = true, Childs = new List <AccountingItem>(),
                    },
                    CashFlowStatement = new AccountingItem()
                    {
                        IsAnnual = true, Childs = new List <AccountingItem>(),
                    },
                };

                AddValues(financialData.IncomeStatement.Childs, rawdata.market_data.financial_statements.income.annual);
                AddValues(financialData.BalanceSheet.Childs, rawdata.market_data.financial_statements.balance_sheet.annual);
                AddValues(financialData.CashFlowStatement.Childs, rawdata.market_data.financial_statements.cash_flow.annual);

                return(true);
            }
            else
            {
                if (exchange.HasValue)
                {
                    errorMessage = $"It can't find financial data for ticker {ticker} in exchange {exchange.Value.ToString()}.";
                }
                else
                {
                    errorMessage = $"It can't find financial data for ticker {ticker} in all markets available.";
                }
                financialData = null;
                return(false);
            }
        }