Code Monkey home page Code Monkey logo

opentaps / open-climate-investing Goto Github PK

View Code? Open in Web Editor NEW
42.0 42.0 15.0 40.59 MB

Application and data for analyzing and structuring portfolios for climate investing.

Home Page: https://climate-investing-book.opensourcestrategies.com/v/main/book

License: GNU Affero General Public License v3.0

Python 33.31% R 26.22% Shell 1.18% JavaScript 38.27% HTML 0.54% CSS 0.50%
climate-change climate-data esg factor-analysis fama-french finance hacktoberfest hacktoberfest2021 modern-portfolio-analysis modern-portfolio-theory stock stock-market

open-climate-investing's People

Contributors

hai-yr avatar igna43 avatar jwickers avatar mattbowler avatar rybalko avatar sichen1234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

open-climate-investing's Issues

define what is a valid carbon offset?

Thinking about #28 to find places to buy carbon offsets, maybe we should define what valid carbon offsets are?

In the Tao of Decarbonization I felt that carbon offsets should follow the core carbon principles at the time of activity: additionality, baseline, leakage, permanence, real.

More basically, though, I think some other requirements may be needed. For example,

  • Standards should be maintained independently
  • Auditors need to be independent organizations than project developers
  • Auditors can be part of developing standards, but the standards should not be maintained solely by auditors and definitely not by one auditor.

CARIMA website doesn't work

Not an issue with open-climate-investing per se.

The documentation cites https://carima-project.de/en for accessing tools and the BMG factor, but on multiple machines I just get an SSL error trying to access the site. This makes investigation into the factor problematic.

analyze popular ESG funds as BMG series

See if ESG funds could be used to construct BMG index, or if the market is not trading according to the fund's ESG criteria:

  1. Find a list of popular ESG funds
  2. Based on their sector weights, find a matching ETF
  3. Calculate a BMG series from the ESG fund and the matching ETF
  4. Compare this BMG series to the other funds we've analyzed in the paper

compare BMG factor to EU ETS

Compare the BMG factor to the historical pricing of the EU Emissions Trading Scheme futures to determine if the EU ETS futures are suitable as a BMG factor.

The EU ETS can be converted into a BMG factor by calculating its price change, with a positive price change being a negative BMG return and negative pric echange being a positive BMG return, since increases (decreases) in emissions prices should lead to worse (better) performance of "brown" stocks vs "green" stocks.

This can be based on correlation of EU ETS with the BMG factor and testing it as a model variable following the steps in #4

initial set up

Initial implementation of the CARIMA model based on the Fama French factors model from https://www.uni-augsburg.de/de/fakultaet/wiwi/prof/bwl/wilkens/sustainable-finance/downloads/ and https://docplayer.net/156158475-Carbon-risk-management-carima-rollout-conference-2-nd-july-2019-frankfurt-am-main.html

Integrate in the Brown Minus Green returns time series from the spreadsheet and the other return factors from http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html

Integrate stock return data set

Goal is to be able to perform calculations on individual stocks using the CARIMA model

test results for all steps in the paper

Please follow the file Paper_steps.md to test the results in the 2 google spreadsheets:

  • Using data/carbon_risk_factor.csv:
    • "Carbon Loadings Results - CARIMA" - CARIMA Industry, CARIMA Industry EW, CARIMA BMG Significant Stocks, No BMG Industry, No BMG EW
  • Using data/bmg_eu_ets.csv
    • "Carbon Loadings Results - Alternates" - EUA Futures, EUA EW
  • Using data/bmg_acwi_crbn.csv
    • "Carbon Loadings Results - Alternates" - ACWI-CRBN, ACWI-CRBN EW, ACWI-CRBN Significant Stocks
  • Using data/bmg_xop_smog.csv
    • "Carbon Loadings Results - Alternates" - XOP-SMOG, XOP-SMOG EW, XOP-SMOG Significant Stocks
  • Using data/bmg_xop_smog_orthogonalized_1.csv
    • "Carbon Loadings Results - Alternates" - XOP-SMOG ORTHO 1, XOP-SMOG ORTHO 1 EW, XOP-SMOG ORTHO 1 Significant Stocks
  • Using data/bmg_xop_smog_orthogonalized_2.csv
    • "Carbon Loadings Results - Alternates" - XOP-SMOG ORTHO 2, XOP-SMOG ORTHO 2 EW, XOP-SMOG ORTHO 2 Significant Stocks
  • Also for all the data/ files,
    • "Carbon Loadings Results - CARIMA" - Number of Stocks by Sector, Correlations, BMG Regressed vs Other Factors - Except for the bmg_eu_ets.csv, I did not do regressions vs other factors

adjust factor table schema and code to allow for more than FF factors

At the moment, we have a table that is specifically designed for the 4-factor Fama-French factors. It might be a better design to have a long table with factor names and dates that allow for other factors besides FF, and that the user can specify as part of using everything.

make loading of daily and monthly data consistent

Make the loading of daily and monthly data from the Ken French data library consistent:

  1. The files in our data/ repository should be the CSV files from the Fama/French 3 Factor, Fama/French 3 Factors [Daily], Momentum Factor (Mom), Momentum Factor (Mom) [Daily]
  2. The files should not have the additional FREQUENCY column. Our data loading script should set the frequency based on the file.
  3. The risk free rate in both cases should be in the CSV files. There should not be separate risk free rates file.

use industry specific market index and general carbon risk factors to identify specific stock risks

When testing the model against a utility (DUK), it seems that the regression model has little explanatory power. Could we improve it by using a specific market index (such as utility ETF fund) as the market factor and then add in the carbon risk factor? Would that give good explanatory power to the stocks in that industry? Would it help identify stocks with high and low carbon risks when the particular sector is not as correlated with the market as a whole?

This could be expanded to other sectors, such as airlines.

If stocks in these sectors which have high emissions output do not have carbon betas even relative to their own sectors, then the market may be saying that the companies are not vulnerable. For example, it may believe that utilities will simply be allowed to pass through emissions taxes to their customers, and therefore the transition risk is not at the utilities but at the customers of the utilities.

calculate historical and trending carbon betas for large sample of stocks

Modify the bulk script to store results for a large (index scale) number of stocks in a postgresql database, so that we can get both the historical carbon betas and their trends (increasing or decreasing) for all the stocks in an index universe.

From this, we can find stocks to construct the BMG index factor and then determine, through studying their disclosures and #4, which ones should be part of the BMG index going forward based on their positive (Brown) and negative (Green) carbon betas and the trends in those betas (declining trend means they are becoming less sensitive and would more likely be excluded.)

statistical validation of the BMG factor

This is from pages 184 - 188 of the CARIMA paper, which shows these statistics to validate the BMG factor:
Screen Shot 2021-08-25 at 1 53 17 PM
Screen Shot 2021-08-25 at 1 53 03 PM

Please build scripts to calculate these statistcs for BMG and other factors in our data so we could see how good different ways of constructing BMG benchmarks are.

test using ESG funds as carbon risk factor

Test using ESG funds as carbon risk factor.

Do ESG funds (using their ETF's price histories) have significant carbon betas?

If so, could their returns minus market general index be used as the BMG factors?

error & data handling

Need to check the data that comes in and ensure that it doesn't fail, removes outliers and provides good output

get daily stock and run regressions for daily or monthly data

Modify get_stocks.py to add parameter to get daily data. By default it'll still get monthly data.

Modify get_regressions.py to add parameter to use daily data. By default the regressions will still be run for monthly data. If the daily data option is selected then the -i parameter will be for the number of days. By default the number of days is 730 days (24 months)

check regression results versus before

@mattbowler Could you please check the regression results? They're very different than when I ran them initially.

For example, this is the result of factor_regression.py for the stock CVX:

Screen Shot 2021-09-23 at 2 09 12 PM

Compare it to the results from #2 (comment)

Also the original bulk script is not working:

Screen Shot 2021-09-23 at 2 10 01 PM

We should get results similar to #3 (comment)

clean up code to remove error messages

There are error messages being printed by underlying packages. These are not impacting the results but need to be traced and fixed in case this causes issues down the line.

implement correlation, orthogonalize in python

Implement the R correlation script in python

It should calculate correlations and regressions with bond market and other Fama French factors

We should then use the significant regression coefficients to create orthogonalized series of the BMG

modify bulk_script.py to generate results for list of stocks

Modify the bulk_script.py to generate results for list of stocks.

It can be a list of stock tickers either in a CSV file or embedded in bulk_script.py as an array for now. (We'll eventually hook it up to a database and backend.)

The output can be the same as now, statistics for each stock separated by a header.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.