Need help in identifying all transactions
Hello folks,
I'd like to write a python extension/script to collate all transactions pertaining to a specific stock (say TSLA) across my accounts.
Is there a clean way to do this? My code (below) does not seem to capture all of the historic transactions.
Thanks!
for txn in txnSet.iterableTxns():
desc = str(txn.getDescription()).lower()
if (str(txn.getAccount().getAccountType()) == "INVESTMENT"):
try:
memo = str(txn.getMemo()).lower()
# print("investment %s %s" % (desc, category))
if (("tesla" in desc) or ("tsla" in desc) or ('tesla' in memo) or ('tsla' in memo)):
print(txn)
except AttributeError, e:
pass
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 Stuart Beesley ... on 05 May, 2024 06:58 PM
Here's some code to help you out...:
change
wantTicker
to the exact string of the ticker (tools/securities/edit) that you want...InvestFields() is your friend on this one!
Hope this helps you? Any questions, shout...
2 Posted by Stuart Beesley ... on 05 May, 2024 07:09 PM
Refer:
https://infinitekind.com/dev/apidoc/com/infinitekind/moneydance/mod...
https://infinitekind.com/dev/apidoc/com/infinitekind/moneydance/mod...
https://infinitekind.com/dev/apidoc/com/infinitekind/moneydance/mod...
https://infinitekind.com/dev/apidoc/com/infinitekind/moneydance/mod...
3 Posted by Shriram Nataraj... on 06 May, 2024 05:09 AM
Dear Mr. Toolbox/Stuart,
This code hit the mark. My prices are printing out weirdly/are probably not
set right. However the "shares" and "Amount"s are coming through clearly
across all accounts. I did not realize getCurrency included Securities.
Thanks for the helpful links and the working code!!
Appreciate it,
Shriram
4 Posted by Stuart Beesley ... on 06 May, 2024 05:12 AM
All rates have to be decoded by doing
1.0 / rate
1.0 / price
Did that work?
Yes Currencies and Securities are all/both Currencies.
5 Posted by Shriram Nataraj... on 06 May, 2024 05:43 AM
Oh neat -- yeah the prices line up once I use that decoder ring!
Thanks,
Shriram
6 Posted by Stuart Beesley ... on 06 May, 2024 07:22 AM
👍
System closed this discussion on 05 Aug, 2024 07:30 AM.