You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Breaking this out into a new issue for clarity, but this is highly related to #1615 and could be implemented alongside it.
In the Maybe app, we fetch stock prices from a stock price provider (currently Synth, but could be any). The Maybe app's assumption is that whatever provider we fetch from will present us with stock prices adjusted for stock splits. This is industry-standard and how most (or all) stock APIs work.
How Maybe stores prices
For net worth calculations, graphs, and other metrics, Maybe must have stock prices loaded to the DB in order to efficiently join the tables, combine results, and report them.
Because of this, it is required that we store stock prices in the database (and preload as #1615 describes).
Issue: Cached prices don't reflect new splits
Given the following scenario:
Maybe fetches stock XYZ, and loads 2 years of historical prices
A month passes, Maybe continues to load in new daily rates
Stock XYZ has a 2:1 split
Maybe continues fetching daily prices
In this scenario, Maybe is incorrectly presenting all historical prices prior to the split. For example, a price 1 year ago would need to be divided by 2 to adjust it for the split.
The table below shows an example of how splits affect price, and illustrates how Maybe's DB becomes "stale" for a given stock after a split:
Year
Unadjusted Price
Stock Split
Adjusted Price
Formula
2010
$10.00
$2.50
=10/2/2
2011
$11.00
$2.75
=11/2/2
2012
$12.00
$3.00
=12/2/2
2013
$6.00
2:1
$3.00
=6/2
2014
$7.00
$3.50
=7/2
2015
$8.00
$4.00
=8/2
2016
$9.00
$4.50
=9/2
2017
$10.00
$5.00
=10/2
2018
$12.00
$6.00
=12/2
2019
$15.00
$7.50
=15/2
2020
$20.00
$10.00
=20/2
2021
$10.00
2:1
$10.00
=10
2022
$11.00
$11.00
=11
2023
$12.00
$12.00
=12
2024
$14.00
$14.00
=14
2025
$19.00
$19.00
=19
Solution: Refresh mechanism
Either periodically, or when alerted of a split, Maybe will need to refresh the entire history of a stock's prices. This ensures that we're consistently reporting results based on adjusted stock prices from the provider, not just the cached prices that have become stale in the Maybe DB.
The text was updated successfully, but these errors were encountered:
Breaking this out into a new issue for clarity, but this is highly related to #1615 and could be implemented alongside it.
In the Maybe app, we fetch stock prices from a stock price provider (currently Synth, but could be any). The Maybe app's assumption is that whatever provider we fetch from will present us with stock prices adjusted for stock splits. This is industry-standard and how most (or all) stock APIs work.
How Maybe stores prices
For net worth calculations, graphs, and other metrics, Maybe must have stock prices loaded to the DB in order to efficiently join the tables, combine results, and report them.
Because of this, it is required that we store stock prices in the database (and preload as #1615 describes).
Issue: Cached prices don't reflect new splits
Given the following scenario:
XYZ
, and loads 2 years of historical pricesXYZ
has a 2:1 splitIn this scenario, Maybe is incorrectly presenting all historical prices prior to the split. For example, a price 1 year ago would need to be divided by 2 to adjust it for the split.
The table below shows an example of how splits affect price, and illustrates how Maybe's DB becomes "stale" for a given stock after a split:
Solution: Refresh mechanism
Either periodically, or when alerted of a split, Maybe will need to refresh the entire history of a stock's prices. This ensures that we're consistently reporting results based on adjusted stock prices from the provider, not just the cached prices that have become stale in the Maybe DB.
The text was updated successfully, but these errors were encountered: