Show HN: Finstruments - Financial instrument library built with Python

github.com

29 points by kyleloomis 9 hours ago

finstruments is a Python library designed for modeling financial instruments. It comes with the core financial instruments, such as forwards and options, out of the box, as well as position, trade, and portfolio models. finstruments comes with the basic building blocks, making it easy to extend and build new instruments for any asset class. These building blocks also provide the functionality to serialize and deserialize to and from JSON, enabling the ability to store a serialized format in a document database. This library is ideal for quantitative researchers, traders, and developers who need a streamlined way to build and interact with financial instruments.

qsi an hour ago

My Python skills are pretty limited, so it's likely I am missing what's obvious, but I don't understand what the purpose of this library is. "Modeling financial instruments" is vague; is it for backtesting? Calculating option pay-offs? Tracking portfolio P&L? Risk management? Is there an example of what you would use it for?

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!

kyleloomis 9 hours ago
  • KeplerBoy 4 hours ago

    The scrolling animation / progress indicator thingy on your blog seems broken by the way. It quickly moves out of the visible view on a pretty normal setup (24" FHD screen, Linux, Firefox).

  • is_true 3 hours ago

    Do you have any recommendations on how to store financial data?

  • jk4930 5 hours ago

    I'd have to use it first to comment on it, but thanks so far. Article makes a good impression.

keithalewis an hour ago

Do you have an example of a convertible bond?