Josh is right.
And your PvR hits a high of only around 40% and ends at 7.77%. PvR stands for Profit vs. Risk, it is a measure of returns based on amount put into play, and so it is looking more solely at code merit while ignoring starting capital. You can worry about starting capital later when you have an investor in the picture or want to enter the contest.
Usually a problem like this can be resolved to some degree more in line realistically by inserting a line like this:
for one_stock in data:
if get_open_orders(one_stock): continue
...however that didn't do the trick here.
So you might also give track_orders() a try, and I'm interested in knowing whether that helps if you would please, if you try it. (My hunch is some unfilled orders).
It is in Daily mode so far. Your schedule lines are specifying minutes 1 and 10. They may not be running when you expected them to. Add this line in both functions and see what you can make of that. It seems to me they both run at minute zero.
print get_datetime().time().minute
I tend to almost always track cash these days, besides the obvious it offers a sense of when big buys/sells are happening.
record(cash = context.portfolio.cash)
Alright, hope those help. Also here's some code to track PvR:
schedule_function(pvr, date_rules.every_day(), time_rules.market_close())
def pvr(context, data):
c = context
if 'risk_hi' in c:
shorts = 0
for p in c.portfolio.positions:
shrs = c.portfolio.positions[p].amount
if shrs < 0:
shorts += int(abs(shrs * data[p].price))
cash_dip = int(max(0, c.portfolio.starting_cash - c.portfolio.cash))
risk = int(max(cash_dip, shorts)) # Amount in play, maximum of shorts or cash used
c.risk_hi = max(risk, c.risk_hi)
if c.risk_hi != 0: # Avoid zero-divide
record(PvR_Ret = (100 * c.portfolio.pnl / c.risk_hi)) # Profit_vs_Risk returns
else: # Init this instead in initialize() for better efficiency
c.risk_hi = 0