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
Wilson Jusuf edited this page Jan 29, 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