<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>

<head>

<meta http-equiv="content-type"
content="text/html; charset=utf-8">
<title>
</title>
</head>
<body style="font-family:Arial;font-size:14px">

<p style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
Hallo
Thomas,<br>

<br>

Not
sure
what
I'm
doing
wrong,
but
I
cannot
make
it
work... 
If
I
manually
run
the
"script"
in
terminal,
it
outputs
the
RAW
values
for
price
and
date
on
2
separate
lines
(-r
arg
of
jq
outputs
RAW
data).<br>

<br>

user@vm:/mnt/local$
/mnt/local/prices.sh
CIG2111.CF<br>

10.2830<br>

03/04/22<br>

<br>

which
is
(AFAIK)
identical
to
simply
echoing
the
price
and
date
as
you
did.... 
Somehow,
KMM
can
retrieve
the
price
and
date
just
fine
when
I
echo
their
values
but
when
I
use
the
script
with
"jq"
command,
kmm
complains<br>

<br>

Executing
/mnt/local/prices.sh
CIG2111.CF...</p>
<p style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
Price
found:
'2.4'
(2.4)</p>
<p style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
<span style="font-weight:600; color:#ff0000;">
Unable
to
update
price
for
CIG2111.CF
(no
price
or
no
date)</span></p>
<p style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
My
parameters:<br>

<br>

Price
regex:
(\d+(\.\d+)?)<br>

Date
regex:
(\d{2}\/\d{2}\/\d{2})
(i
removed
the
spaces....sorry)<br>

Date
format:
%m/%d/%y<br>

Skip
HTML:
UNCHECKED<br>

<br>

When
running
KMM
from
CLI,
I
do
see
this
in
the
terminal
(if
relevant):<br>

<br>

kmymoney_webpricequote:
quotedata
"curl:
/tmp/.mount_kmymonXfrMyZ/usr/lib/liblber-2.4.so.2:
no
version
information
available
(required
by
/lib/x86_64-linux-gnu/libcurl.so.4)\ncurl:
/tmp/.mount_kmymonXfrMyZ/usr/lib/libldap_r-2.4.so.2:
no
version
information
available
(required
by
/lib/x86_64-linux-gnu/libcurl.so.4)\n"<br>

kmymoney_webpricequote:
stripped
text
"curl:
/tmp/.mount_kmymonXfrMyZ/usr/lib/liblber-2.4.so.2:
no
version
information
available
(required
by
/lib/x86_64-linux-gnu/libcurl.so.4)
curl:
/tmp/.mount_kmymonXfrMyZ/usr/lib/libldap_r-2.4.so.2:
no
version
information
available
(required
by
/lib/x86_64-linux-gnu/libcurl.so.4)"<br>

kmymoney_webpricequote:
Price
"2.4"<br>

qt.qpa.xcb:
QXcbConnection:
XCB
error:
3
(BadWindow),
sequence:
12168,
resource
id:
20859890,
major
code:
40
(TranslateCoords),
minor
code:
0<br>

<br>

Somehow
I
think
the
output
of
my
script
is
giving
a
hard
time
to
KMM.
<strong>
I
am
testing
with
5.1.2-dcb4ef208
(kmymoney-5.1-40-linux-centos_64-gcc)</strong></p>
<p>
Looking
forward
to
seeing
what
you
think
of
that!<br>

<br>

Thanks!<br>

<br>

<br>

Quoting
Thomas
Baumgart
via
KMyMoney
<<a href="mailto:kmymoney@kde.org">kmymoney@kde.org</a>>:</p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;"
type="cite">
<p>
Hi,<br>

<br>

regex
are
a
fun
thing
to
deal
with.
Here's
what
I
came
up
with:<br>

<br>

Price:
(\d+(\.\d+)?)<br>

Date:
(\d{2}\/\d{2}\/\d{2})<br>

<br>

The
date
did
not
work
for
you
due
to
the
extra
spaces
you
have<br>

included
between
'\'
and
'/'
in
the
date
regex.
It
was
looking<br>

for
a
space
where
there
isn't
any
so
it
did
not
match.<br>

<br>

Here's
my
version
of
prices.sh
(for
testing):<br>

<br>

<quote><br>

#!/bin/bash<br>

<br>

echo
"18.7920"<br>

echo
"03/04/22"<br>

</quote><br>

<br>

and
the
output
resulting
when
I
use
that
on
a
symbol
named
POS<br>

<br>

<quote><br>

Executing
/home/thb/prices.sh
POS...<br>

Identifier
found:
''<br>

Price
found:
'18.7920'
(18,792)<br>

Date
found:
'Fr.
März
4
2022'<br>

Price
for
POS
updated
(id
E000002)<br>

</quote><br>

<br>

I
am
currently
using
this
on
master
which
I
just
modified
to
use
QRegularExpression<br>

instead
of
QRegExp
a
few
days
ago.
Maybe
that
makes
a
difference.
But
running
this<br>

on
5.1
using
QRegExp
it
provides
the
same
results.<br>

<br>

There's
no
need
to
check
the
'skip
HTML'
as
your
output
does
not
have
any
HTML.<br>

<br>

Hope
that
gives
you
some
ideas
where
to
look.<br>

<br>

Thomas<br>

<br>

<br>

<br>

On
Samstag,
5.
März
2022
20:33:56
CET
Louis-Philippe
Allard
via
KMyMoney
wrote:<br>
</p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;"
type="cite">
<p>
Hello,<br>

<br>

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

<br>

#!/bin/sh<br>

url=<a href="https://www.theglobeandmail.com/investing/markets/funds/"
target="_blank">https://www.theglobeandmail.com/investing/markets/funds/</a><br>

curl
-s
"$url/$1"|<br>

./pup
-p
'a[is="barchart-alert"]
attr{quote}'|<br>

jq
-r
.lastPrice,.tradeTime<br>

<br>

Running
this
script
in
the
Bash
terminal
with
the
fund
symbol
passed<br>

as
an
argument
will
return
something
like:<br>

<br>

/path/to/prices.sh
SYMBOL<br>

18.7920<br>

03/04/22<br>

<br>

However
I
cannot
make
KMM
use
this
script. 
I
created
a
new
source
and<br>

set
the
options
as
this:<br>

<br>

URL: 
<a href="file:/path/to/prices.sh"
target="_blank">
file:/path/to/prices.sh</a>
%1<br>

Identifier
%1<br>

Identify
by:
Symbol<br>

Price:
(\d+(\.\d+)?)<br>

Date:
(\d{2}\
/\d{2}\
/\d{2})<br>

Date
format:
%m/%d/%y<br>

Skip
HTML...
:
CHECKED<br>

<br>

When
I
run
the
price
updater
I
get:<br>

<br>

 
Executing
/path/to/prices.sh
SYMBOL...<br>

<br>

 
Price
found:
'2.4'
(2.4)<br>

<br>

 
Unable
to
update
price
for
SYMBOL
(no
price
or
no
date)<br>

<br>

Problem
1: 
it
seems
to
retrieve
the
number
of
digits
of
the
price<br>

instead
of
the
actual
value... 
I
tried
the
price
regex
elsewhere
and<br>

it
works. 
Not
sure
if
the
Qt
interpreter
is
causing
this
issue??<br>

Problem
2:
I
could
never
get
the
date...
Tried
pretty
much
everything<br>

I
could
find
but
I
am
not
sure
why
its
not
working.<br>

<br>

Any
help
appreciated!<br>

Best
regards</p>
</blockquote>
--<br>

<br>

Regards<br>

<br>

Thomas
Baumgart<br>

<br>

<a href="https://www.signal.org/"
target="_blank">
https://www.signal.org/</a> 
 
 
 Signal,
the
better
WhatsApp<br>

-------------------------------------------------------------<br>

If
Bill
Gates
put
microchips
in
the
vaccine,
you
would
have<br>

to
go
in
for
an
update
the
second
Tuesday
of
every
month.-------------------------------------------------------------</blockquote>
<p>
<br>

<br>
</p>
<div>
Louis-Philippe
Allard<br>

<a href="mailto:lp.allard.1@gmail.com">
lp.allard.1@gmail.com</a><br>

Sent
using
Horde
Groupware
on
GNU/Linux</div>
</body>
</html>