Page Capture

Page Capture Tutorial

For cases where the price for an asset cannot be directly retrieved from the quote provider (Yahoo! Finance), InvestControl provides an update method called "Page Capture", that allows it to extract asset prices from web pages using a "capture expression".

A capture expression is basically a piece of HTML code where the value/price can be extracted from, with the actual value replaced by special tag. At every update, InvestControl looks for that code inside the page and reads the value from the capture tag, updating the asset price.

The following is a common scenario where the asset price is located in a table with multiple assets:

1. Locate the web page where the asset price can be found. In this example, we're trying to extract the price for fund "KD BRIC".


2. In InvestControl, edit the asset, set Update Mode to "Page Capture", then tap the pencil button. You will be asked for the web page where to extract the price from. Inform the URL found in step 1. 

3. Start typing the fund name or its current price to locate where it appears in the HTML markup. 



4. Copy the piece of code surrounding the price to the expression field, then replace it with tag {price}. You can use the second button to select it from the list of special tags.

KD BRIC</td><td align="center">10.04.2012</td><td align="center">09.04.2012</td><td align="right">{price}</td>

There is one more detail: between the fund name and the price there are two dates that will always change. So we must tell InvestControl to match the expression regardless of what it finds in those places.

KD BRIC</td><td align="center">{any}</td><td align="center">{any}</td><td align="right">{price}</td>

Here, we use {any} to tell InvestControl to accept any text in that position. Other useful tags available include {symbol}" and {name}, which are replaced by the asset's symbol and name as entered in InvestControl (you can use them in the URL or in the capture expression).

5. If the expression is recognized correctly and you see the price highlighted in the code preview, you can close the screen and save the asset. If not, review the capture expression.

If the asset's current value is available in the page, you could mark it instead with {value} tag. Then InvestControl will calculate the price by dividing the extracted value by the current number of shares entered in the app.

Note: InvestControl will reuse the page data downloaded from a URL if the exact same URL is used by multiple assets. In the example above, you could extract prices for the other funds in the page without having to download it again. 

Note that Page Capture method is heavily dependent on the page layout, which can change often. If you notice that the price of an asset is not being updated anymore, you may have to review the capture expression.

Click here for sample price sources submitted by our users.