Portfolio allocation based on asset class and sector limits
Author: kbellare
Creation Date: 2/13/2016 2:20 PM
profile picture

kbellare

#1
I have a universe (data-set) of SP500 stocks and 20 ETFs representing other asset classes - bonds, alternatives and gold.

Is there a way to control position size and portfolio allocation by asset class and sector? For example, i want stocks to be <70% or portfolio, bonds <25% and rest alternatives/gold.
- Further, want to limit the stocks allocation so any 1 sector is < 20% of total portfolio.

How do i enforce portfolio allocation using either existing position sizers or other extensions in WL? Didn't see any suitable position sizer in the WL library but maybe i missed one.

thanks
Kiran
profile picture

Eugene

#2
You're right, canned solution does not exist.

Limiting the allocation so that any sector doesn't exceed a percentage of total portfolio may be possible if you a) count the number of entries in a sector in your strategy and b) indirectly control the position size per each matching Position group using Priority Adjustment PosSizer. This provides a handle on assigning a percent equity to various Position groups. However, this overrides the Priority property so you can not use it for other purposes.

An alternative is perhaps by using the Position Options PosSizer's ability to assign a % of equity via the .Tag property. Since your Strategy should track the number of entries, you need not to exceed the number of stocks (70% / set size for a stock position), bonds etc.

If nothing of that seems suitable, then consider building a custom PosSizer. Everything required to develop them can be found in our Wiki:

1. API Guide on how to Create a PosSizer: Wealth-Lab Version 6 (.NET) Development Guide
2. Home - MS123.PosSizers > Project Source (demo version)
3. Typical questions in the FAQ re: Extension/PosSizer development
profile picture

kbellare

#3
Thanks,

1) Is there a way to extract Symbol info on whether a symbol is a Stock or Bond ETF?
2) If not, is there a way to specify a list of ETF symbols (I'm trying to use conditional code such as below..)
- if (<list of 10 Bond ETFs>) LastPosition.Tag = 10; // 10% position size for ETFs

3) Is there a way in the strategy code to find out the total # and size of current Bond ETF positions? For example i'm trying this ..
for all positions {
if (position.symbol belongs to <Bond ETF List>), Bond position += Symbol's position size in $
}
BondPosition% = BondPosition/TotalEquity

Pl advise sample code for these ..
profile picture

Eugene

#4
1) Sure, you could program it if you find an external source of such classification data for ETFs. Here's a GICS-like example that doesn't work on ETFs: Get symbol data from Morningstar.com (sector, industry, code etc.)

2) Use any .NET collection, populate it with your ETFs manually, and look it up. Here's a very simple example to illustrate the idea as a downloadable strategy: ActiveTrader 2011-05 Inverse ETF switching system

EDIT: Came across this good example, see Cone's post #8 > Search across DataSets

3) Anytime you try to access things like "TotalEquity" in strategy code, you're sort of opening a can of worms. WealthScript is not designed for this. See if "Portfolio Equity Tracker" from the FAQ below serves your purpose: FAQ > How to display portfolio equity (exposure, drawdown etc.) series and/or access them in scripts? If not, you will have to resort to the custom PosSizer solution.