Reply to topic

Index tracking as 'units'

User avatar JesusM
Registered Member
Posts
194
Karma
0
OS

Index tracking as 'units'

Wed Nov 24, 2021 10:16 am
Hello,

I was trying to track EURIBOR evolution, and since I didn't see a plug-in available, I created a small script to do it. It works fine, but ...

I created an UNIT called 'Euribor-3M' (for the three months index), I set the unit as 'index' and tried to download the values, and I got this:
Code: Select all
[ERR-5]: Download failed
[ERR-5]: Impossible to download unit EURIBOR-3M with Internet code 3-months on the source EuriborRates.
[ERR-8]: Value of a currency cannot be a negative value

But the thing is that the index is negative indeed, and it can be. So, how can I workaround this? And ... what's the difference from Skrooge point of view between 'index' and 'share' for example?

In case it helps, this is the output of the script execution:
Code: Select all
[email protected]:~/bin/Skrooge$ ./EuriborRates.pl 3-months
Date,Price
22/11/2021,-0.564
[email protected]:~/bin/Skrooge$ ./EuriborRates.pl 6-months
Date,Price
22/11/2021,-0.528


And by the way, equivalent error when I try to add manually the value:
Code: Select all
[ERR-5]: Unit value creation failed
[ERR-5]: Operation 'SKGDocumentBank::addOrModifyUnitValue' on 'EURIBOR-3M / 2021-11-22 / -0.564' failed
[ERR-8]: Value of a currency cannot be a negative value

Thanks
User avatar smankowski
Moderator
Posts
1036
Karma
7
OS

Re: Index tracking as 'units'

Sat Dec 11, 2021 2:52 pm
Hi JesusM,

I can do a code change to remove this constrain but you will have it only in the next version.
Do you agree with that ?


Skrooge, a personal finances manager powered by KDE
Image - PayPal
User avatar JesusM
Registered Member
Posts
194
Karma
0
OS

Re: Index tracking as 'units'

Sat Dec 11, 2021 3:03 pm
smankowski wrote:Hi JesusM,

I can do a code change to remove this constrain but you will have it only in the next version.
Do you agree with that ?


I am on 'current' version all the time, cloning with git and compiling when there is any change, so that is a perfect solution for me.

By the way, now that you are gonna change it ... the error message always says 'currency' when it actually can be shares, currencies, index, etc.

Thanks a lot!
User avatar smankowski
Moderator
Posts
1036
Karma
7
OS

Re: Index tracking as 'units'

Sat Dec 11, 2021 3:54 pm
Commit done:
Unit values can be negative now (see viewtopic.php?f=210&t=173318)


Skrooge, a personal finances manager powered by KDE
Image - PayPal
User avatar JesusM
Registered Member
Posts
194
Karma
0
OS

Re: Index tracking as 'units'

Sat Dec 11, 2021 4:14 pm
It's not working for me.

Due the requirement to get positive numbers, the script I use to download the Euribor rates had a workaround as easy as adding an offset:
Code: Select all
$EXprice += 0.75;    # temporary workaround for negative values
And executing it:
Code: Select all
/EuriborRates.pl 3-months
Date,Price
10/12/2021,0.162
[email protected]:~/bin/Skrooge$
Everything good.

Now, I remove the workaround by commenting that line, and executing the script from CLI:
Code: Select all
[email protected]:~/bin/Skrooge$ ./EuriborRates.pl 3-months
Date,Price
10/12/2021,-0.588
[email protected]:~/bin/Skrooge$

Apparently everything fine, but as soon as I try to download the unit from Skrooge I get this error:
[ERR-5]: Download failed
[ERR-5]: Impossible to download unit EURIBOR-3M with Internet code 3-months on the source EuriborRates.
[ERR-10019]: CHECK constraint failed: unitvalue Unable to fetch row
[ERR-10019]: UPDATE unitvalue SET d_date='2021-12-10',rd_unit_id='90',f_quantity='-0.588' WHERE d_date='2021-12-10' AND rd_unit_id=90

I get the same error if I try to update the value manually in Skrooge (not downloading but adding the value)

Could it be the database is defined to have only positive values in that field?

Thanks
User avatar smankowski
Moderator
Posts
1036
Karma
7
OS

Re: Index tracking as 'units'  Topic is solved

Sat Dec 11, 2021 8:33 pm
I did a new commit.
Should be good now.


Skrooge, a personal finances manager powered by KDE
Image - PayPal
User avatar JesusM
Registered Member
Posts
194
Karma
0
OS

Re: Index tracking as 'units'

Sat Dec 11, 2021 10:02 pm
Yes! Now it works perfectly fine. Thanks!

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Sogou [Bot]