Skip to content

Change weights based on precomputed array #210

Answered by polakowo
al33m501 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @al33m501,

specifically for the function pre_segment_func_nb, you can read about various c fields here. The current index (= row) can be accessed using c.i, while the current group (= range of columns that share the same capital) ranges between c.from_col and c.to_col. You can then do my_array[c.i, c.from_col:c.to_col] to access elements that belong to this segment, given that you built your array properly - it must be of the same shape as your price. Since in pre_sim_func_nb we defined that each 30th segment is active while all others are inactive, your c.i will be 30, 60, 90, etc.

If you want to rebalance on custom periods (for example, each 1st of the month), instead of changing seg…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@al33m501
Comment options

Answer selected by al33m501
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants