Spartan Trader 1

Accessing financial information from a remote database using SQL


Goal

By completing this homework you will learn how to retrieve financial information from different remote databases and visualize it in Excel


Context

source:memegenerator.net

"SPARTAN TRADER!" 
Your boss, Ms. Tess Tickertracker radiates intense self-satisfaction.
"I beg your pardon, Ms. Tickertracker....  Spartan what?"
"Spartan Trader! I have finally found a good name for our new robotrader.  No, it is not just 'good', it is EXCELLENT!  The Spartans are historically famous for being courageous risk-takers, laser-focused on their missions, and well-disciplined team players.  Our robotrader will be an embodiment of all that.  I am a GENIUS!"
"Do we have a robotrader at the firm?"
"Not yet, and this is where you enter in the picture. YOU will build our first prototype."
"Me? I am flattered by your confidence, but I have never built one before... I am not even sure that I..."
She cuts you off. "No worries! You are a magician with VBA, and I will be there to help you all along.  With my help you will build one in a matter of weeks. It will be BRILLIANT!"

At a later meeting, Ms. TickerTracker explains her plan. She wants to build the robotrader function by function, beginning with an ability to retrieve financial data.  The data is stored in several different tables in three different databases (HedgeTournamentAlpha, HedgeTournamentBeta, and HedgeTournamentGamma) in a RDBMS. This data model shows the structure of the databases. All three databases have the same structure, but might contain different data. Some tables might be empty. That is OK, too.


Requirements

  • At start the Spartan Trader activates the 'Dashboard' spreadsheet (now empty)
  • The user selects one of the three databases using toggle-buttons
  • The user requests the desired financial data by pressing regular buttons in a customized Excel ribbon. Retrievable data are: Stock market, Option market, and the SP500 index
  • Switching databases clears all visualized data and brings the user back to the dashboard.

The vLab contains a demo and shows examples, but not the whole homework.  From now on feel free to change labels, colors, fonts, positioning of the controls, variable names, control names, procedure names.... anything!  Provided that your Spartan Trader interface is reasonably polished, easily understandable by the grader and satisfies all requirements, the specifics are up to you.  The Spartan Trader is your app. You are the developer and the user. You build it the way you like it. You will use it in the Hedge Tournament.


Bug fixes

For some versions of VS, the Quit button might not work until you insert the following line above the "DisplayAlerts = false" line:
Globals.ThisWorkbook.Application.EnableEvents = False

Sometimes the LO does not format the dates in the first row correctly.  Just force the cell that misbehaves to assume the right format by adding at the end of the button code the following:
Globals.Markets.Range("B3").NumberFormat = "m/d/yyyy"
where B3 is the address of the misbehaving cell.