[GNC] QIF format for StkSplit

David Reiser dbreiser at icloud.com
Thu Jan 5 21:05:38 EST 2023


bug, maybe?

import-export/qif-imp/qif-to-gnc.scm says:

((stksplit)
             (let* ((splitratio (n/ num-shares (gnc-numeric-create 10 1)))
                    (in-shares
                     (xaccAccountGetBalance near-acct))
                    (out-shares (n* in-shares splitratio)))
               (xaccSplitSetAmount gnc-near-split out-shares)
               (xaccSplitSetAmount gnc-far-split (n- in-shares))
               (xaccSplitSetValue gnc-near-split (n- split-amt))
               (xaccSplitSetValue gnc-far-split split-amt))))


num-shares is the value of the qif Q line, so it looks like the entered split ratio is being divided by 10. But I can’t find a definition of gnc-numeric-create. And my scheme (well, LISP, in my case) is so rusty it almost might be worse than not knowing it in the first place...
--
Dave Reiser
dbreiser at icloud.com





> On Jan 5, 2023, at 6:13 PM, ml at tgr66.me wrote:
> 
> So, the ratio * 10 does seem to be working. :man_shrugging:
> 
> For example, if it is a 4 for 1 split, 40
> If it is a 1 for 10 split, 1
> 
>> On Jan 5, 2023, at 14:17, ml at tgr66.me wrote:
>> 
>> Yes. I missed adding that to the list I’ve tried.
>> 
>> In the full work minimal example below, the share balance ends up at 1.2
>> 
>> !Account
>> NAssets:Investments:Brokerage Account:Joint Brokerage
>> TInvst
>> ^
>> !Type:Bank
>> D01/11/2020
>> NPayment/Deposit
>> PTrf My Bank
>> CX
>> T1,000.00
>> MDeposit
>> LAssets:Current Assets:My Bank
>> ^
>> !Type:Invst
>> D12/2/2021
>> NBuy
>> PXYZ, INC
>> YXYZ
>> I150
>> T450
>> Q3
>> CR
>> M3 shares @ 150; Nothing to see here
>> ^
>> !Type:Invst
>> D1/1/2022
>> NStkSplit
>> PXYZ, INC
>> YXYZ
>> CR
>> Q4
>> M4 for 1 split
>> ^
>> 
>> Then I changed Q to 40 and while I end up with the correct balance (GnuCash creates two transactions, one removing the original three shares, and the second adding 12 shares), I have no idea if that is just luck or if I’ve stumbled on new math :-)
>> 
>> I’ll experiment some more.
>> 
>> 
>>> On Jan 5, 2023, at 14:02, David Reiser <dbreiser at icloud.com> wrote:
>>> 
>>> I’ve never used QIF for stock splits, but the obvious question is “Have you tried Q4?” After all, 4/1 is numerically equal to 4 (a ratio reduced to a single number).
>>> --
>>> Dave Reiser
>>> dbreiser at icloud.com
>>> 
>>> 
>>> 
>>> 
>>> 
>>>> On Jan 5, 2023, at 2:51 PM, ml at tgr66.me wrote:
>>>> 
>>>> I’ve searched considerably, but if I missed it, I apologize.
>>>> 
>>>> Docs for QIF say the Q field should contain the split ratio. I’ve tried various options, but I’m not getting the expected results after import.
>>>> 
>>>> !Type:Invst
>>>> D8/31/2020
>>>> NStkSplit
>>>> PAPPLE INC
>>>> YAAPL
>>>> CR
>>>> M4 for 1 split; 
>>>> Q36 // Have also tried 4:1, 4/1 and simply 48
>>>> ^
>>>> 
>>>> GnuCash 4.13 on macOS. I’ve not tried yet on my Linux box.
>>>> 
>>>> Thanks.
>>>> _______________________________________________
>>>> gnucash-user mailing list
>>>> gnucash-user at gnucash.org
>>>> To update your subscription preferences or to unsubscribe:
>>>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>>>> -----
>>>> Please remember to CC this list on all your replies.
>>>> You can do this by using Reply-To-List or Reply-All.
>>> 
>> 
>> _______________________________________________
>> gnucash-user mailing list
>> gnucash-user at gnucash.org
>> To update your subscription preferences or to unsubscribe:
>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>> -----
>> Please remember to CC this list on all your replies.
>> You can do this by using Reply-To-List or Reply-All.
> 



More information about the gnucash-user mailing list