Writing to a CSV file with a trigger
This example demonstrates how to export data from MarketFeeder Pro to a text file using the "write to file" trigger action.
Please bear in mind that exporting proprietary market data, such as prices and volumes, for commercial purposes violates the Terms and Conditions of the BetFair Historical Data Licence!
MarketFeeder Pro has a built-in function of writing to a file, which you can use to export any piece of data, an expression, a trigger variable of a combination of thereof to a text file of your choice.
In this example, we will be writing down BetFair Starting Prices (SP) for selections within the specified price range. We will then learn to open that file in Excel to view and analyse the results.
There are just two constants in this file, and they are needed to filter out selections by their SP. The constants are used for the sake of example only, just to reduce the size of the end file.
min_sp : Minimum SP of qualifyng selections;
max_sp : Maximum SP of qualifying selections.
So let's take a look at the triggers:
Here we have two triggers:
1. writing headers at the beginning of the file
You can run this trigger to make your data look like a table with headers. At the beginning of your session, it will write the headers "MarketName", "SelectionName" and "SP" into the file at the provided path (in this case, d:\sp_prices.csv). Note that it has the option "Rewrite existing contents" ticked, i.e. it first empties the contents of the file (if there were any). You can disable this trigger if you do not need headers or if you do not want the file to be rewritten each time you restart the triggers.
2. writing to a file
Here the trigger actually writes the name of the market, the name of the qualifying selection and its SP to the specified file. The values are separated with commas, the text variables (market_name and sel_name) are enclosed in double quotes to keep spaces inside them.
If you run the triggers against a few markets, you will get something similar to this:
Importing to Excel
Open Excel and switch to the Data tab. Go through the steps illustrated below, each time pressing "Next" until you get to the last screen.