Re:Show HN: Finstruments - Financial instrument library buil...
by kyleloomis on Monday October 28, 2024 @07:16PM
(#41977593)
Finstruments is an instrument definition library, meaning that you can build the specifications of an instrument. Currently, this library is primarily useful for serialization and deserialization to and from JSON, but it can also be used for backtesting, option payoffs, tracking portfolio P&L, risk management, API integration, and document storage.
Regarding the Portfolio class, I opted to distinguish trades from positions. This is useful for tracking and organizational purposes. For example, if you enter into a straddle, it's useful to combine the put and call into one "trade" instead of just a bunch of random positions.
This is a very early work-in-progress, so I would suggest checking back in over the coming weeks for additional instruments and usage details.
I can see the Portfolio class, but it somewhat confusingly uses "Trades" to describe more complex positions (I had assumed a Trade was selling or buying an instrument), and the instruments included are fairly limited. I don't see any bonds, currencies, interest rates, swaps, and others but it looks like an early work in progress, so that's fine. Is it meant to be a generic toolkit to cover the vast majority of financial instruments? I don't understand how characteristics of the instruments are calculated/updated or aggregated into Portfolios.
Some sample code/projects would help me immensely in understanding! (Again, I blame my lack of Python skills).
My apologies for the basic questions!