Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Can't order more than 100000000000 shares?

So I've tried to run a backtest on my algorithm with a starting hypothetical capital of 10K from early 2007 until April 2018

and about 2013, I get the message that "Can't order more than 100000000000 shares"

This was the full backtest prior to crashing

https://imgur.com/a/GNSKHYs

Just so you know, though, I make sure the sum of all absolute value of weights add up to 1 or less, for which, say, weights[i] = percentage of the capital that should be allocated in the i'th securities with negative percentage being shorting

4 responses

Also to be clear, the backtest was dealing with about 22 securities of which all of them are not penny stocks and are world famous corps (SBUX, AAPL, ...etc) (primarily since dealing with 414 securities was taking too long even when using online machine learning)

    for i in range(1,390,30):  
        schedule_function(open_positions,date_rules.every_day(),time_rules.market_open(minutes=i))  

this is what i'm using to execute schedule_function every 30 minutes
and so every 30 minutes, it comes up with a weight vector such that weight[i] = target percent for i'th securities
then, I use
```

for i in range(0,len(weights)):  
    asset = context.securities[i]  
    percentweight = weights[i]  
    if L1norm < 1.2 and percentweight < 1.2:  
        order_target_percent(asset,percentweight)

(the L1 norm in the if-statement refers to the L1 norm of the weights vector and is meant as an another "safety switch" to make sure that the leverage is maintained at 1:1) 

So, hypothetically if at t = 0, weights = [0.5, 0.5] , and at t = 1 (30 minutes later), weights = [0.25, 0.75], then  
my code doesn't sell the positions before buying them back at 0.25 and 0.75 respectively, but rather just sets the target percent of it  

i have the same issue

100 billion shares? I don’t think any company has that many shares outstanding.

Apple for example has fewer than 5 billion shares outstanding. One can’t just order 5 billion shares of Apple and expect the order to get filled however. :)

I’d also check your leverage usage that it’s realistic.