Spartan Trader - part 5 (H17)

Executing transactions: stocks and options

Goal

By completing this homework you will have implemented a manual stock and option trader workstation (the "Spartan Trader") that communicates with a remote exchange ("Athens") to execute trades.


Context

source:memegenerator.net

"Dearest, I trust this digital missive finds you in the pinnacle of health and spirits. I am writing to apprise you of my imminent absence from the workplace as I embark upon an OPULENT sojourn to the Amalfi Coast. This well-deserved hiatus from the arduous demands of my executive responsibilities will afford me the opportunity to luxuriate in the rejuvenating SPLENDOR of this Italian locale. Ta-ta!"
Ms. Tickertracker has gone on vacation.  Maybe you can take advantage of her absence and complete the trading functionality to the Spartan Trader before she gives you more requirements.
"I am on it, Boss" sigh you, thinking that if you complete the job quickly, you might even find time to start planning your own next vacation.


Requirements

Executing trades means to us posting a record that represents a trade to a transaction queue in a remote database.  A transaction queue is an append-only table, meaning that it accepts inserts from all Teams, but does not let you update or delete them. Trades are irreversible. Once you made them, you cannot take them back.
This installment of the Spartan Trader builds the full functionality for executing stock and option transactions and adds a few preview metrics. The homework

  • is cumulative, which means that it needs to do everything that the previous homework did
  • submits correct transactions (Buy, Sell, SellShort, CashDiv) for stocks to the Athens databases  (alpha, beta and gamma)
  • submits correct transactions (Buy, Sell, SellShort, X-Put and X-Call) for options to the Athens database.

To help you out with the typing, please find some of the code necessary to complete this assignment


Optional bug fix

the very last part of the video formats the date in the first row of the transaction table as mm/dd/yyyy. This will not cause errors down the line but for consistency please format it as mm/d/yyyy.


AI-generated explainer

I used ChatGPT o1 to create this optional explainer.