Open transfix opened 8 years ago
Additionally (and perhaps prior to developing the above), I was thinking of supporting multiple arguments for get_price such that you can input a list of (amount, from_asset) pairs and a final symbol as the base (to_asset), and it will return list of prices for quantities specified in terms of that base symbol along with the sum of all prices.
Let's remove the idea of baskets from PriceNetwork and make an actual PriceSource to handle baskets, then just add them to the network like any other price source.
Actually even better, I forgot about just using the Conversions source for baskets too- let's just write a module to make it easy to specify baskets but have it just define them using the Conversions source.
I still need to remove basket code in PriceNetwork and add it to Conversions...
Note: The expressions in the settings file for each conversion should be well formed python code that could be evaluated at a typical REPL
The latest approach is to use the new account module to define a portfolio held by a "basket" account such as an account for the fund itself.
We need to add a feature that makes available a price for a synthetic symbol who's value is calculated by the underlying prices of assets and quantities held in a basket represented by that symbol. This would make it easy to track the net asset value of a hypothetical fund as a symbol as if it is just another trade-able asset known by the PriceNetwork.
They way I imagine it to be implemented would be to add a function to PriceNetwork called set_basket that would take 2 arguments: a basket symbol name and a dictionary of symbols mapped to quantities, e.g.:
For completeness we should probably also add a remove_basket():
Finally, we would need to add the functions as commands for slack (not webapi for now since it is read only).