Skip to content

My transformation from an option vesting schedule to a plain text accounting journal

License

Notifications You must be signed in to change notification settings

pepijn/clojournal-recipe-option-vesting

Repository files navigation

clojournal-recipe-option-vesting https://circleci.com/gh/pepijn/clojournal-recipe-option-vesting.svg?style=svg

Prevent mistakes, save time, and gain insights by keeping track of your option vesting administration using proper tools. The recipe in this repository turns your vesting schedule into a Clojournal collection. That enables analysis through plain text accounting tools like ledger. The only thing you have to do is to transform your schedule, which you can get using tools like Carta, into a data structure like in the example below.

Example

Consider the example vesting schedule in the code below (also available in the examples/ directory of this repository).

(ns simple-example
  (:require [nl.epij.clojournal-recipe.option-vesting :refer [vesting-schedule->journal]]
            [nl.epij.clojournal-recipe.option-vesting.grant :as grant]
            [nl.epij.clojournal-recipe.option-vesting.period :as period]
            [com.clojournal.alpha.api :as c.api]))

(def vesting-schedule
  "Transform your vesting schedule (for example, from Carta) into a data structure like this one"
  [{::period/grant          {::grant/id               "PL-1337"
                             ::grant/price            "R$ 3.42"
                             ::grant/cliff            "P1Y" ;; 1 year
                             ::grant/issued-by        "Example Inc."
                             ::grant/underlying-asset "EXPL"}
    ::period/number         "1"
    ::period/status         ::period/exercised
    ::period/id             "PL-1337/1"
    ::period/date           "2017-12-15"
    ::period/options-vested 5000}

   {::period/grant          {::grant/id               "PL-1337"
                             ::grant/price            "R$ 3.42"
                             ::grant/cliff            "P1Y"
                             ::grant/issued-by        "Example Inc."
                             ::grant/underlying-asset "EXPL"}
    ::period/number         "2"
    ::period/status         ::period/exercised
    ::period/id             "PL-1337/2"
    ::period/date           "2017-12-17"
    ::period/options-vested 25}])

(-> vesting-schedule
    vesting-schedule->journal
    c.api/journal
    println)

We pipe this code into babashka and get a plain text accounting journal.

bb --classpath "$(clojure -Spath)" --file /dev/stdin <<EOF
$example_code
EOF
2016-12-15 * (PL-1337) Example Inc.
  (Off-Balance:Unvested Options:PL-1337)  EXPL 5025
  (Off-Balance:Unexercised Options:PL-1337)  EXPL 5025

2017-12-15 * (PL-1337/1) Example Inc.
  (Off-Balance:Unvested Options:PL-1337)  EXPL -5000
  Assets:Options  5000 "PL-1337" {R$ 3.42}
  Income  -5000 "PL-1337" {R$ 3.42}
  [Unrealized:Equity:Capital Requirement]  5000 "PL-1337" @ R$ 3.42
  [Unrealized:Liabilities:Exercise Provision]  -5000 "PL-1337" @ R$ 3.42
  [Unrealized:Assets:PL-1337]  EXPL 5000
  [Equity:Capital Gains Provision:PL-1337]  EXPL -5000

2017-12-17 * (PL-1337/2) Example Inc.
  (Off-Balance:Unvested Options:PL-1337)  EXPL -25
  Assets:Options  25 "PL-1337" {R$ 3.42}
  Income  -25 "PL-1337" {R$ 3.42}
  [Unrealized:Equity:Capital Requirement]  25 "PL-1337" @ R$ 3.42
  [Unrealized:Liabilities:Exercise Provision]  -25 "PL-1337" @ R$ 3.42
  [Unrealized:Assets:PL-1337]  EXPL 25
  [Equity:Capital Gains Provision:PL-1337]  EXPL -25

With the journal at hand we can do arbitrary queries using ledger. Below, we first add a stock valuation to the journal of $ 100. Then, we query the balance sheet and express the total value of the underlying stock in U.S. Dollar.

ledger --file - balance --exchange $ <<EOF
$example_ledger

commodity $
  format $ 1,000.00

P 2020-09-07 EXPL $ 100
EOF
        5025 PL-1337  Assets:Options
       $ -502,500.00  Equity:Capital Gains Provision:PL-1337
       -5025 PL-1337  Income
        $ 502,500.00  Off-Balance:Unexercised Options:PL-1337
        $ 502,500.00  Unrealized
        $ 502,500.00    Assets:PL-1337
        5025 PL-1337    Equity:Capital Requirement
       -5025 PL-1337    Liabilities:Exercise Provision
--------------------
        $ 502,500.00

Now, try a register query, check lot prices, include this journal into other journals, add valuations through price DBs, and exchange the unrealized gains to fiat currencies.

Contributing

I’m not an accountant so take the book account decisions with a grain of salt! That said, I’d love to see PRs where you challenge these decisions.

About

My transformation from an option vesting schedule to a plain text accounting journal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published