Giter VIP home page Giter VIP logo

tendenz's People

Contributors

clueed avatar dependabot[bot] avatar raphaelparr avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

oskarhulter

tendenz's Issues

Desktop responsiveness

This should be done after all features are implemented.

  • Make hero resize to desktop
  • Make background resize to desktop
  • Make navbar resize to desktop
  • Make cards resize to desktop
  • Make coming soon resize to desktop
  • Make footer resize to desktop

Web/feat: reverse optimistic fetch

  • rework fetch functionality to display the old/previous data until new data arrives
  • besides being necessary for the animation to work it also makes sense to have something to look at
  • maybe the loading state can still be displayed but without hiding/replacing the previous data
  • maybe this can be done just with swr by binding all results to one key.
  • If this is not possible then all query switches need to have loading state. Now with swr once a query configuration has been preloaded there is no change so it looks like the selection didn't work.
  • Preloading everything would solve this as well but I don't think it sustainable. Currently, there are already 20+ possible urls and it will only grow probably significantly.

Rework hero section

Hero section

  • remove the "objective insight" or at least make it smaller
    • it's too much to scroll and no info
    • put into navbar?
  • rework explanation texts
    • some can probably just link to wikipedia especially z-score
    • market cap can link to formula
  • mention explicitly that the table is the top 10

server/bug: dotenv

I moved dotenv to devDeps. But the code still imports it cause the backend jobs to crash.

The intention was to prevent issues because a .env should never be loaded in production. All variables should be declared in the environment, e.g., on fly.

2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]Worker for job "updateMarket" online undefined
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]Worker for job "updateMarket" had an error {
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]  err: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'dotenv' imported from /app/server/dist/jobs/updateMarket.js
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]      at new NodeError (node:internal/errors:405:5)
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]      at packageResolve (node:internal/modules/esm/resolve:781:9)
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]      at moduleResolve (node:internal/modules/esm/resolve:830:20)
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]      at defaultResolve (node:internal/modules/esm/resolve:1035:11)
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]      at DefaultModuleLoader.resolve (node:internal/modules/esm/loader:251:12)
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]      at DefaultModuleLoader.getModuleJob (node:internal/modules/esm/loader:140:32)
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]      at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:33)
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]      at link (node:internal/modules/esm/module_job:75:36) {
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]    code: 'ERR_MODULE_NOT_FOUND'
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]  }
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]}
2023-09-04T09:05:00Z app[1857933f4554e8] ams [info]Worker for job "updateMarket" exited with code 1 undefined

Rework coming soon section

Coming soon section needs to be finalized

Questions to answer

  • More/less example?
  • Sub-examples?

Todos

  • fix gradient
  • responsive font scaling (mobile should be huge list)

MVP v1 Feedback

Feedback

Holder issue for v1 feedback.

Questions

General

  • Do you understand what it does?
    • Why not? Explanation more obvious? Better wording? More detail?
  • Do you think this is useful? Will you come back?
    • Why not?
  • What could be improved?
  • (How much) for the existing feature set with more markets?

Specific

  • Which asset next?
  • Make market cap more transparent? Expose some setting?
  • More detail for on sigma like std, mean?
  • Does the yahoo link make sense?
  • What do you look up on yahoo? Would you like some of that to be on tendenz?

Handle splits

Current theory (needs research):
Polygon adjusts historical data for splits. This is why updateMarket was running today longer then it should - it wasn't a bug after all.

Depending on how frequent splits are this might be fine. For now it only delays sigma calculation by 12 * 500 / 60 = 100min which is fine. Eventually it makes sense to detect splits and only adjust those stock historically.

What is a problem on the other hand is that those historical priced are only available for 2 year while the dataset can include more. Thus, sigma calc should be limited to 2 year back as a temporary fix.

  • Check if updateMarket actually updates or just overrides everything.
  • Limit sigma calc to two years.

Server with market cap filter

Given the market cap filtering functionality introduced in #34 algorithmic market cap weighting is no longer necessary. Instead, stocks should be filter by abs(sigma) which needs to be added as a separate column (prisma can't perform abs on lookup).

Natural language dates

Dynamic date references

Every reference to time need to adjust to the date of the last data. So "yesterday" needs to change to "Friday" during the weekend.

  • create function to handle this globally
  • adjust title dynamically
  • adjust each stock card (yesterday's close price etc) dynamically

Web: handle color opacity correctly

  • Radix colors have been used ad-hoc, often neglecting the opacity parameter, leading to incorrect or missing opacity in color definitions.
  • Refer to this link: https://tailwindcss.com/docs/customizing-colors#using-css-variables for the correct approach, but note that implementing it universally could disrupt existing color configurations.
  • Consider maintaining two sets of variants for each class, one following the old approach and one using the new approach. Transition gradually to the new approach.
  • Optionally, rename old colors to something like bg-tomatoOld-5 and keep the new colors with their default names to facilitate the transition.

Yahoo finance link

Yahoo finance link

  • can probably go on the right of each card
  • I think a "stock market chart" icon is better then a link icon
  • show only on expand

Disconnecting prisma in jobs and dry runs

Because jobs are invoked with workers through Bree they do not benefit from a global prisma instance. Each worker being a separate process creates a separate instance whether it's defined as a global object or not.

This leads to prisma not disconnecting correctly and is instead just being killed after each run. Prisma documentation shows how to gracefully disconnect prisma:

import { PrismaClient } from '@prisma/client'

const prisma = new PrismaClient()
const emailService = new EmailService()

async function main() {
  const allUsers = await prisma.user.findMany()
  const emails = allUsers.map((x) => x.email)

  await emailService.send(emails, 'Hello!')
}

main()
  .then(async () => {
    await prisma.$disconnect()
  })
  .catch(async (e) => {
    console.error(e)
    await prisma.$disconnect()
    process.exit(1)
  })

https://www.prisma.io/docs/concepts/components/prisma-client/working-with-prismaclient/connection-management#calling-disconnect-explicitly

Because different jobs call the same function, specifically calcSigma, and will do so even more in the future, the sigma instances needs to be passed as arguments to all relevant function. Importing is not possible because each function doesn't know which jobs it's being called from.

Implementing this will involve all function which call prisma. It is a good opportunity to implement "dry runs" as prisma does not provide this functionality natively. Firstly, because it necessary to testing this exact implementation. Secondly, because it's a requirement for further development and an eventual staging backend server which does not mess up the main database.

Dry flags can be implemented like they already are in calcSigma only instead of just preventing db writes it should also print the intended behavior to console.

Todos

  • implement the above example in all jobs
  • pass prisma object through every function which needs it
  • remove global prisma and imports
  • pass dry flags through each function which writes to db
  • print useful information on dry writes

Adjust market cap tag given filter functionality

Given #34 it's no longer necessary to display market cap (all the time). Especially on mobile they don't really fit into the layout.

Try dropping them completely in "non-expanded" view on mobile and figure out what to do on desktop.

  1. display all the time
  2. display only on expanded

Handle already indexed non-equity assets classes

  • Current US stocks already include ETF, Funds and so on
  • These need to be treated separately.
  • There is a "type" provided by the ticker detail api already.
  • It should be added to the UsStocks table and updated the same way that "name" is.
  • It probably makes sense to copy all the data from the details api.
  • There are things like currency and market included as well. Maybe there are differences.
  • It be figured out how to handle separating the different assets classes, or if they should only have the label added but be in "one" table displayed to the user.
  • If they need to be in separate table on the backend too (when sigma is calculated) or whether filtering should be done dynamically.

It probably makes sense to look into the frontend stock type feature (It extracts common strings from names and presents them as labels like "Common Stock" or "Class A"). There is probably overlap in the types received from the API described above and the types extracted there. Most likely this should be logic and the backend which dynamically removes string from titles (and merges) them into the type from the API and a seperate key.

Countdown till next update

Countdown

Implement a countdown until the next (approximate) update.

  1. to communicate that information
  2. to encourage coming back

Requirements

  • Calculate hours left until 2am (?) on the next day
  • Account for trading days (for now just weekdays/non-weekdays)

Other

Can only house information/explanation of the fact that we're using delayed closing data which is only available on then next day.
Maybe come up with a nice explaination.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.