Expiration
flowchart TD
AA[validate inbound traffic IP address, and request payload] -->|success| A
AA -->|faliure| G[revert]
A[is 8AM UTC?] -->|yes| B["fetch last index price (Redis)"]
A -->|no| G
B -->|failure| CC[halt exchange]
subgraph S["Blocking MySQL process"]
CCC["fetch all user option positions (MySQL)"]
CCC -.-> C["calculate and update <code>realized_pnl</code> (MySQL)"]
C -.-> D[zero expired option position balance]
end
B -->|success| S
S -->|failure| CC
S -->|success| E["post event (BigQuery)"]