Adding BUY and SELL transactions with InvestFields
Having some trouble here...
I'm a but unclear what to feed into the investFields for buy and sells it seems. I have:
'''
invFlds = InvestFields()
invFlds.txnType = InvestTxnType.BUY
invFlds.date = dateInt
invFlds.taxDate = dateInt
invFlds.secCurr = security
invFlds.security = acct
invFlds.hasShares = True
invFlds.shares = qty
invFlds.hasAmount = True
invFlds.amount = amount
invFlds.hasFee = False
enteredInt = DateUtil.getStrippedDate()
check = ''
txn = ParentTxn.makeParentTxn(book,dateInt,dateInt,enteredInt,check,acct,desc,memo,-1,ParentTxn.STATUS_RECONCILING)
invFlds.storeFields(txn)
txn.syncItem()
'''
if the 'acc' variable is set to the sub account for the security the resulting transaction looks like this (in the python console):
'''
[ParentTxn(b1a37ccf-19d5-4fce-839d-2fc8f879993d) 20200830 desc=AAPL; val=-234355; stat=x; #splits=1; chk=; acct=XXXXX:APPLE INC; splits=SplitTxn: val=11; amt=-234355; desc=; stat= ; cat=XXXXX:APPLE INC; tags=[(samt:11)(acctid:b57aabde-702e-4613-ae62-ca88e6352a08)(invest.splittype:sec)(obj_type:)(id:5438b295-3502-4f87-872f-fd0e9dede292)(pamt:-234355)(desc:)]; ], ; ]
'''
Looks promising, but in the Register in the Moneydance UI is blank. The transaction doesn't show up at all!
In the UI Security Details tab I see the transaction duplicated (it shows up twice).
I've also tried just feeing in the investment account for 'acct'. That creates and entry in the UI Register, but only the date and description are filled in. In pythin that transaction looks like:
'''
[ParentTxn(7ce81df3-064f-4217-b612-da427d3485db) 20200830 desc=AAPL; val=0; stat=x; #splits=0; chk=; acct=XXXXX; splits=; ]
'''
Any thoughts as to what I'm missing here?
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Jim on 30 Aug, 2020 11:24 PM
Also just noticed that in the Portfolio View I see the amounts (shares, cost basis etc) are all crazy numbers...
Also in the security details if I delete one of the duplicated transactions in the UI, the other one also disappears.
System closed this discussion on 29 Nov, 2020 11:30 PM.