sql server - SQL questions for Stock Market App -


i'm creating stock market app using sql server (azure) stored procedures. i've read extensively on following issues still undecided appreciate feedback:

  1. prices in money or decimal(9, 2) or integer (requiring * or / 100)?
    note: apparently australian stock market uses integers better performance , when import seed data excel money datatype erroneously created value third digit after decimal point as people hate money datatype easier development @ least

  2. i have buyorders , sellorders table when matched creates row in contracts table. these tables normalized such contracts table contains buyorderid , sellorderid seems me security (i.e. tracking) worth negligible performance cost duplicate write columns in contracts table (i.e. stocksymbol, memberid).

at first, have precision requirements business, you'd consider @ least 4 digits after decimal point. when trade international stocks there crazy exchange rates involved. also, when start calculate portfolio's performance you'll lot of decimals
have consider biggest possible portfolio value 100k billions. not want impacted unpredictable inflation.

if customer fine 4 digits precision, ok "money" data type. 8 bytes.
if, reason, want better precision go decimal(p,s), might 13 bytes, in case of small numbers use 5 bytes.


Comments

Popular posts from this blog

Using django-mptt to get only the categories that have items -

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -