Moving assets with cost basis

96 views
Skip to first unread message

Zhuoyun Wei

unread,
May 1, 2019, 4:30:56 AM5/1/19
to Beancount
Hi,

I am trying to move my stocks to another broker with ACATS. The transfer was a success, but I do not know how to record it in Beancount. Here is a minimal bean file:


option "operating_currency" "USD"
1970-01-01 open Assets:Bank:Checking
1970-01-01 open Assets:BrokerA:Cash
1970-01-01 open Assets:BrokerA:Positions "FIFO"
1970-01-01 open Assets:BrokerB:Cash
1970-01-01 open Assets:BrokerB:Positions "FIFO"
1970-01-01 open Equity:Transfers

2017-01-01 * "ACH transfer to BrokerA"
Assets:Bank:Checking -10000.00 USD
Equity:Transfers

2017-01-05 * "Incoming ACH transfer"
Equity:Transfers
Assets:BrokerA:Cash 10000.00 USD

2017-02-01 * "Buy 10 ADSK"
Assets:BrokerA:Cash
Assets:BrokerA:Positions 10 ADSK {100.00 USD}

2017-03-01 * "Buy 20 ADSK"
Assets:BrokerA:Cash
Assets:BrokerA:Positions 20 ADSK {110.00 USD}

2019-01-01 price ADSK 170.00 USD

2019-01-01 * "ACATS out"
Assets:BrokerA:Positions -30 ADSK {}
Assets:BrokerA:Cash -13200.00 USD
Equity:Transfers

2019-01-05 * "ACATS in"
Equity:Transfers
Assets:BrokerB:Positions 30 ADSK {}
Assets:BrokerB:Cash 13200.00 USD


I realize the "ACATS in" transaction may be incorrect, but even the "ACATS out" transaction raises an error:

acats.bean:33: Too many missing numbers for currency group 'USD'

I have tried various ways to amend the transaction with no success. Even if I tried to move only the positions directly to another broker, it does not work:

2019-01-01 * "ACATS out"
Assets:BrokerA:Positions -30 ADSK {}
Assets:BrokerB:Positions

^ this raises a "Too many missing numbers for currency group 'USD'" error.

Another attempt was:

2019-01-01 * "ACATS out"
Assets:BrokerA:Positions -30 ADSK {}
Assets:BrokerB:Positions 30 ADSK {}

^ this raises two errors:

acats.bean:29: Failed to categorize posting 2
acats.bean:32: Too many missing numbers for currency group 'USD'


Could anyone tell me the proper way to move positions, please?

--
Zhuoyun Wei

Zhuoyun Wei

unread,
May 1, 2019, 5:16:48 AM5/1/19
to Beancount
I kind of figured it out - one has to specify another cost basis and use PnL account to "absord" the difference:


2019-01-01 * "ACATS"
Assets:BrokerA:Positions -30 ADSK {}
Assets:BrokerB:Positions 30 ADSK {170.00 USD}
Income:PnL


This becomes:


2019-01-01 * "ACATS"
Assets:BrokerA:Positions -10 ADSK {100.00 USD, 2017-02-01}
Assets:BrokerA:Positions -20 ADSK {110.00 USD, 2017-03-01}
Assets:BrokerB:Positions 30 ADSK {170.00 USD, 2019-01-01}
Income:PnL -1900.00 USD


This essentially liquidates and re-purchases all the stocks. I am not aware if there is another way that preserves the original cost basis. But I'm okay with this method now.

--
Zhuoyun Wei

Justus Pendleton

unread,
May 1, 2019, 11:21:59 AM5/1/19
to Beancount

On Wednesday, May 1, 2019 at 4:16:48 PM UTC+7, Zhuoyun Wei wrote:
2019-01-01 * "ACATS"
  Assets:BrokerA:Positions       -10 ADSK {100.00 USD, 2017-02-01}
  Assets:BrokerA:Positions       -20 ADSK {110.00 USD, 2017-03-01}
  Assets:BrokerB:Positions        30 ADSK {170.00 USD, 2019-01-01}
  Income:PnL                -1900.00 USD

If all you did is an in-kind transfer, there should be no alternation to PnL, yeah? The way you've done this also throws away lot information, which seems like something you probably want to keep.

The way I've done this is:

2019-01-01 * "ACATS"
  Assets:BrokerA:Positions       -10 ADSK {100.00 USD, 2017-02-01}
  Assets:BrokerA:Positions       -20 ADSK {110.00 USD, 2017-03-01}
  Assets:BrokerB:Positions        10 ADSK {100.00 USD, 2017-02-01}
  Assets:BrokerB:Positions        20 ADSK {110.00 USD, 2017-03-21}

Zhuoyun Wei

unread,
May 1, 2019, 1:48:34 PM5/1/19
to Justus Pendleton, Beancount
Thank you Justus! This is exactly what I want. Listing every lot is a bit verbose, but it's a once-in-a-while thing, so I am okay with it.

One thing surprises me is that the receiving broker (InteractiveBrokers, to be exact) does not preserve the cost basis. In its PDF statement and the TWS, the cost basis of the inbound positions is the price when IBKR receives the positions. It's my first time doing ACATS, so I have no idea if this is a normal thing.

Anyway, I am satifsfied that Beancount is able to keep the lots info (cost basis, date) even when the broker is unable to :-)

--
Zhuoyun Wei
> --
> You received this message because you are subscribed to the Google
> Groups "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to beancount+...@googlegroups.com.
> To post to this group, send email to bean...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/401d7fb5-8a20-4444-b31c-0ede49724557%40googlegroups.com <https://groups.google.com/d/msgid/beancount/401d7fb5-8a20-4444-b31c-0ede49724557%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Martin Blais

unread,
May 1, 2019, 8:45:17 PM5/1/19
to Beancount
+1 to that

(It's a shame the original question's "ACATS out" inference doesn't work though. I think it could.)


--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.

Justus Pendleton

unread,
May 1, 2019, 10:06:26 PM5/1/19
to Beancount
On Thursday, May 2, 2019 at 12:48:34 AM UTC+7, Zhuoyun Wei wrote:
One thing surprises me is that the receiving broker (InteractiveBrokers, to be exact) does not preserve the cost basis. In its PDF statement and the TWS, the cost basis of the inbound positions is the price when IBKR receives the positions. It's my first time doing ACATS, so I have no idea if this is a normal thing.

I have done an ACATS to Interactive Brokers and it preserved my cost basis & the date of acquisition.

I would double check that the cost basis is actually gone. IB makes this surprisingly hard to verify. You need to create a custom report to see lots. Go to Statements, click the gear icon in Custom Statements on the right, click the + to create a new statement, and select "Open Positions" in the Sections. Then run that report and you can see all of your lots, with their date of acquisition and cost basis.

If it is wrong, I'd contact IB support and tell them to fix it. From what I gather, brokers are generally happy to put whatever you tell them in the cost basis data. After all, if it is wrong, they don't get in trouble with the tax authorities....you do.

Zhuoyun Wei

unread,
May 2, 2019, 1:39:22 AM5/2/19
to Justus Pendleton, Beancount
I just run a custom report. Indeed the lot information is lost. The purchase date and cost basis are both wrong. I'll contact IB custom support to fix that...

--
Zhuoyun Wei
> --
> You received this message because you are subscribed to the Google
> Groups "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to beancount+...@googlegroups.com.
> To post to this group, send email to bean...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/884c28a7-3deb-4301-bbc5-156d66aff085%40googlegroups.com <https://groups.google.com/d/msgid/beancount/884c28a7-3deb-4301-bbc5-156d66aff085%40googlegroups.com?utm_medium=email&utm_source=footer>.

Zhuoyun Wei

unread,
May 2, 2019, 4:16:45 AM5/2/19
to Justus Pendleton, Beancount
In case anyone encounters the same problem: one can edit the cost basis of transferred positions:

https://www.interactivebrokers.com/en/software/am/am/reports/positiontransferbasis.htm

--
Zhuoyun Wei
Reply all
Reply to author
Forward
0 new messages