Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
overwrite pipeline variable(s) after criteria is met by portfolio.

Hi,
Is there a way of sending a new value to an existing variable in the pipeline?
For example if I have "x=1" hardcoded at algo launch and in the function "before trading start" I check to see the value of the portfolio is now a certain size "p >= 1000". Since the portfolio is now greater than 1000 I want to send a new value to "x", say "x =2".
Is there a way of doing this similar to ".add()" for factors?
Thanks

2 responses

Based on the overwhelming response and amount of people listening I guess this functionality doesn't exist?

Lyell,
Think of the pipeline output as a spreadsheet computed on a daily basis, where the factors are columns and the rows are assets.
You can find the data-type of the pipeline output and add/subtract/modify columns, if you wish.

For the example you give, using the global variable cache context works fine.
Initial set:
context.x = 1
After your condition
context.x=2

alan