Regex for custom price updater script

Louis-Philippe Allard lp.allard.1 at gmail.com
Sat Mar 5 19:33:56 GMT 2022


Hello,

I am using a local custom script to retrieve prices from the internet.

#!/bin/sh
url=https://www.theglobeandmail.com/investing/markets/funds/
curl -s "$url/$1"|
./pup -p 'a[is="barchart-alert"] attr{quote}'|
jq -r .lastPrice,.tradeTime

Running this script in the Bash terminal with the fund symbol passed  
as an argument will return something like:

/path/to/prices.sh SYMBOL
18.7920
03/04/22

However I cannot make KMM use this script.  I created a new source and  
set the options as this:

URL:  file:/path/to/prices.sh %1
Identifier %1
Identify by: Symbol
Price: (\d+(\.\d+)?)
Date: (\d{2}\ /\d{2}\ /\d{2})
Date format: %m/%d/%y
Skip HTML... : CHECKED

When I run the price updater I get:

  Executing /path/to/prices.sh SYMBOL...

  Price found: '2.4' (2.4)

  Unable to update price for SYMBOL (no price or no date)

Problem 1:  it seems to retrieve the number of digits of the price  
instead of the actual value...  I tried the price regex elsewhere and  
it works.  Not sure if the Qt interpreter is causing this issue??
Problem 2: I could never get the date... Tried pretty much everything  
I could find but I am not sure why its not working.

Any help appreciated!
Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney/attachments/20220305/78034344/attachment.htm>


More information about the KMyMoney mailing list