# -*- coding: utf-8 -*-
"""
Created on Wed Feb 24 14:13:33 2021

@author: Gavin
"""

import backtrader as bt
import QuantLib as ql
import FundamentalAnalysis as fa

ticker = "AAPL"

api_key = "5460f75cb4f1f62a42c79066e3622078"
companies = fa.available_companies(api_key)
# Collect general company information
profile = fa.profile(ticker, api_key)

# Collect recent company quotes
quotes = fa.quote(ticker, api_key)

# Collect market cap and enterprise value
entreprise_value = fa.enterprise(ticker, api_key)

# Show recommendations of Analysts
ratings = fa.rating(ticker, api_key)

# Obtain DCFs over time
dcf_annually = fa.discounted_cash_flow(ticker, api_key, period="annual")
dcf_quarterly = fa.discounted_cash_flow(ticker, api_key, period="quarter")

# Collect the Balance Sheet statements
balance_sheet_annually = fa.balance_sheet_statement(ticker, api_key, period="annual")
balance_sheet_quarterly = fa.balance_sheet_statement(ticker, api_key, period="quarter")

# Collect the Income Statements
income_statement_annually = fa.income_statement(ticker, api_key, period="annual")
income_statement_quarterly = fa.income_statement(ticker, api_key, period="quarter")

# Collect the Cash Flow Statements
cash_flow_statement_annually = fa.cash_flow_statement(ticker, api_key, period="annual")
cash_flow_statement_quarterly = fa.cash_flow_statement(ticker, api_key, period="quarter")

# Show Key Metrics
key_metrics_annually = fa.key_metrics(ticker, api_key, period="annual")
key_metrics_quarterly = fa.key_metrics(ticker, api_key, period="quarter")

# Show a large set of in-depth ratios
financial_ratios_annually = fa.financial_ratios(ticker, api_key, period="annual")
financial_ratios_quarterly = fa.financial_ratios(ticker, api_key, period="quarter")

# Show the growth of the company
growth_annually = fa.financial_statement_growth(ticker, api_key, period="annual")
growth_quarterly = fa.financial_statement_growth(ticker, api_key, period="quarter")

# Download general stock data
stock_data = fa.stock_data(ticker, period="ytd", interval="1d")

# Download detailed stock data
stock_data_detailed = fa.stock_data_detailed(ticker, api_key, begin="2000-01-01", end="2020-01-01")

print(companies)
# crv = ql.FlatForward(ql.Date().todaysDate(),0.04875825,ql.Actual365Fixed())
# yts = ql.YieldTermStructureHandle(crv)
# engine = ql.DiscountingBondEngine(yts)

print()
9053e864e84915390ba637c6d26774a6141c8414
<mask token>

<mask token>
print(companies)
print()

<mask token>
ticker = 'AAPL'
api_key = '5460f75cb4f1f62a42c79066e3622078'
companies = fa.available_companies(api_key)
profile = fa.profile(ticker, api_key)
quotes = fa.quote(ticker, api_key)
entreprise_value = fa.enterprise(ticker, api_key)
ratings = fa.rating(ticker, api_key)
dcf_annually = fa.discounted_cash_flow(ticker, api_key, period='annual')
dcf_quarterly = fa.discounted_cash_flow(ticker, api_key, period='quarter')
balance_sheet_annually = fa.balance_sheet_statement(ticker, api_key, period
    ='annual')
balance_sheet_quarterly = fa.balance_sheet_statement(ticker, api_key,
    period='quarter')
income_statement_annually = fa.income_statement(ticker, api_key, period=
    'annual')
income_statement_quarterly = fa.income_statement(ticker, api_key, period=
    'quarter')
cash_flow_statement_annually = fa.cash_flow_statement(ticker, api_key,
    period='annual')
cash_flow_statement_quarterly = fa.cash_flow_statement(ticker, api_key,
    period='quarter')
key_metrics_annually = fa.key_metrics(ticker, api_key, period='annual')
key_metrics_quarterly = fa.key_metrics(ticker, api_key, period='quarter')
financial_ratios_annually = fa.financial_ratios(ticker, api_key, period=
    'annual')
financial_ratios_quarterly = fa.financial_ratios(ticker, api_key, period=
    'quarter')
growth_annually = fa.financial_statement_growth(ticker, api_key, period=
    'annual')
growth_quarterly = fa.financial_statement_growth(ticker, api_key, period=
    'quarter')
stock_data = fa.stock_data(ticker, period='ytd', interval='1d')
stock_data_detailed = fa.stock_data_detailed(ticker, api_key, begin=
    '2000-01-01', end='2020-01-01')
print(companies)
print()

<mask token>
import backtrader as bt
import QuantLib as ql
import FundamentalAnalysis as fa
ticker = 'AAPL'
api_key = '5460f75cb4f1f62a42c79066e3622078'
companies = fa.available_companies(api_key)
profile = fa.profile(ticker, api_key)
quotes = fa.quote(ticker, api_key)
entreprise_value = fa.enterprise(ticker, api_key)
ratings = fa.rating(ticker, api_key)
dcf_annually = fa.discounted_cash_flow(ticker, api_key, period='annual')
dcf_quarterly = fa.discounted_cash_flow(ticker, api_key, period='quarter')
balance_sheet_annually = fa.balance_sheet_statement(ticker, api_key, period
    ='annual')
balance_sheet_quarterly = fa.balance_sheet_statement(ticker, api_key,
    period='quarter')
income_statement_annually = fa.income_statement(ticker, api_key, period=
    'annual')
income_statement_quarterly = fa.income_statement(ticker, api_key, period=
    'quarter')
cash_flow_statement_annually = fa.cash_flow_statement(ticker, api_key,
    period='annual')
cash_flow_statement_quarterly = fa.cash_flow_statement(ticker, api_key,
    period='quarter')
key_metrics_annually = fa.key_metrics(ticker, api_key, period='annual')
key_metrics_quarterly = fa.key_metrics(ticker, api_key, period='quarter')
financial_ratios_annually = fa.financial_ratios(ticker, api_key, period=
    'annual')
financial_ratios_quarterly = fa.financial_ratios(ticker, api_key, period=
    'quarter')
growth_annually = fa.financial_statement_growth(ticker, api_key, period=
    'annual')
growth_quarterly = fa.financial_statement_growth(ticker, api_key, period=
    'quarter')
stock_data = fa.stock_data(ticker, period='ytd', interval='1d')
stock_data_detailed = fa.stock_data_detailed(ticker, api_key, begin=
    '2000-01-01', end='2020-01-01')
print(companies)
print()

# -*- coding: utf-8 -*-
"""
Created on Wed Feb 24 14:13:33 2021

@author: Gavin
"""

import backtrader as bt
import QuantLib as ql
import FundamentalAnalysis as fa

ticker = "AAPL"

api_key = "5460f75cb4f1f62a42c79066e3622078"
companies = fa.available_companies(api_key)
# Collect general company information
profile = fa.profile(ticker, api_key)

# Collect recent company quotes
quotes = fa.quote(ticker, api_key)

# Collect market cap and enterprise value
entreprise_value = fa.enterprise(ticker, api_key)

# Show recommendations of Analysts
ratings = fa.rating(ticker, api_key)

# Obtain DCFs over time
dcf_annually = fa.discounted_cash_flow(ticker, api_key, period="annual")
dcf_quarterly = fa.discounted_cash_flow(ticker, api_key, period="quarter")

# Collect the Balance Sheet statements
balance_sheet_annually = fa.balance_sheet_statement(ticker, api_key, period="annual")
balance_sheet_quarterly = fa.balance_sheet_statement(ticker, api_key, period="quarter")

# Collect the Income Statements
income_statement_annually = fa.income_statement(ticker, api_key, period="annual")
income_statement_quarterly = fa.income_statement(ticker, api_key, period="quarter")

# Collect the Cash Flow Statements
cash_flow_statement_annually = fa.cash_flow_statement(ticker, api_key, period="annual")
cash_flow_statement_quarterly = fa.cash_flow_statement(ticker, api_key, period="quarter")

# Show Key Metrics
key_metrics_annually = fa.key_metrics(ticker, api_key, period="annual")
key_metrics_quarterly = fa.key_metrics(ticker, api_key, period="quarter")

# Show a large set of in-depth ratios
financial_ratios_annually = fa.financial_ratios(ticker, api_key, period="annual")
financial_ratios_quarterly = fa.financial_ratios(ticker, api_key, period="quarter")

# Show the growth of the company
growth_annually = fa.financial_statement_growth(ticker, api_key, period="annual")
growth_quarterly = fa.financial_statement_growth(ticker, api_key, period="quarter")

# Download general stock data
stock_data = fa.stock_data(ticker, period="ytd", interval="1d")

# Download detailed stock data
stock_data_detailed = fa.stock_data_detailed(ticker, api_key, begin="2000-01-01", end="2020-01-01")

print(companies)
# crv = ql.FlatForward(ql.Date().todaysDate(),0.04875825,ql.Actual365Fixed())
# yts = ql.YieldTermStructureHandle(crv)
# engine = ql.DiscountingBondEngine(yts)

print()