Skip to content

Commit

Permalink
Features:
Browse files Browse the repository at this point in the history
	- Investing Factors Portfolio Financing Scheme (35, 36)
	- Investing Factors Portfolio Financing Scheme - Zero Investment (37)
	- Investing Factors Portfolio Financing Scheme - Zero Cost/Self (38, 39)
	- Investing Factors Factor Portfolio Shell (40, 41)
	- Portfolio Construction Core Block Hashcode (42, 43, 44)
	- Portfolio Construction Core Asset Hashcode (45, 46)
	- Factor Investing Component Loading Map (47, 48)
	- Investing Factors Factor Portfolio Country (49, 50)
	- Investing Factors Factor Portfolio Is Global (51, 52)
	- Investing Factors Factor Portfolio Financing Scheme (53, 54)
	- Investing Factors Factor Portfolio Country - Constructor (55, 56, 57)
	- Investing Factor Portfolio Builder Shell (58, 59)


Bug Fixes/Re-organization:

	- Special Function Incomplete Gamma Lower S Fixed Series - Weierstrass Limit (1, 2)
	- Special Function Incomplete Gamma Lower S Fixed Series - NIST 2019 Limit (3, 4, 5)
	- Special Function Incomplete Gamma Lower S Fixed (6, 7, 8)
	- Special Function Incomplete Gamma Lower S Fixed - Series (9)
	- Special Function Incomplete Gamma Lower S Fixed - Constructor (10, 11)
	- Special Function Incomplete Gamma Lower S Fixed - Weierstrass Limit #1 (12)
	- Special Function Incomplete Gamma Lower S Fixed - Non-dimensional (13)
	- Special Function Incomplete Gamma Lower S Fixed - Evaluate (14, 15)
	- Special Function Incomplete Gamma Lower S Fixed - Weierstrass Limit #2 (16, 17)
	- Special Function Incomplete Gamma Lower S Fixed - NIST 2019 (18, 19, 20)
	- Special Function Incomplete Gamma Lower Regularized (21, 22, 23)
	- Special Function Incomplete Gamma Lower Regularized - Constructor (24)
	- Special Function Incomplete Gamma Lower Regularized - p (25)
	- Special Function Incomplete Gamma Lower Regularized - Gauss Continued Fraction (26, 27)
	- Special Function Incomplete Gamma Lower Regularized - Euler Integral (28, 29)
	- Special Function Incomplete Gamma Lower Regularized - Weierstrass Limit (30, 31)
	- Special Function Incomplete Gamma Lower Regularized - NIST 2019 (32, 33)
	- Risk Factor Premium Migration Re-factoring (34)
	- Factor Portfolio Builder To Ranker (60)


Samples:

IdeaDRIP:
  • Loading branch information
Lakshmik committed Feb 27, 2024
1 parent 1636fa1 commit 38a8914
Show file tree
Hide file tree
Showing 13 changed files with 661 additions and 128 deletions.
39 changes: 39 additions & 0 deletions IdeaDRIP/FactorInvesting/FI_v0.01
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

Factor Investing
----------------
1) Security Characteristics - aka Factors: Size, Low-volatility, Value, Momentum, Asset growth, Profitability, Leverage, Liquidity, Term, Carry - DONE
2) Beta Tilt Direction - Towards (+ve), Away (-ve) - DONE
3) Risk Premia Category - Corporates, Govvies, Equity, Commodities - DONE
4) Value Factor - Difference between Intrinsic/Fundamental Value and Market Value
5) Value Factor Metrics - P/E Ratio, P/B Ratio, P/S Ratio, Dividend Yield
6) Low-volatility Factor - Portfolio acquires only low-volatility assets
7) Momentum Factor - High returns over past 3-12 months minus Low returns over past 3-12 months, Returns Horizon, Momentum Lag
8) Momentum Factor caused by seasonality (e.g., January effect)

Fama-French Three-Factor Model
------------------------------
1) Three Factors - Market Excess Return, Outperformance of Small versus Big Cap, Outperformance of High/low book-to-market (value)
2) Market Factor - PRESENT/ABSENT
3) Accounting Manipulation Proxy Factor - Replacement for the Value Factor
4) CAPM - Single Factor, i.e., Market Factor
5) Factor Component Loading - Weight, Returns, Category - DONE
6) Portfolio Type - Zero Investment or Zero Cost (Self Financing) - DONE
7) Factor Portfolio - Asset Map of Factor Component Loading, Country, Is Global, Portfolio Type - DONE
8) Factor Portfolio Builder - Factor Component Loading vs Score Ordered Map, Component Ranking Scheme, Re-ranked Components, Top List, Bottom List, Weight Sign
9) Factor - Code, Description, Factor Portfolio
10) Factor Model - Model Code, Model Description, Collection of Factors
11) Asset Factor Loading - Factor Returns, Factor, Asset Factor Beta
12) Factor Regressor - Asset Specification - DONE
13) Risk Free Setting - Instrument (Treasury/LIBOR/OIS/SOFR), Tenor (e.g., 3M), Rate
14) Factor Regressor Output - Collection of Asset Factor Loading, Factor Risk Free Premia, Alpha, Asset Returns, Asset Risk Premia
15) Factor Regressor Function - Apply Risk Free Setting to Factor Regressor to generate Factor Regressor Output
16) CAPM One-Factor Model - Market Factor
17) Fama-French Three-Factor Model - Market Factor, Size Factor, Value Factor
18) Mramor-Pahor Three-Factor Model - Market Factor, Size Factor, Accounting Manipulation Proxy Factor
19) Fama-French Five-Factor Model - Market Factor, Size Factor, Value Factor, Profitability Factor, Investing Factor

Carhart Four-Factor Model
------------------------------
1) Four Factors - Market Excess Return, Outperformance of Small versus Big Cap, Outperformance of High/low book-to-market (value), Momentum Factor
2) Market Portfolio Name - CRSP
3) MOM Portfolio Name - UMD 12M winners minus 12M losers
43 changes: 43 additions & 0 deletions ReleaseNotes/08_03_2023.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

Features:

- Investing Factors Portfolio Financing Scheme (35, 36)
- Investing Factors Portfolio Financing Scheme - Zero Investment (37)
- Investing Factors Portfolio Financing Scheme - Zero Cost/Self (38, 39)
- Investing Factors Factor Portfolio Shell (40, 41)
- Portfolio Construction Core Block Hashcode (42, 43, 44)
- Portfolio Construction Core Asset Hashcode (45, 46)
- Factor Investing Component Loading Map (47, 48)
- Investing Factors Factor Portfolio Country (49, 50)
- Investing Factors Factor Portfolio Is Global (51, 52)
- Investing Factors Factor Portfolio Financing Scheme (53, 54)
- Investing Factors Factor Portfolio Country - Constructor (55, 56, 57)
- Investing Factor Portfolio Builder Shell (58, 59)


Bug Fixes/Re-organization:

- Special Function Incomplete Gamma Lower S Fixed Series - Weierstrass Limit (1, 2)
- Special Function Incomplete Gamma Lower S Fixed Series - NIST 2019 Limit (3, 4, 5)
- Special Function Incomplete Gamma Lower S Fixed (6, 7, 8)
- Special Function Incomplete Gamma Lower S Fixed - Series (9)
- Special Function Incomplete Gamma Lower S Fixed - Constructor (10, 11)
- Special Function Incomplete Gamma Lower S Fixed - Weierstrass Limit #1 (12)
- Special Function Incomplete Gamma Lower S Fixed - Non-dimensional (13)
- Special Function Incomplete Gamma Lower S Fixed - Evaluate (14, 15)
- Special Function Incomplete Gamma Lower S Fixed - Weierstrass Limit #2 (16, 17)
- Special Function Incomplete Gamma Lower S Fixed - NIST 2019 (18, 19, 20)
- Special Function Incomplete Gamma Lower Regularized (21, 22, 23)
- Special Function Incomplete Gamma Lower Regularized - Constructor (24)
- Special Function Incomplete Gamma Lower Regularized - p (25)
- Special Function Incomplete Gamma Lower Regularized - Gauss Continued Fraction (26, 27)
- Special Function Incomplete Gamma Lower Regularized - Euler Integral (28, 29)
- Special Function Incomplete Gamma Lower Regularized - Weierstrass Limit (30, 31)
- Special Function Incomplete Gamma Lower Regularized - NIST 2019 (32, 33)
- Risk Factor Premium Migration Re-factoring (34)
- Factor Portfolio Builder To Ranker (60)


Samples:

IdeaDRIP:
Binary file modified ScheduleSheet.xlsx
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public class FactorComponentLoading
* @param weight Factor Weight
* @param returns Factor Returns
*
* @throws Exception Thriwn if the Inputs are Invalid
* @throws Exception Thrown if the Inputs are Invalid
*/

public FactorComponentLoading (
Expand All @@ -138,9 +138,7 @@ public FactorComponentLoading (
final double returns)
throws Exception
{
if (!NumberUtil.IsValid (_weight = weight) ||
!NumberUtil.IsValid (_returns = returns))
{
if (!NumberUtil.IsValid (_weight = weight) || !NumberUtil.IsValid (_returns = returns)) {
throw new Exception ("FactorComponentLoading Constructor => Invalid Inputs");
}

Expand Down
193 changes: 193 additions & 0 deletions src/main/java/org/drip/investing/factors/FactorPortfolio.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@

package org.drip.investing.factors;

import java.util.Map;

/*
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*/

/*!
* Copyright (C) 2024 Lakshmi Krishnamurthy
*
* This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics,
* asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment
* analytics, and portfolio construction analytics within and across fixed income, credit, commodity,
* equity, FX, and structured products. It also includes auxiliary libraries for algorithm support,
* numerical analysis, numerical optimization, spline builder, model validation, statistical learning,
* graph builder/navigator, and computational support.
*
* https://lakshmidrip.github.io/DROP/
*
* DROP is composed of three modules:
*
* - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/
* - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
* - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/
*
* DROP Product Core implements libraries for the following:
* - Fixed Income Analytics
* - Loan Analytics
* - Transaction Cost Analytics
*
* DROP Portfolio Core implements libraries for the following:
* - Asset Allocation Analytics
* - Asset Liability Management Analytics
* - Capital Estimation Analytics
* - Exposure Analytics
* - Margin Analytics
* - XVA Analytics
*
* DROP Computational Core implements libraries for the following:
* - Algorithm Support
* - Computation Support
* - Function Analysis
* - Graph Algorithm
* - Model Validation
* - Numerical Analysis
* - Numerical Optimizer
* - Spline Builder
* - Statistical Learning
*
* Documentation for DROP is Spread Over:
*
* - Main => https://lakshmidrip.github.io/DROP/
* - Wiki => https://github.com/lakshmiDRIP/DROP/wiki
* - GitHub => https://github.com/lakshmiDRIP/DROP
* - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md
* - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html
* - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
* - Release Versions => https://lakshmidrip.github.io/DROP/version.html
* - Community Credits => https://lakshmidrip.github.io/DROP/credits.html
* - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues
*
* 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.
*/

/**
* <i>FactorPortfolio</i> has the Portfolio Details that constitute a Factor. The References are:
*
* <br><br>
* <ul>
* <li>
* Baltussen, G., L. Swinkels, and P. van Vliet (2021): Global Factor Premiums <i>Journal of Financial
* Economics</i> <b>142 (3)</b> 1128-1154
* </li>
* <li>
* Blitz, D., and P. van Vliet (2007): The Volatility Effect: Lower Risk without Lower Return <i>Journal
* of Portfolio Management</i> <b>34 (1)</b> 102-113
* </li>
* <li>
* Fisher, G. S., R. Shah, and S. Titman (2017): Combining Value and Momentum
* <i>https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2472936</i> <b>eSSRN</b>
* </li>
* <li>
* Houweling, P., and J. van Zundert (2017): Factor Investing in the Corporate Bond Market <i>Financial
* Analysts Journal</i> <b>73 (2)</b> 100-115
* </li>
* <li>
* Wikipedia (2024): Factor Investing <i>https://en.wikipedia.org/wiki/Factor_investing</i>
* </li>
* </ul>
*
* <br><br>
* <ul>
* <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/PortfolioCore.md">Portfolio Core Module</a></li>
* <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/AssetAllocationAnalyticsLibrary.md">Asset Allocation Analytics</a></li>
* <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/investing/README.md">Factor/Style Based Quantitative Investing</a></li>
* <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/investing/factors/README.md">Factor Types, Characteristics, and Constitution</a></li>
* </ul>
*
* @author Lakshmi Krishnamurthy
*/

public class FactorPortfolio
{
private String _country = "";
private boolean _isGlobal = false;
private int _financingScheme = Integer.MIN_VALUE;
private Map<String, FactorComponentLoading> _factorComponentLoadingMap = null;

/**
* FactorPortfolio Constructor
*
* @param factorComponentLoadingMap Factor Component Loading Map
* @param country Country
* @param isGlobal TRUE - The Portfolio is Global
* @param financingScheme Financing Scheme
*
* @throws Exception Thrown if the Inputs are Invalid
*/

public FactorPortfolio (
final Map<String, FactorComponentLoading> factorComponentLoadingMap,
final String country,
final boolean isGlobal,
final int financingScheme)
throws Exception
{
if (null == (_factorComponentLoadingMap = factorComponentLoadingMap) ||
null == (_country = country) || _country.isEmpty())
{
throw new Exception ("FactorPortfolio Constructor => Invalid Inputs");
}

_isGlobal = isGlobal;
_financingScheme = financingScheme;
}

/**
* Retrieve the Factor Component Loading Map
*
* @return The Factor Component Loading Map
*/

public Map<String, FactorComponentLoading> factorComponentLoadingMap()
{
return _factorComponentLoadingMap;
}

/**
* Retrieve the Country
*
* @return The Country
*/

public String country()
{
return _country;
}

/**
* Indicate if the Portfolio is Global
*
* @return TRUE - The Portfolio is Global
*/

public boolean isGlobal()
{
return _isGlobal;
}

/**
* Retrieve the Financing Scheme
*
* @return The Financing Scheme
*/

public int financingScheme()
{
return _financingScheme;
}
}
Loading

0 comments on commit 38a8914

Please sign in to comment.