You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SeunghyunDKim edited this page Feb 11, 2021
·
7 revisions
Sequence diagrams
Buy and sell routes
@startuml
actor client as C
participant server as S
database Database as DB
C->S: /api/trading/{buy,sell} of stock S at price P
group if market currently open
S->S: get cur_price of S & current portfolio balance
group if (sufficient funds / stocks) && (cur_price ACCEPTABLE (w.r.t P))
S->DB: start TXN
S->DB: update client portfolio
S->DB: insert new trade & end TXN
DB-->S: OK
S-->C: return updated portfolio
else otherwise
S-->C: failed
end
else otherwise
S-->C: failed - market closed
end
@enduml
User Authentication
@startuml
actor client as C
participant server as S
database Database as DB
group if user not logged in
C->S: POST /auth/register Register for new user
group if username / email does not already exist
S->S: Hash password using bcrypt.hash
S->DB: Store username / email / hashed_password into DB
DB->S: OK
S->S: Login a uer / Get Cookies for session
else otherwise
S->S: failed
end
C->S: POST /auth/login Login a user
group if username / password combination is correct
S->S: Login a user / Get Cookies for session
else otherwise
S->S: failed
end
else otherwise
C->S: POST /auth/logout Logout a user
S->S: Logout a user / Remove Cookies for session
end
@enduml