hello all,  :)

  i managed to squeeze some time into working on my ledger and 
cooked up a completely different importer which gives me much 
better and immediate control over what i can spit out.  in a 
few days of random tinkering i got a prototype that isn't perfect 
but i'm getting close.

  since i've not delved into a plugin before i thought i would 
ask first before going off on a tangent which may or may not be 
needed.

  currently the prototype spits out the following (the input line 
of the csv file is included on each transaction as meta data).  i 
did pre-edit the input csv data to include references to lots to 
make it easier...

=====
2023-01-05 * "Bought 20 FAKE @ 10 (LOT 2023-01-05 SOLD 2023-01-10)"
  input: "01/05/2023,MTID01,Bought 20 FAKE @ 10 (LOT 2023-01-05 SOLD 
2023-01-10),20,FAKE,10,11,-211.00,,,,"
  transId: "MTID01"
  lot: "2023-01-05"
  basis: "211"
  Assets:SB:WHS:FAKE          20 FAKE { 10 USD, 2023-01-05 }
  Assets:SB:WHS:CASH          -200 USD
  Assets:SB:WHS:CASH          -11 USD
  Expenses:SB:WHS:Fees:Commissions:FAKE          11 USD

2023-01-10 * "Sold 20 FAKE @ 40 (LOT 2023-01-05)"
  input: "01/10/2023,MTID02,Sold 20 FAKE @ 40 (LOT 
2023-01-05),20,FAKE,40,11,787,2,,,"
  transId: "MTID02"
  lot: " adjust lots sold and long or short term gain and acct "
  gainorloss: "787 - basis"
  Assets:SB:WHS:FAKE          -20 FAKE { 10 USD, 2023-01-05 } @ 40 USD
  Assets:SB:WHS:CASH          800 USD
  Assets:SB:WHS:CASH          -11 USD
  Expenses:SB:WHS:Fees:Commissions:FAKE          11 USD
  Assets:SB:WHS:CASH          -2 USD
  Expenses:SB:WHS:Fees:RegFees:FAKE          2 USD
  Income:SB:WHS:PnL:FAKE

=====

  my questions are:

  1. is there a way without a plugin to go back and grab the
      basis from the meta field "basis:" value of the purchase or 
      will i need the plugin to do that?  [*]

  2. the PnL value of the above is wrong, but when i get the 
      correct amounts then i can fill in that field with the
      real value, but then the leftovers have to go or come 
      from some account, but i'm assuming that will be an 
      Equity account?

      so in the end those last two lines would look something like
     the following or the transactions will not balance:

  Income:SB:WHS:PnL:FAKE 800 (gross amt) - (13 (fees) + 211 (basis)) USD
  Equity:SB:WHS<some more name or just leave as this?  not sure yet>

  does this make sense?

  i did not plan on reprocessing all of the input files in my 
importer to generate a list of open positions and holdings but that
might be what i end up having to do to deal with keeping the basis
and splits, but i sure would like it if there was an easier way to 
do that then having to reinvent this all over again.

  thanks for your comments and pointers.  :)


  general excitement comments follow:  :)

  i'm actually psyched because i now have the prototype that 
will at least get my existing csv files from TDA to scan and 
feed into the ledger files without errors and that's a nice 
place i didn't expect to get to for another month or so.

  cleaning up the code and making it pretty wasn't a part of my
initial plan and if it does what i need it to do and then i'm
done i may not even bother with that - we'll see, i just wanted
something that mostly worked and was straightforwards.


[*] and yes, i know if i'm only selling partial lots i will have 
to do a manual adjustment or figure something else out (and 
splits are a pain in the butt - i'm still going to have to deal 
with those) and going back and adjusting basis or something and
also figuring out the short term vs. long term account difference
is not too bad since i normally have been tracking the lots any-
ways by using the date).


  fin

-- 
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/8pe3cj-sbl.ln1%40anthive.com.

Reply via email to