JudahSchwartz / RSUTaxCalculator

0 stars 0 forks source link

Determine the JSON request schema #1

Closed ShacharKidor closed 1 year ago

ShacharKidor commented 1 year ago

The purpose of the calculator is to be able to estimate the amount of money a user gets when selling his RSUs (after tax reductions).

Details we need to get from the user:

  1. Grant date.
  2. Grant amount.
  3. Monthly salary or tax rate - we can ask for the salary and estimate the tax rate in the code.
  4. Amount of stocks to sell.
  5. Selling date (default Today).

The output: The total gain of the user on the selling date, after taxes ("the Net amount").

Things we need to calculate: - Phase One

  1. Grant Price - we can calculate that based on the stock price on the grant date and the grant amount.

  2. The price of the Stock on the grant date (from google).

  3. The price of the stock today - we can get it from google (as for the stock price on the selling date - I think it would be hard to predict - we can keep it the same as today's price - and of course, we need to reflect it to the user).

  4. The total gain before taxes -("The gross amount") calculate based on the number of stocks to sell and the price of the stock today.

  5. Whether the selling date is two years after the grant date or not - affects the taxes calculation.

  6. Income tax - calculate according to the monthly salary - we can query the API of the Internal Revenue Service to get the relevant tax rate for the user's monthly salary. The reduction of the income tax depends on (4) - if the selling date is after two years from the grant date we will calculate the income tax reduction only on the following amount: Stock price on the grant date * number of stocks to sell. (need to verify that).

  7. Capital gains tax - the calc of this tax also depends on (4) - if the selling date is after two years from the grant date we will calculate the Capital gains tax only on the following amount: (Price of the Stock today - Price of the stock in the grant date) * Number of stocks to sell

Phase two:

  1. Calculate National insurance and health tax reductions.
  2. Calculate surtax reductions.
  3. Income tax calculation taking into account the previous sale of shares in the same year.
JudahSchwartz commented 1 year ago

Request JSON

{
    "grant_date" : "dd/mm/yyyy",
    "sale_date" : "dd/mm/yyyy",
    "sale_amount" : 20,
    "grant_amount" : 55,
    "stock_symbol" : "PANW",
    "tax_rate" : 37 | null,
    "monthly salary" : 10_000 | null

}
JudahSchwartz commented 1 year ago

Response JSON

{
    "gross_amount" : 10000,
    "net_amount" : 2000
    "tax_deductions" : [ 
        { 
            "effective_rate" : 37,
            "taxed_amount" : 2000,
            "amount" : 0,
            "reason" : "because ... "
        },
       { 
            "effective_rate" : 37,
            "taxed_amount" : 2000,
            "amount" : 0,
            "reason" : "because ... "
        },
    ]
}