Blog

Posts written in November 2024.

  • Published on
    -
    1 min read

    GatsbyJS Plugin: Smoothscroll with Offset

    I've been using the gatsby-plugin-smoothscroll plugin in the majority of GatsbyJS builds to provide a nice smooth scrolling effect to a HTML element on a page. Unfortunately, it lacked the capability of providing an offset scroll to position, which is useful when a site has a fixed header or navigation.

    I decided to take the gatsby-plugin-smoothscroll plugin and simplify it so that it would not require a dependency on polyfilled smooth scrolling as this is native to most modern browsers. The plugin just contains a helper function that can be added to any onClick event with or without an offset parameter.

    Usage

    The plugin contains a smoothScrollTo helper function that can be imported onto the page:

    // This could be in your `pages/index.js` file.
    
    import smoothScrollTo from "gatsby-plugin-smoothscroll-offset";
    

    The smoothScrollTo function can then be used within an onClick event handler:

    <!-- Without offset -->
    <button onClick={() => smoothScrollTo("#some-id")}>My link without offset</button>
    
    <!-- With offset of 80px -->
    <button onClick={() => smoothScrollTo("#some-id", 80)}>My link with offset</button>
    

    Demo

    A demonstration of the plugin in use can be found by navigating to my Blog Archive page and clicking on any of the category links.

    Prior to this plugin, the category list header would be covered by the sticky navigation.

    Smooth Scrolling without Offset

    Now that an offset of 80px can be set, the category list header is now visible.

    Smooth Scrolling with Offset

    Links

  • Published on
    -
    4 min read

    In-Specie Transfer From Freetrade To Trading 212

    I woke up yesterday morning to a serendipitous discovery that all my stock positions had successfully been transferred from Freetrade to Trading 212. There really is nothing more rewarding than seeing all investments under one stockbroker with a nice five-figure number staring back at you.

    Since I started investing in stocks at the start of 2022, the only stock broker app that was available to me was Freetrade and it made my introduction to making investments into hand-picked stocks very straight-forward. But as my portfolio grew, so did my requirements and when Trading 212 opened its doors to new sign-ups (after being on a very long waiting list), I decided to see if the grass was truly greener on the other side... and it was.

    Trading 212 had what Freetrade didn't:

    • An active community of like-minded users commenting on their views and insights against each stock.
    • 5.2% (as of today 5.17%) interest on held cash.
    • Introduction of a Cash ISA.
    • Ability to view stock graphs in detailed view with the ability to annotate specific trendlines.
    • Free use of the use of a Stocks and Shares ISA.
    • Lower FX rates.
    • Fractional shares on ETFs.

    Unfortunately for Freetrade, I just couldn't see a future where they could provide the features I needed in addition to free use of the service. I was being charged £60 per year for the privilege of a Stocks and Shares ISA - free on Trading 212.

    Even though I explored Trading 212 when it became available last year, I made a decision to only start investing at the start of the 2024 tax year to avoid any ISA-related tax implications by utilising two Stocks and Shares (S&S) ISAs. This is now a void issue as you are able to invest in two different S&S ISAs as long as you do not exceed the yearly £20k limit.

    Planning The Move

    I am currently seven months into using Trading 212 for investing but it was only until October I felt I was in a position to transfer all my stock holding from Freetrade. Why such a long wait?

    The wait was primarily due to not really understanding the correct route to transferring my portfolio without eating into my current years tax free allocation, whilst retaining the average stock price per holding. I also had concerns over the large sum of money to transfer and it's something that shouldn't be taken lightly.

    I am hoping this post will provide some clarity through my experience in transferring my portfolio to Trading 212, even if it is tailored more towards what I experienced in moving away from Freetrade.

    In-Specie Transfer

    In-specie wasn't a term I was familiar with prior to researching how I could move my stock portfolio to another platform.

    'In specie' is a Latin term meaning 'in the actual form'. Transferring an asset 'in specie' means to transfer the ownership of that asset from one person/company/entity to another person/company/entity in its current form, that is without the need to convert the asset to cash.

    Before in-specie transfers, the only way to move from one stock broker to another was to sell all your holdings as cash to then reinvest again within the new brokerage. The main disadvantages of doing this is:

    • Time out of the market creating more risk to price fluctuations.
    • Potential loss due to the difference between the sell and buy prices.
    • Additional brokerage fees when repurchasing the same assets with a new provider.
    • Loss of tax efficiency if you have a large portfolio that might wipe out or exceed the yearly tax-free allocation.
    • Missed dividend payouts.
    • Taking losses on selling stocks that haven't made a profit.

    I've noticed over the last couple of years in-specie transfers have become more universally supported amongst the smaller stock brokers (the ones you and I are more likely to use) such as Freetrade, Trading 212 and InvestEngine, which makes moving from one platform to another a much simpler process.

    Even though the process has become simpler, it is still a time-consuming process as transfer completion can take anywhere between 4-6 weeks based on the coordination between both stock platforms.

    My In-Specie Transfer Timeline

    My own in-specie transfer had taken a little longer than I hoped - around six weeks with the key milestones dated below.

    12/10/24

    Initiated the transfer process in Trading 212 by selecting the stocks I wanted to transfer. You can select specific stocks or your whole portfolio. I based my transfer on selecting all my holdings and specifying the average stock price as I want to retain my position.

    23/10/24

    Freetrade emailed to confirm a transfer request has been received and to confirm that my portfolio is in order to allow the process to move smoothly, which entailed:

    • Adding £17 fee per each US holding in my account.
    • Rounding up any fractional shares. - Shares in their fractional state cannot be transferred. For one of my stock holdings, I decided to purchase slightly more and round up the total value rather than sell down as this stock in particular is in the negative.

    12/11/24

    Three weeks had passed and I hadn't heard anything from either party. I contacted Trading 212 support to report a delay in transfer and if any reason could be provided for this. I didn't get a reply, but the next day, things started ticking along. Maybe this gave them the 'kick' they needed?

    13/11/24

    Trading 212 completed arrangements with Freetrade and they were now in a position to start the actual transfer that will be over the course of a two week period.

    21/11/24

    I woke up to find all stocks had been transferred whilst maintaining my average stock price. There is still one minor job awaiting completion: transfer of a small amount of cash. The most important job had been done and I could now rest easy.

    Next steps

    Once the small amount of cash has been transferred, I plan on cancelling my yearly Freetrade Standard plan expiring in June 2025. By the time the transfer has been completed, I will have an outstanding 6 months left on my subscription that I can get refunded (minus a £5 admin fee).

  • When developing custom forms in Umbraco using ASP.NET Core’s Tag Helpers and DataAnnotations, I noticed that display names and validation messages weren’t being rendered for any of the fields.

    [Required(ErrorMessage = "The 'First Name' field is required.")]
    [Display(Name = "First Name")]
    public string? FirstName { get; set; }
    
    [Required(ErrorMessage = "The 'Last Name' field is required.")]
    [Display(Name = "Last Name")]
    public string? LastName { get; set; }
    
    [Required(ErrorMessage = "The 'Email Address' field is required.")]
    [Display(Name = "Email Address")]
    public string? EmailAddress { get; set; }
    
    

    This was quite an odd issue that (if I'm honest!) took me quite some time to resolve as I followed my usual approach to building forms — an approach I’ve used many times in Umbraco without any issues. The only difference in this instance was that I was using an Umbraco form wrapper.

    @using (Html.BeginUmbracoForm<ContactFormController>("Submit"))
    {
        <fieldset>
            <!-- Form fields here -->
        </fieldset>
    }
    

    I must have been sitting under a rock as I have never come across this from the years working in Umbraco. It could be down to the fact that the forms I have developed in the past didn't rely so heavily on .NET's DataAnnotation attributes.

    The only solution available to remedy this problem was to install a Nuget package (currently in beta) that has kindly been created by Dryfort.com, which resolves the display name and validation attributes for in-form rendering.

    The Nuget package works in Umbraco 10 onwards. I've personally used it in version 13 without any problem. Until there is an official Umbraco fix, this does the job nicely and highly recommended if you encounter similar issues.