-
Notifications
You must be signed in to change notification settings - Fork 857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to run interactive_update_capital_manual() tool on newly setup data #716
Comments
I fixed this locally by removing the squeeze, which is surely not what we want. I have a bunch more changes to commit as a PR. |
This is a real bloody mess. The entire way total capital is stored is really complicated for no reason. I have no idea why I did it this way. It will take slightly longet, but a full rewrite of this code is required I feel. |
The basic problem is that total capital is stored as 4 seperate series, rather than a single dataframe. Everything runs through sysproduction.data.dataCapital (ah the beauties of abstraction)
I don't see any reason to change the idea of the total capital calculator, which both holds capital data and stores it. None of the above seems especially wrong. So we can move down to the next level of abstraction capitalData and totalCapitalCalculationData It's in totalCapitalCalculationData that the idea of storing seperate capital series for each type of total capital and munging them together is implemented. We could modify capitalData so it stores everything together, and then passes it out seperately, but it would be cleaner to change both the the storage object (capitalData) and the calculation object (totalCapitalCalculationData) A key question with this kind of change to database storage is whether we make it seamless, or force the user to run a script to rewrite their capital storage. |
It strikes me that it would make sense to seperate out the storage of strategy capital (which we can use the original code for) and total capital (which we want to change). Let's do that first. |
On reflection, it probably makes sense to store all the capital for both strategy and total in arctic. |
Pretty much done this, need to test on my production machine. |
There's still a few problems with the recent capital changes
I think the problem is that when you initially setup capital, each value is stored as a float. But later, some other downstream code assumes a pd.Series, including manually updating the capital. In addition, there's a few places where missing or unexpected return values are not handled. For example:
syscore.pdutils.uniquets()
assumes that a DataFrame is passed to it, even though in some places the calling function can passmissing_data
. An example of this issysdata.production.capital.get_capital_pd_series_for_strategy()
I tried to fix this by changing
uniquets()
like so:But even then, in the above example, the pandas method
squeeze()
is called on the result, throwing another exception...@robcarver17 when you get a moment could have a look? Maybe with your "fan of defensive programming" hat on 😃 no urgency, I have a workaround
The text was updated successfully, but these errors were encountered: