Hi, I'd like to set different delays of "buy market on close" by the size of the portfolio (see below). However, starting_dollars is only called once with Initialize. Any thoughts?
def initialize(context):
context.stock = sid(stock)
starting_dollars = context.portfolio.portfolio_value
limit = starting_dollars / 25000
schedule_function(close_positions, date_rules.every_day(), time_rules.market_close(minutes = limit))