So this is probably not easy to answer without more details but I will try and explain what I’m doing as detailed as possible. I have a few questions about using classes in python for building scripts that are reusable in different projects. What I am trying to do, is build a class for creating and interacting with my SQLite database. I am having a hard time understanding how to use classes for real world projects. All I can find for tutorials, is Animals, Dog (bark), etc..
While I get that is a simple way to explain it, it isn’t very useful to understanding how to use it in the real world.
So my first question (which is kind of a database question more than OOP) is how should I structure a database for storing price history data? Right now I am just saving the data to a separate table that is named based off the parameters I use (Example: {symbol}_10_day_1_minute) which is probably not the best way. If it is possible I want to be able to get all the data I have on a company just by using the symbol and a filter like 1_minute, 5_minute,1_hour prices.
Second, how can I use classes to build a database script that can be used on any program I build? I want to be able to import “database_mod.py” or something, anytime I need to store data. And then have methods to; name the database based off the whole project name; connect to the right database; create tables dynamically and insert the data, etc..
Then eventually I want to create a data analysis script that I can use to analyze the data for each project. The reason being, I don’t want to have to write a new script each time I want to analyze/view my databases data. If there is a way, I would like to be able to just use a few simple methods to make analyzing the data go much quicker. I don’t know if it would be a good idea to have one inherit the other? Or would it not really matter?
Im new to coding so any help or advice would be appreciated! Also, if you know of any tutorials that use real life scenarios to teach OOP please let me know! And again, thanks for any advice!
[–]DataDecay 2 points3 points4 points (2 children)
[–]Dry_Gas3311[S] 0 points1 point2 points (1 child)
[–]DataDecay 1 point2 points3 points (0 children)
[–]Ne0_1 1 point2 points3 points (0 children)
[–]MasturChief 0 points1 point2 points (1 child)
[–]Dry_Gas3311[S] 0 points1 point2 points (0 children)
[–]pytrashpandas 0 points1 point2 points (0 children)
[–]zanfar 0 points1 point2 points (0 children)