Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Re: Abridged summary of ledger-cli@googlegroups.com - 1 update in 1 topic

22 views
Skip to first unread message

Stanko Trček

unread,
Mar 13, 2025, 4:22:43 AM (10 days ago) Mar 13
to ledge...@googlegroups.com
A possible solution is to export a CSV file from the ledger-cli program, possibly modifying the export format to prevent the need for parsing the original ledger-cli format.

On Thu, 13 Mar 2025 at 00:18, <ledge...@googlegroups.com> wrote:
Daryl Manning <daryl....@gmail.com>: Mar 13 01:20AM +0800

Heya plain-texters,
 
*TLDR*
 
Does anyone have or know of any robust ledger import / export libraries in
Go Lang? I've written something for my portfolio use cases, but was hoping ...more
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to ledger-cli+...@googlegroups.com.

Daryl Manning

unread,
Mar 16, 2025, 9:42:44 PM (7 days ago) Mar 16
to ledge...@googlegroups.com
Thanks for the suggestion, Stanko. While I _could_ do that, it would make automation more difficult for what I want to accomplish in the future, and adds a level of indirection, so much more inclined to attempt correct parsing directly (also, I want an import/export function for the app). Have used csv in the past though as I do make use of the (excellent) reckon ruby gem to ML my category entry though from bank csv files, but this is a different animal here.

Perhaps a better approach, is I just share what I've got and ask anyone if they believe they can improve it or to critique it. I've thrown the Go code up on a public github gist at:
https://gist.github.com/wakatara/45022740c2167517defd0ddc1eadb506

for both the import/export and the transaction model (please feel free to shoot holes in the txn model too)
(I definitely know I've benefitted from people just sharing snippets and entire code before - ie. ledger-pyreport)

The code kinda expects transactions to be in the following format atm to parse for FX, symbols and currencies. I use a no-fee broker so fixed costs aren't coded in atm though that needs to be folded in as well.

2020-02-02 CAD-hedged S&P 500 Growth ETF Limit Buy
    Assets:SPYG                                 100 SPYG @ 49.8396 USD    
    Assets:CA:Cash                          -6661.30 CAD @ 0.74822297 USD


ciao!
Daryl.




On Fri, Mar 14, 2025 at 7:18 AM <ledge...@googlegroups.com> wrote:

A possible solution is to export a CSV file from the ledger-cli program,
possibly modifying the export format to prevent the need for parsing the
original ledger-cli format.
 

Tavis Ormandy

unread,
Mar 18, 2025, 10:45:03 AM (5 days ago) Mar 18
to ledge...@googlegroups.com
On 2025-03-17, Daryl Manning wrote:
> Thanks for the suggestion, Stanko. While I _could_ do that, it would make
> automation more difficult for what I want to accomplish in the future, and
> adds a level of indirection, so much more inclined to attempt correct
> parsing directly (also, I want an import/export function for the app).

I agree csv is the way to go, at least for import. That way you get
ledger to handle all the difficult parts for you... e.g. aliases,
unknown accounts, metadata overrides, inline value expressions?

Tavis.

--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger tav...@sdf.org
_\_V _( ) _( ) @taviso

Daryl Manning

unread,
Mar 18, 2025, 11:19:40 PM (4 days ago) Mar 18
to ledge...@googlegroups.com
I guess what I'm looking for here is not a change in approach and intermediate csv step, but possible improvements/greater resiliency in the parsing Go code for ledger format (mostly in case I want to open source my work - as it works for my use case very well atm - I mean, I could just say that you need to get your entries into the header, purchase, withdrawal, fixed cost line format and be done with it), so if anyone has suggestions on that end, rather than the csv approach, I'd be interested in hearing them.

Since I'd like this to be a server-based single binary deployable, requiring ledger cli to also be installed on a server or docker container would be additional troubleshooting I don't really want to tackle.

thanks,
Daryl.




On Wed, Mar 19, 2025 at 7:18 AM <ledge...@googlegroups.com> wrote:

On 2025-03-17, Daryl Manning wrote:
> automation more difficult for what I want to accomplish in the future, and
> adds a level of indirection, so much more inclined to attempt correct ...more
Reply all
Reply to author
Forward
0 new messages