This article shows you:
- How to use a downloader to create and populate a custom database (with earnings data for instance)
- How to access this data using the QuantShare language
Even though this article deals with earnings data, the same logic can be applied to any other custom data.
This downloader creates a custom database (earnings_cal), gets data from Rightline, parses it then saves it in your custom database.
Here is how to get historical earnings data:
- Go the following trading item page: Historical Earnings Calendar Data for U.S. Stocks - Date/Time and EPS
- Click on "Download" link (make sure you are logged in)
- Double click on the downloaded file to open QuantShare
- In QuantShare, click on "Download" in the new form then click on "Save Item"
- In the main menu, select "Download" then "Download Manager"
- Select "Earnings Calendar for US Stocks" item (the item you just downloaded)
- Click on "Open Selected Downloader"
- Select a start and end dates
- Click on "Start Downloading"
Display Earnings Calendar Data
To display the earnings data you have just downloaded:
- Select "Data" then "Edit Databases"
- Select "Custom" next to "Choose database"
- Select "earnings_cal" as database name
- Select a symbol under "Symbols" tab
You can export the data by clicking on "Export to CSV" button.
Plot Data on a Chart
- Open a chart, right click on it then select "Create a new pane"
- In the new pane, click on "Add Indicator" icon (first icon at the top of the pane)
- Select "Databases / Fields" tab
- Select "earnings_cal" database
- Select "eps" field (Earnings per share)
- Click on "OK"
Create a Trading System
Here is how to create a trading system based on the earnings calendar data.
This example will create a system that buys a stock when its earnings per share increases:
- Select "Analysis" then "Simulator"
- Click on "New" to create a new trading system
- Select "Create trading system using the formula editor"
- Type the following formula:
eps1 = GetData('earnings_cal', 'eps', Zero); // Get EPS Data
prevEPS1 = valuewhen(eps1 > 0, eps1, 2); // Previous EPS value
buy = eps1 > prevEPS1;
You can display buy signals on a chart, by right clicking on a pane, selecting "Edit Formula" then typing the above formula. You should also add the following line at the end of the formula:
plot(buy, "EPS Increase");