clueed / tendenz Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://tendenz.vercel.app
License: Other
Home Page: https://tendenz.vercel.app
License: Other
This should be done after all features are implemented.
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
Holder issue for v1 feedback.
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.
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).
Every reference to time need to adjust to the date of the last data. So "yesterday" needs to change to "Friday" during the weekend.
bg-tomatoOld-5
and keep the new colors with their default names to facilitate the transition.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)
})
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.
Takes into consideration holidays in advance.
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.
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.
Implement a countdown until the next (approximate) update.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.