Change from MiscExp to BUY for investment transactions

shriram.writely's Avatar

shriram.writely

01 Sep, 2026 11:40 PM

Hello folks

I have an investment account that downloaded a bunch of BUYs as MiscExps and it is messing up the account balances and security performance etc.

I tried to change it via a python script this way:

        if (ttype == "MISCEXP"):
            txn.setEditingMode()
            fields.memo = "Changed from MISCEXP to BUY" + fields.memo
            fields.setFieldStatus(InvestTxnType.BUY, txn)
            fields.shares = fields.shares+0
            fields.amount = fields.amount+0
            fields.price = (fields.amount*1000)/(fields.shares)
            print fields.toString()
            fields.storeFields(txn)
            if txn.syncItem(): print("Synced txn")
            else: print("Not synced txn")
            break

Try as I might, I cannot get the fields.memo type sets to take effect. Occassionally I get the number of shares right (by playing around with the order of sets). Is there a good way to convert the "MiscExp" to "Buy"s .. the UI does it right. But there are too many transactions to do so

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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