I'll take a stab at your initial questions...
1. I probably payed for borrowing stocks, where is it indicated how much ?
Quantopian assumes money is free and you don't pay any interest. There is a property 'context.account.accrued_interest' which is populated in real IB trading but for backtests it is 0.
2. It seems that I can't use this 20K to buy things, Only my original 10K. So why I see it in my cash ?
The 'target_percent' method places an order for the requested percentage of portfolio_value and NOT a percentage of available cash (portfolio_value = positions_value + cash) In your example, the portfolio_value was $10,000 (positions_value = -$10,000 + cash = +$20,000). So, 'order_target_percent(sid(5061), 0.5)' would order 50% of the portfolio value or $5000.
3. So what is my limit ?
Quantopian assumes you are Warren Buffet. They will keep lending you money. It just magically shows up in your account. You will see this as an increase in context.account.leverage. An algorithm must manage trading to keep this to a reasonable number. A value of 1 to 2 is reasonable. The Quantopian contest requires this to be below 3. How much is 'borrowed' will be the difference between the current cash (context.portfolio.cash) and cash you started with (context.portfolio.starting_cash).
4. I guess I'm paying to someone money to sell short for more money then I have, how much ? In what variable it indicated ?
As in question 1, Quantopian assumes no borrowing costs during backtests.
The accounting for short positions is very straightforward if one remembers two accounting rules.
A buy always increases shares and reduces cash.
A sell always reduces shares and increases cash.
When taking a long position, one is first placing a buy and then placing a sell.
When taking a short position, one is first placing a sell and then placing a buy (just the reverse).
#An example of taking a long position of XYZ
#assuming XYZ sells for $10 and $0 commission and a starting balance of $10,000
order_target_percent(xyz, 1)
#Buy reduces cash by $10,000 and increases positions_value by $10,000.
#So cash = $0 and positions_value = $10,000
#now we sell..
order_target_percent(xyz, -1)
#Sell increases cash by $10,000 and reduces positions_value by $10,000.
#So cash = $10,000 and positions_value = $0
Pretty strightforward and obvious.
#Now what if we took a short position of XYZ.
#assuming XYZ sells for $10 and $0 commission and a starting balance of $10,000
#All that means is we sell BEFORE we buy it. So...
order_target_percent(xyz,- 1)
#Sell increases cash by $10,000 and reduces positions_value by $10,000.
#So cash = $20,000 and positions_value = $-10,000
#now we buy...
order_target_percent(xyz, 1)
#Buy reduces cash by $10,000 and increases positions_value by $10,000.
#So cash = $10,000 and positions_value = $0
Notice that at all times the portfolio_value = $10,000. The amount you needed to 'borrow' will be the difference between the current cash (context.portfolio.cash) and cash you started with (context.portfolio.starting_cash). In the short sale case this would be $20,000-$10,000 = $10,000.
Maybe take a look at this post https://www.quantopian.com/posts/a-few-questions-on-short-selling-and-sell-orders. There are others too. The mechanics of short selling is a question that comes up a lot. You can keep it straight by just remembering the two accounting rules above.
Good luck.