--Is there a way to automatically transfer lots from one account to another using FIFO and keeping the prices paid?E.g.:I bought `0.13833333 BTC` for `2500 EUR` and `0.125 BTC` for `2500 EUR` on Coinbase. I transferred `0.2 BTC` to Binance. I sold all `0.2 BTC` for `3500 EUR` on Binance.*(Which will actually become a swap to another coin. But for taxes I need to account an assumed BTC-EUR sell and an assumed X-Token buy. But since I got that lot issue the final step is omitted.)*option "booking_method" "FIFO"option "operating_currency" "EUR"option "inferred_tolerance_default" "EUR:0.001"option "inferred_tolerance_default" "BTC:0.00000001"2020-12-01 open Equity:Opening-Account2020-12-01 open Assets:Cash:Coinbase-Pro2020-12-01 open Assets:Cash:Binance2020-12-01 open Assets:Crypto:BTC:Coinbase-Pro2020-12-01 open Assets:Crypto:BTC:Binance2020-12-01 open Expenses:Commission:Coinbase-Pro:EUR2020-12-01 open Income:Day-trading:EUR2020-12-17 * "Coinbase" "Opening"Assets:Cash:Coinbase-Pro 5000 EUREquity:Opening-Account -5000 EUR2020-12-17 * "Coinbase" "Trade EUR => BTC"Assets:Cash:Coinbase-Pro -2500 EURAssets:Crypto:BTC:Coinbase-Pro 0.13833333 BTC {18,000 EUR} @ 18,000 EURExpenses:Commission:Coinbase-Pro:EUR 10 EUR2020-12-18 * "Coinbase" "Trade EUR => BTC"Assets:Cash:Coinbase-Pro -2500 EURAssets:Crypto:BTC:Coinbase-Pro 0.125 BTC {20,000 EUR} @ 20,000 EURExpenses:Commission:Coinbase-Pro:EUR 0 EUR2020-12-19 * "Binance" "Transfer BTC Coinbase-Pro => Binance"Assets:Crypto:BTC:Binance 0.2 BTCAssets:Crypto:BTC:Coinbase-Pro -0.2 BTC2020-12-20 * "Binance" "Trade BTC => USDT"Assets:Crypto:BTC:Binance -0.2 BTC {} @ 17,500 EURAssets:Cash:Binance 3,500 EURIncome:Day-trading:EURThe error I'm getting is:>$ bean-check Krypto.bean>>Krypto.bean:38: No position matches "Posting(account='Assets:Crypto:BTC:Binance', units=-0.2 BTC, cost=CostSpec(number_per=<class 'beancount.core.number.MISSING'>, number_total=None, currency='EUR', date=None, label=None, merge=False), price=17500 EUR, flag=None, meta={'filename': 'Krypto.bean', 'lineno': 39})" against balance (0.2 BTC)>> 2020-12-20 * "Binance" "Trade BTC => USDT"> Assets:Crypto:BTC:Binance -0.2 BTC {} @ 17500 EUR> Assets:Cash:Binance 3500 EUR> Income:Day-trading:EURThat's probably because the lot information isn't passed in the 2020-12-19 transfer post.`--------------------`According to the manual keeping the lot information could be achieved writing the transfer post like this:2020-12-16 * "Binance" "Transfer BTC Coinbase-Pro => Binance"Assets:Crypto:BTC:Binance 0.13833333 BTC {18,000 EUR} ; creates a lot manually. Not FIFO safeAssets:Crypto:BTC:Coinbase-Pro -0.13833333 BTC {} ; selects the lot automatically. Therefore, Assets:Crypto:BTC:Coinbase-Pro is FIFO safeBut using this means I'm creating a lot in the second account `Assets:Crypto:BTC:Binance` manually. So, I'd need to look up which is/are the lot(s) that get transferred. Is there a syntax to solve automatically? Doing this manually would be cumbersome and error-prone. Dealing with cryptos many transfers between exchanges and privately owned wallets are a common thing. To keep track of them is crucial for any tax declaration.I think this is related to:`--------------------`In order to do the FIFO manually I need to look up/query my lots, but I'm unable to do this. `bean-report FILE holdings` seemed appropriate, but the lot date is missing and the units are trimmed/rounded to two digits:>$ bean-report Krypto.bean holdings>>Account Units Currency Cost Currency Average Cost Price Book Value Market Value>------------------------------ ----- -------- ------------- ------------ ----- ---------- ------------>Assets:Crypto:BTC:Binance 0.20 BTC BTC 0.20 0.20Assets:Crypto:BTC:Coinbase-Pro 0.14 BTC EUR 18,000.00 2,490.00Assets:Crypto:BTC:Coinbase-Pro 0.12 BTC EUR 20,000.00 2,500.00Assets:Crypto:BTC:Coinbase-Pro -0.20 BTC BTC -0.20 -0.20>------------------------------ ----- -------- ------------- ------------ ----- ---------- ------------I also tried `bean-query`. I could add the date, but the unit size is rounded as well:>$ bean-query Krypto.bean 'SELECT account, date, position WHERE currency="BTC" ORDER BY account'>> account date position>------------------------------ ---------- -------------------->Assets:Crypto:BTC:Binance 2020-12-19 0.2 BTC>Assets:Crypto:BTC:Coinbase-Pro 2020-12-17 0.1 BTC {18000 EUR}>Assets:Crypto:BTC:Coinbase-Pro 2020-12-18 0.1 BTC {20000 EUR}>Assets:Crypto:BTC:Coinbase-Pro 2020-12-19 -0.2 BTCI'd like to have an output with the colums:account, lot_date, lot_units (using 8 decimal digits), lot_cost (using 8 decimal digits)Lots which has been transferred/sold should be omitted, of course. (How) Is this possible?Regards.
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 view this discussion on the web visit https://groups.google.com/d/msgid/beancount/4242c558-c761-4fcb-8703-6b17b9b2a4e5n%40googlegroups.com.
Short answer is: no, but that's quickly becoming a FAQ from crypto users.It could be designed, but that would be a new feature.
On Wednesday, December 23, 2020 at 11:03:44 AM UTC+7 bl...@furius.ca wrote:Short answer is: no, but that's quickly becoming a FAQ from crypto users.It could be designed, but that would be a new feature.I only use Spec ID booking so I might be missing something but isn't moving lots just a small 5 or 6 line python script iterating over beancount.ops.holdings.get_final_holdings? Would this work or is it more complicated? I'm not sure that a plugin is simpler/clearer than just generating the transaction externally and then inserting it into the beancount file.
holdings = beancount.ops.holdings.get_final_holdings(entries, included_account_types=('Assets',))
print(f'{datetime.date.today()} * "ACATS" "Autogenerated lot transfer to new account"')
for h in filter(match, holdings):
cost_date = None
print(f' {h.account} -{h.number} {h.currency} {{ {cost_date}, {h.cost_number} {h.cost_currency} }}')
print(f' {args.destination} {h.number} {h.currency} {{ {cost_date}, {h.cost_number} {h.cost_currency} }}')The only problem I see is that get_final_holdings returns a Holding tuple that doesn't include the acquisition date. But there's a note in the code saying the Holding tuple should go away and just be replaced by a Position, which would hold the acquisition date.
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/beancount/58b12132-c3cd-401b-98e5-3035d034846dn%40googlegroups.com.
That makes sense. I was thinking of a system where plugin/booking/interpolation iterate over the same entries until no more modifications occur. This would involve some thought to prove (a) commutativity (order doesn't matter), and (b) convergence (no infinite iterations).
Reg. the other approach -- i.e., supporting this in core booking algos: even outside crypto, isn't the philosophy you've put forth "works on unambiguous source"? Given that, is there a syntax that removes ambiguity? For example:2020-01-01 * "Transfer"Asset:BrokerageA -10 HOOLI {}Asset:BrokerageB: 10 HOOLI {}might be unambiguous for FIFO, LIFO, and STRICT, and arguably for NONE (and AVG in the future). I.e., identical CostSpec after inverting the sign of one. I haven't thought deeply about all cases, and anyway, not the most important thing for v3.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/682270b8-812a-4098-a8fc-fcc4655737f9n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/2431d4ee-e998-4260-b98e-a8f801d71cd4n%40googlegroups.com.
That makes sense. I was thinking of a system where plugin/booking/interpolation iterate over the same entries until no more modifications occur. This would involve some thought to prove (a) commutativity (order doesn't matter), and (b) convergence (no infinite iterations)."Iterate over the same entry until no more modification occurs" seems error prone to me, and a potential nightmare for debugging.
Reg. the other approach -- i.e., supporting this in core booking algos: even outside crypto, isn't the philosophy you've put forth "works on unambiguous source"? Given that, is there a syntax that removes ambiguity? For example:2020-01-01 * "Transfer"Asset:BrokerageA -10 HOOLI {}Asset:BrokerageB: 10 HOOLI {}might be unambiguous for FIFO, LIFO, and STRICT, and arguably for NONE (and AVG in the future). I.e., identical CostSpec after inverting the sign of one. I haven't thought deeply about all cases, and anyway, not the most important thing for v3.I'm not sure I understand what you mean by "works on unambiguous source",
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/beancount/bd63fee9-2635-4a7f-9d2f-c6be0ab723edn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhOOPwB%3DbQe5GHdtiaZpEUYpYSZsp_Z1D124r0k47eSXZA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CABieCET5KOR5H2LqXBELTWnz4UiD0FEb%3DOYJ8uR6BqOM%2BGT%2BCA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CACGEkZsLWdkMLC0LTHy6HuFkfDzGzv2MHwJP0AX6Aje%2B-7Te0w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CABieCES1xujaP%2BqZbMFHBXAMnknOpYcOJkGgdcBf3VGFPW8vDg%40mail.gmail.com.
Failed to categorize posting 7
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CACGEkZszOgBvRfmfzv5ymuNXyxqXJ-9BmFdKH4yWL9MmTmx2Dg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CABieCEQ7YOVhkoG7jDB%2BS8D51MR3fKieDv-6Eu19RVSPQSRRuA%40mail.gmail.com.
You received this message because you are subscribed to a topic in the Google Groups "Beancount" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beancount/vDX1oA2mJXA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CACGEkZuPp55sqs5Ei5jRtUXRNx5he2nts_CE-ZjhXq82yRs%2BPw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CABieCERk8rcwab2m56u3wdNvyycp_zFuoSLHZpPVO8TkyVObCA%40mail.gmail.com.
Apologies for bumping an old thread with an off-topic question, but Redstreet, you said:> I personally have a vim plugin that uses bean-doctor context to insert the lots.This is really interesting; I wonder if this is something that's openly available or if it's a personal hack whether you'd be interested in sticking it on Github?
Just found this thread. I think I'm encountering similar issues; difficulties tracking assets that have been transferred.Have there been any developments on this front since?
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/beancount/2a9684b7-8c10-47ee-8bec-bd58c1095023n%40googlegroups.com.
On Wed, Jul 19, 2023 at 6:44 AM Eric Altendorf <erical...@gmail.com> wrote:Just found this thread. I think I'm encountering similar issues; difficulties tracking assets that have been transferred.Have there been any developments on this front since?No
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhMisGxYyhdEk2RpFB-UWPz40T3wv7seWog-qyaC5qJEew%40mail.gmail.com.
This looks all wrong, see other thread.To buy BTC at Coinbase, the money all comes from your Coinbase:Cash account.
On Sun, Jul 30, 2023 at 8:52 AM Martin Blais <bl...@furius.ca> wrote:On Wed, Jul 19, 2023 at 6:44 AM Eric Altendorf <erical...@gmail.com> wrote:Just found this thread. I think I'm encountering similar issues; difficulties tracking assets that have been transferred.Have there been any developments on this front since?NoFWIW, I *think* things are working for me by using both:1) The {USD} cost hack to pass cost basis info2) The ZeroSum account pattern to decouple the outgoing half of the transfer from the incoming. I haven't actually plugged in RedS's plugin but the balances in the intermediatingvirtual "buffer" accounts show me how close I am to properly accounting for both the incoming and outgoing amounts.