Simplest Market Simulator on T-SQL

Ten hours of rash and the simplest market simulator is ready! Gracefully composes buy/sell commands list by trend events and perfectly calculates total return of fund, Sharpe ratio and other statistical parameters.

This is an example of a task it helps to accomplish:

If to define event as the stock price drops below $7.00, buy the same day 100 shares of the equity and sell them 5 days after (expecting recover), then what would be total return and the Sharpe ratio of the fund?

Data used is downloaded from Yahoo, for historical periods 2008 and 2009.

Simplest Market Simulator T-SQL code

P.S. The code unexpectedly works faster than Python version of the same algorithm (on Pandas).


About fdtki

Sr. BI Developer | An accomplished, quality-driven IT professional with over 16 years of experience in design, development and implementation of business requirements as a Microsoft SQL Server 6.5-2014 | Tabular/DAX | SSAS/MDX | Certified Tableau designer
This entry was posted in Data to Knowledge, programming and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s