Comments (4)
The least flexible solution for part 2 is to simply have multiple tables for each interval. That way querying would be simply SELECT * from the right table with the right limits. But that will require storing duplicate data (not an issue because the storage will be small - if we assume the game lasts for 10 days running 6 hours each day, for interval of 1 minute we'll have about 6 x 60 x 10 = 3600
rows, and each row would store OHLC (Open High Low Close) integers, rowid, stockid, time and maybe something else that I'm missing. Overall each row will have 4 + 1 + 1
integers (4 bytes each) and a timestamp string (20 bytes). Overall each row will have 40-50 bytes. That's 180kb for one stock. If we have 30 stocks the space for the history will be only 5.4MB for 1min interval. With other intervals this could maybe grow to 20-30MB. That's not an issue at all.
The problem with that is that adding new intervals or something like that will be painful.
If we have only a single Stock history table querying becomes quite complex.
from dalal-street-server.
We can use a single table StockHistory
(or any other name) where we store the details of each stock at one minute intervals. Now, to get the stock history at every N minute intervals, we use the following query
SELECT * FROM StockHistory WHERE MOD(ID, N) = 0;
Thus, storing stock history in a single table at one minute intervals will suffice.
Note that this assumes there will be no deletions or rollbacks. But there won't be any in this case. So we can use the above query safely.
@Ar-Sibi @thakkarparth007
from dalal-street-server.
@Ar-Sibi we'll go ahead with this.
from dalal-street-server.
Fixed by #108
from dalal-street-server.
Related Issues (20)
- [ Registration ] Domain Filtering HOT 3
- [streams]: stocks owned not changing HOT 1
- [Registration] : Add browser fingerprint.
- [Feature]: Add forgot password option. HOT 1
- Leaderboard should Account for Reserved Assets HOT 1
- [Registration]: OTP Verification for Phone No HOT 2
- [Orders] : Cancel order HOT 1
- [Admin] : Create Admin Panel
- [Feature] : Bankruptcy
- [OTP] : Prevent BruteForce
- Remove hackynotif from login response HOT 1
- Detect cash funneling for admin panel
- Daily Leaderboard SQL Query
- [Transactions]: Add constraint for preventing short selling after some extent
- [Cheat]: New method for finding users who cheat
- [Admin Panel]: Add feature for adding/modifying/deleting stocks and also clearing a particular stock's exchange stocks
- [Portfolio]: Add features like showing average amount and amount invested per stock in portfolio page HOT 2
- [Matching engine]: refactor server matching engine
- [Admin Panel] Edit news from admin panel
- [dockerize] server
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dalal-street-server.