Alejandro Erickson
Software Developer at Copperleaf Technologies
flickr/ geoburst/ youtube/ instructables/ facebook/ linkedin/

This year I set out to learn about investing and trading on the stock market. I signed up for a practice account on Questrade which comes with a healthy supply of fake cash and started making pretend trades. Pretty soon I realized that I needed a written comprehensive plan, complete with a strategy and specific shares that I want in my portfolio. Google spreadsheets to the rescue!

I found a spreadsheet that serves as a starting point on Dough Roller and added support for multiple accounts and account types.

The spreadsheet provides a summary of your holdings by account type and asset type, where you can also view the difference between your portfolio allocation and your target allocation.

Account Balances by Asset Type.

Account Balances by Asset Type.

Below the account summary there is also a visual representation of your target and actual allocations.

Porfolio Target and Actual Allocation.

Porfolio Target and Actual Allocation.

Actual holdings are specified on the holdings page by giving a ticker symbol and number of shares owned.

Portfolio Share Holdings.

Portfolio Share Holdings.

Anything and everything in my blog post could be factually incorrect. Please verify any information you get here with other, more reliable sources and check my math. If you see a problem please let me know in the comments.

Enjoy!


Canada offers a registered account to incentivise people to invest in their childrens’ education. It’s a bit complicated and most blogs and news articles I found only offer this very basic advice: “take advantage of the free money”. It’s not that bloody simple though.

Anything and everything in my blog post could be factually incorrect. Please verify any information you get here with other, more reliable sources. If you see a problem please let me know in the comments.

At a basic level the RESP works as follows: You incrementally add after-tax money to an account, to a maximum of $50,000.00, and the Government matches your yearly contributions with 20% each year, to a maximum of $7,200.00. You invest this money aggressively early on, and less aggressively later, while it is sheltered from taxes. When the beneficiary, usually your child, attends a post-secondary they can receive money from the gains made by the investment, as well as from the grant itself, and pay tax on the money as if it were the beneficiary’s income.

The details, provided by the Canada Revenue Agency, get complicated though, which makes it hard to answer a number of questions without breaking out the spreadsheets.

  • How big will the investment be, after tax, if the beneficiary does not use the money?
  • If you have $50,000 when you open the account, should you dump it all into the RESP, or take advantage of the grant and make several payments over several years?

These questions pertain to how the money is paid out, so let me define those ways. An EAP is a payment from the gains on the whole investment (grants and gains) made to the beneficiary who is enrolled in a qualifying educational program. EAPs are taxed as the beneficiary’s income.

An AIP is a payment from the gains on the contributions to the subscribers (who originally made the contributions). Grant money cannot be paid to the subscribers, and it is lost if the beneficiary does not use it. The original contributions were made by subscribers with after-tax money, so they are paid out without additional taxation. AIPs are taxed as the subscriber’s income plus 20% (12% in Quebec).

Obviously there could be a significant difference in taxation between EAPs and AIPs, so you need to consider the chance that AIPs will be paid out instead of EAPs, and how much that will cost you. An additional, hidden cost, is that in a normal taxable account, capital gains and dividends are taxed at a lower rate than regular income. Let me illustrate this with a simplified example.

Let’s say you invest $10,000.00 for 10 years and it grows to $15,000.00. You sell the investment in year 10 and declare $5000.00 in capital gains. Suppose further that your combined federal and provincial income tax marginal rate is 32% and your capital gains are taxed at 16%. Your beneficiary’s income tax marginal rate is 21%.

  1. If the $5,000.00 gains are paid as EAPs, the beneficiary pays $1,050.00 in tax.
  2. If the $5,000.00 gains are paid as AIPs, the subscriber pays $2,600.00 in tax.
  3. If the $5,000.00 gains are paid as capital gains, the account holder pays $800.00.

The 20% penalty against AIPs is huge, of course, but the difference between investing in a taxable account and getting EAPs is more subtle. Many investments pay dividends, which are taxed a bit more heavily than the capital gains mentioned in (3), plus the RESP account in (1) may have accumulated some additional grant money. Let’s consider that situation. Suppose the RESP also earned the full 20% grant on the $10,000.00 in contributions, and that the investment included some dividends that were taxed at 25%. Again, we are simplifying things.

  1. There are $5,000.00 gains and $2,000.00 in grants to be paid as EAPs. The beneficiary receives $5,530.00 and pays $1,470.00 in tax.
  2. If the $5,000.00 gains are paid as AIPs, the subscriber receives $2,400.00 and pays $2,600.00 in tax.
  3. If the $4,000.00 gains are paid as capital gains and $1,000.00 are paid as dividends, the account holder receives $4,120.00 and pays $880.00 in tax.

As expected, the AIP payments remain the same, but the EAPs now yield a 34% improvement on the gains in a normal taxable account. Of course, this is still a bit too simple. Firstly, the $10,000 cannot be contributed to the RESP all at once if the $2,000.00 in grants are to be obtained. That means that for some of the time, that original $10,000.00 sits in a taxable account. Secondly, only up to $36,000.00 of the RESP benefits from a 20% grant, because of the $7,200.00 limit on the total grant, so we can’t apply the same logic to a $50,000.00 RESP account.

We’ll need a spreadsheet to finish this

We are considering four ways of investing $50,000.00.

  1. Contribute the $50,000.00 to the RESP and get a $500.00 grant.
  2. Split the $50,000.00 over the RESP and a taxable account, and gradually move the money to the RESP to maximize the $7,200.00 grant.
  3. Put the $50,000.00 in a taxable account.
  4. Maximize the grant, but keep the remaining money in the taxable account.

And we are considering three ways the investment growth and grants can be taxed.

  1. Grants and investment growth are paid out as EAPs, taxed as the beneficiary’s income.
  2. Grants are lost, but investment growth is paid out as AIPs (after the beneficiary turns 21), taxed as the subscriber’s income.
  3. There are no grants, and the investments can be paid out any time, taxed as investment growth (capital gains, dividends, interest, etc).

We don’t know in advance whether we’ll have EAPs and not AIPs, so we factor the likelihood into our assumptions. We need to make a bunch of assumptions, in fact so let’s make them.

Assumptions:

  • 6% growth (mostly stocks) for 10 years, then tapering off to 3% (mostly bonds) for the final years.
  • The money is tallied when the child is 21, the earliest year AIPs can be paid. Realistically the EAPs will be paid earlier.
  • The subscriber’s family income is over 90k (if not, the grant gets paid a bit more aggressively).
  • Subscriber marginal rate is 32%.
  • Beneficiary marginal rate is 21%.
  • Avg investment tax is 20%.
  • Likelihood that EAPs are NOT needed is 20% (child gets scholarships, dies, drops out of school, whatever).

The first eight bars plot the investment proceeds that would be paid out as AIPs, or as EAPs combined with whatever non RESP money exists in each investment method, after tax. The last four bars plot the expected value of the investments based on our assumptions above. The assumptions can be changed in the spreadsheet.

Play around with the spreadsheet here.

RESP Returns by Investment Method.

RESP Returns by Investment Method.

And the winner is… maximize the grant and keep the rest of your money out of the RESP!

Remarks: The definition of qualifying educational program is fairly broad and inclusive, so if the beneficiary is alive, half-serious about any sort of educational program and doesn’t have a scholarship, they will probably use the grant. Note also that some of the provinces offer an additional grant. For example BC offers another $1,200.00 or so when the Child turns 6.

If you find any mistakes or oversights in my calculations or spreadsheet, please let me know in the comments!

Enjoy (taxes).


This modestly elaborate Property Investment Comparison Spreadsheet calculates cash flows, investment returns, equity, and other financial effects of an investment property. I am not an expert in financial math and I do not guarantee any sanity in the calculations.

Property Investment Comparison Spreadsheet

Property Investment Comparison Spreadsheet.

Get the latest version here: Property Investment Comparison Spreadsheet

Please! Comment below to tell me how this has been useful to you, and give me your feedback. Happy investing :)


I am replacing a few parts around the gooseneck of my Newport 30 Mark 2 (a.k.a. N30ii, Newport 30 mkii, Newport 30-2, and the Gary Mull design) and will be logging information about that here. My boat has fairly good maintenance records and as far as I know all this stuff is original to the Newport 30-2.

The main motivation is that the gooseneck slider is bent, and may be cracked, but it’s hard to replace one part without either spending a lot of effort and/or money, or replacing the parts around it too. I want to avoid having too many patchwork upgrades, so I’m also going to replace the toggle, and maybe the boom end cap along with it.

Half the battle is identifying what I have, and so, in hopes of helping other Newport 30-2 owners, I have documented my measurements of the gooseneck assembly here.

Gooseneck Slider Height

Gooseneck slider height 4 1/2in.

Gooseneck Slider Depth

Gooseneck Slider Depth approx 2in.

Gooseneck Slider Toggle Height

Gooseneck slider maximum toggle height approx 1 1/4in.

Slider Track Width

Slider track width 1 7/16in or 1 1/2in.

Slider Track Depth/Thickness

Slider Track Depth/Thickness 1/4in.

There is a sheave for the topping lift that comes into the boom on the bottom at 2 3/4” from the end. That limits how deep the end cap can be.

Related is the spar section, of which I took a few measurements and pictures as well.

Spar Section Outside Height

Spar section outside height 4 7/16in.

Spar Section Outside Width

Spar section outside width 3 1/8in.

Spar Section Inside Width

Spar section inside width 2 7/8in.

In addition to photographing direct measurements, I traced the spar section and labeled it. The drawing is done on metric graph paper, where each square is 0.5cm. All measurements are written into the figure, including the following:

  • The sail track’s inside diameter is 3/4in,
  • The sail track’s outside diameter is 3/4in,
  • The sail track’s outside height is 13/16in,
  • All walls are 1/8in,
  • The screw holes appear to be 1/8in and 3/16in.
Spar Section Sketch

Spar Section Sketch.

The end cap that fits onto the spar section appears to be made of the same cast aluminum alloy that the gooseneck slider is made of. Bolted into that is either a chromed brass or stainless steel toggle-and-bolt assembly, which I have thus far found impossible to remove (have not tried heat yet). The end cap came off rather easily once I removed the 4 screws holding it down, including those passing through cheek blocks (don’t overlook them like I did!) and applying heat with a regular propane blow torch on a cold day. Rather than prying under the lip of the end cap, I tapped with a lead cannon ball on a long wrench passed through a gap in the cheek of the boom.

End Cap Inside

End cap inside.

End Cap Profile

End cap profile.

End Cap Front

End cap front.

End Cap Top

End cap top.

From this point forward I didn’t have my trusty analog imperial caliper handy, so the rest of the measurements are either metric, or decimal imperial.

I also traced the end cap fitting onto the metric graph paper, and sketched the lip and sail track parts. The measurements are written into the figure, including the following:

  • End cap fitting width 7.0cm (2.880in)
  • End cap fitting min height 8.3cm (3.532in)
  • End cap fitting max height approx 3.79-3.81in
  • End cap fitting dpeth 1.677in
End Cap Fitting Sketch

End cap fitting sketch.

A vertical toggle pin attaches the gooseneck slider to the gooseneck toggle, and the toggle attaches via eye-bolt pin to an eye-bolt made fast to the end cap. The bolt appears to be seized with adhesive, as well as held on with a lock washer and nut and perhaps lock-tite.

  • Toggle pin diameter max approx 0.3in
  • Eye-bolt pin diameter 0.369in
  • Eye-bolt pin length 0.904
  • Toggle outside width (i.e., the distance the eye-bolt pin has to cover) 0.773, inside 0.471 (i.e., the distance that bounds the width of the eye)
  • Eye-bolt flange diameter 1.184
  • Eye-bolt diameter 0.39
  • Eye-bolt nut 0.675
  • Eye-bolt eye protrusion distance 1.387

Edit: Roverhi points out in a comment that it looks to be a LeFiell boom, and indeed LeFiell has one with the same spar section. Probably more to the point is that the existing gooseneck assembly is inadequate and likely not complete.

Here is a copy of their spar sections, taken from LeFiell’s old website and used without permission. It’s pretty clear to me that I won’t be getting any OEM parts for this, so we’ll have to see what’s next.

LeFiell Spar Sections

LeFiell Spar Sections


A little randomness can yield remarkably organic images. The JavaScript snippet below randomly assigns colours to pixels, row-by-row starting at the top, such that the colour is similar to that of other pixels close to it.

Try the Random Canvas generator yourself.

Remember: Each new image you generate has NEVER been created nor seen before. If you like it, then drag it to your desktop! If you make a really nice one, or if you like this, leave a comment.

Press the buttons to generate a new image. Drag images to your desktop to save.

your browser does not support the canvas tag

The JavaScript snippet

I conceived the idea and wrote the snippet in 2012 and both are released under a CC 3.0 Attribution Non-Commercial license.

function newDrawing(cwidth,cheight){
    var c=document.getElementById("myCanvas");
    var ctx=c.getContext("2d");
    var id=ctx.createImageData(cwidth,cheight);
    
    var i,iw4 = id.width*4, iw2 = id.width*2, iw = id.width;
    id.data[0]=Math.random()*255;
    id.data[1]=Math.random()*255;
    id.data[2]=Math.random()*255;
    id.data[3]=255;
    var dir,mv;
    var j;

    //change this to change the amount you move in each colour
    var amount = 10;
    
    for(i = 4; i < id.height*iw4;i+=4){
	//alpha
	id.data[i+3]=255;
	for(j=0;j<3;j++){
	    if(Math.random() <= 0.5){dir = -1;} else{ dir = 1;}
	    if(Math.random() > 0.95) mv = 1; else mv = 0;
	    id.data[i+j]= id.data[i+j-4] + amount*dir*mv;
	    //Math.max(0, Math.min( 255, id.data[i+j-4] + (0.5 + Math.random())*dir ) );
	    if(i>iw4+4){
		if(i%iw2 > iw || Math.random() > 0.6){
		    id.data[i+j] = ( id.data[i+j]+ id.data[i+j-iw4+4]+ id.data[i+j-iw4-4]+ id.data[i+j-iw4])/4 + Math.random() - 0.5;
		}
		else
		{
		    id.data[i+j] = ( id.data[i+j]+ id.data[i+j-iw4+4]+ id.data[i+j-iw4-4]+ id.data[i+j-iw4-4])/4 + Math.random() - 0.5;
		}

	    } else if(i >= iw2+iw && i < iw4 && Math.random() > 0.99){ //in the first row we want to come back to the first colour
		id.data[i+j] = ((iw4-i)*id.data[i+j] + (i-iw2-iw)*id.data[j])/iw + Math.random() - 0.5;

	    }
	}
    }
    ctx.putImageData(id,0,0,0,0,cwidth,cheight);
    var img = c.toDataURL("image/png");
   // window.location = img;
    var imagepng = document.getElementById("image");
    imagepng.src = img;
    var button = document.getElementById("save");
    button.onclick = function () { window.location.href = imagepng.src.replace('image/png','image/octet-stream');};
}

How the Random Canvas works

Think of a digital image as a grid of pixels, and each pixel has a colour

Pixels

In this image, each pixel is a similar colour to the one that is left of it (or the rightmost one in the row above). How do we get similar colours?

Colours

To get from to we subtracted 2 from red, added 2 to green, and subtracted 2 from blue.

To get the whole image, we started by colouring the top left pixel and then we chose a similar colour for the next pixel by adding or subtracting a small amount of each colour, and so on , , , until we coloured all the pixels, row by row, ending with the last one at the bottom right .

We randomly decide whether to subtract or add a bit of red, blue and green, to make the next pixel a random colour similar to the last one.

But that isn’t quite the end of the story, is it. After all, the pixels generated by the buttons below are similar colours to the ones above and below themselves, not just beside. If we only did what I described, the results would look like this:

We fix this hideous behaviour by taking taking the average of two colours. After we have done the first row, we take our random choice of colour, and change it to the average of its own colour with that of the pixel in the row above.

Pixels average

We are almost done! You might have noticed that there are some wavy patterns that can’t be created by merely taking the average with the pixel above. These are done by taking averages with pixels above left, or above right, depending on how far along the row we are. They are just details that don’t really change the main idea.