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:
prices in
moneyordecimal(9, 2)orinteger(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 @ leasti have
buyorders,sellorderstable when matched creates row incontractstable. these tables normalized suchcontractstable containsbuyorderid,sellorderidseems me security (i.e. tracking) worth negligible performance cost duplicate write columns incontractstable (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
Post a Comment