Merge pull request #588 from jlowin/patch-2

Fix code block formatting in release notes
This commit is contained in:
Joe Jevnik
2015-08-05 03:12:18 -04:00
+18 -18
View File
@@ -70,24 +70,24 @@ data[security].stddev(3)
> Also adds `context.get_market_value()`, which enables this functionality.
> For example:
```python
# this is how it works today (and this still works)
# put 50% of my portfolio in AAPL
order_percent('AAPL', 0.5)
# note that if this were a fully invested portfolio, it would become 150% levered.
# take half of my available cash and buy AAPL
order_percent('AAPL', 0.5, percent_of='cash')
# rebalance my short position, as a percentage of my current short book
order_target_percent('MSFT', 0.1, percent_of='shorts')
# rebalance within a custom group of stocks
tech_stocks = ('AAPL', 'MSFT', 'GOOGL')
tech_filter = lambda p: p.sid in tech_stocks
for stock in tech_stocks:
order_target_percent(stock, 1/3, percent_of_fn=tech_filter)
```
> ```python
# this is how it works today (and this still works)
# put 50% of my portfolio in AAPL
order_percent('AAPL', 0.5)
# note that if this were a fully invested portfolio, it would become 150% levered.
>
# take half of my available cash and buy AAPL
order_percent('AAPL', 0.5, percent_of='cash')
>
# rebalance my short position, as a percentage of my current short book
order_target_percent('MSFT', 0.1, percent_of='shorts')
>
# rebalance within a custom group of stocks
tech_stocks = ('AAPL', 'MSFT', 'GOOGL')
tech_filter = lambda p: p.sid in tech_stocks
for stock in tech_stocks:
order_target_percent(stock, 1/3, percent_of_fn=tech_filter)
```
### Major performance enhancements to history (by Dale Jung) [PR488](https://github.com/quantopian/zipline/commit/38e8d5214d46f089020703712dc6b3f4f6ee084d)