I'm building a strategy, where I want the system to run only once per day. Here's the start of my code:
def initialize(context): set_commission(commission.PerShare(cost=0.0075, min_trade_cost=1)) set_slippage(slippage.VolumeShareSlippage(volume_limit=0.025, price_impact=0.10)) schedule_function = (my_system, date_rules.every_day(), time_rules.market_close(hours=1)) context.spy = sid(8554) context.aapl = sid(24) def my_system(context, data): # trading strategy, signal generation, and trade execution .............................
Also, "my_system" is the function that has all my strategy code, such as signal generation, trading execution, and rebalancing. But for some reason, the backtest doesn't work, and I get the error message:
"Local variable 'schedule_function' is assigned to but never used"
Why is this?