-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
Custom order initialization for all Portfolio class-based methods #588
Comments
There are ways to change any order-related info of a signal. Provide a field you want to change as an array with one element to from_signals. Also use a template to pass the same array to the signal function. In the signal function, modify the only element of that array to the information you want to use at this row/column (this works thanks to flexible indexing). Another way is to disable keep_raw for the argument you want to change such that an array of the full shape is build, and then set each element in that array in the signal function (size[c.i, c.col] = current_size) |
Thanks for the quick reply. Although none of these approaches exactly solve my particular issue, I implemented the first in a way that still doesn't work but is a good starting point for discussion. The signal function I would like to use:
. And this is the code, based on the hyperparameter optimization example[1], that would use the signal function to manipulate fees internally:
. The most important remarks for this implementation are:
|
Think of how
Portfolio.from_order_func(...)
[1] allows to construct orders based on arbitrary, user-defined logic, but extended to allPortfolio.from_.*(...)
functions.This feature request (that, if valid, I do offer myself to implement) comes from the need to specify variable fixed_fees for each order generated inside a
Portfolio.from_signals(...)
call.I wasn't able to find a way to either:
Portfolio.from_signals(...)
.[1] vectorbt/portfolio/base.py#L3145
The text was updated successfully, but these errors were encountered: