Hi Martin, Thanks for your reply and for creating such a valuable tool in Beancount. I wrote a response yesterday, but I haven't seen it posted to the mailing list yet, so apologies if there's some repetition in this message.
Beanpost does support multiple currencies using a custom PostgreSQL type and custom aggregator functions. For example, the query SELECT sum(amount) FROM posting; will return a summed balance (a basket of currencies) for the postings, allowing you to work with different commodities and calculate balances across various accounts. I'm sorry I didn't make that clearer in my earlier message. Regarding cost basis, I went ahead and implemented a basic version. I added functions for matching augmentations and reductions in an inventory, equivalent to the "STRICT" booking method. There's also a function for calculating an average cost basis. The query to retrieve these results looks like this: SELECT inventory(posting.*) AS booking_method_none, cost_basis(posting.*) AS booking_method_strict, cost_basis_avg(posting.*) AS booking_method_average FROM posting; There's no validation yet, so lots can go negative, and currencies between augmentation and reduction don't have to match. I think these checks should be fairly straightforward to add later. If you'd like to explore the implementation, you can find it in the new branch of my repository: https://github.com/gerdemb/beanpost/tree/inventory. I'm also considering how to implement FIFO and LIFO cost-basis methods. Thank you again for your interest and for your valuable feedback. I'm looking forward to hearing what you think. Best regards, Ben > On Apr 23, 2024, at 12:12 AM, Martin Blais <[email protected]> wrote: > > Thanks for sharing, Ben, > Broadly speaking this approach will work if you don't have to match cost > basis and if you have only a single currency. > Note that export to SQL has existed for a while, but I think to be able to > most generally replace the functionality from Beancount one would need a > custom aggregator implementation (to accumulate positions with a variety of > commodities and track individual lots, i.e., the Inventory class). > > > > > > On Mon, Apr 22, 2024 at 2:46 PM Ben Gerdemann <[email protected]> wrote: > Hi Everyone, > I hope this email finds you well. I've been using Beancount for many years. > It's been an amazing tool, and I'm grateful to this community and especially > to Martin Blais for maintaining such a fantastic project. > I'm sharing a project I've been working on called Beanpost, which you can > find on GitHub at https://github.com/gerdemb/beanpost. This started as an > experiment to see if I could recreate plain text accounting functionality > using a PostgreSQL database, and it turned out more successful than I > expected. I thought the Beancount community might find it useful and > interesting. > Beanpost consists of a PostgreSQL schema and import/export commands that let > you transfer data between a beancount file and a PostgreSQL database. Much of > Beancount's functionality is implemented using custom PostgreSQL functions, > allowing for complex queries and data manipulation. This setup provides a > flexible backend that can integrate with other tools like web apps or > reporting systems. > One of the reasons I created Beanpost was to build a mobile-friendly custom > front-end. Fava is a fantastic tool, but it's not very mobile-friendly, isn't > intuitive for beginners, and is hard to customize. With Beanpost, you have > more flexibility to create a custom front-end that suits your needs. > The included functionality is as follows: > • Functions to calculate account balances or changes over a specific > period. > • Support for calculations on individual accounts or account hierarchies > (e.g., "Assets"). > • Check balance assertions. > • Verify that transactions balance. > • Support for explicit precisions for each currency to use for balance > tolerances. > • Display the running balance of an account by posting. > • Convert between currencies, including converting baskets of currencies. > • Store documents as byte-data in the database. > I'm curious to hear your thoughts on this approach. Would love to hear any > feedback. I think I've implemented the majority of the required features, but > maybe I'm missing a few things? > Maybe we could call this "database-based accounting" instead of "plain text > accounting." 🙂 > Thank you for your time, and I look forward to hearing from you. > Best regards, > Ben > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/143e6263-3db3-4532-ae0e-eac6d7e6ffebn%40googlegroups.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/t_99aXRbG78/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/CAK21%2BhO1JLNPorhm3qweWGcHX%2BdyAJ-kjxLMbT10rh96oKgzag%40mail.gmail.com. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/A371660A-DA64-4572-8074-E47BD3A71991%40gerdemann.org.
