Overall Statistics |
Total Trades 216 Average Win 0.04% Average Loss -0.08% Annual Return -4.391% Drawdown 16.200% Expectancy -0.527 Net Profit -8.786% Sharpe Ratio -0.534 Loss Rate 68% Win Rate 32% Profit-Loss Ratio 0.46 Alpha -0.065 Beta 0.169 Annual Standard Deviation 0.08 Annual Variance 0.006 Information Ratio -0.952 Tracking Error 0.184 Treynor Ratio -0.251 |
using System; using System.Collections; using System.Collections.Generic; using QuantConnect.Securities; using QuantConnect.Models; namespace QuantConnect { /*************************************************************************** PORTFOLIO MANAGER Collection of SecurityHolding objects for the securities you have selected, indexed by the string symbol. This is accessed anywhere in your algorithm: e.g. Portfolio["AA"]. Also automatically calculates important portfolio information and exposes them with public properties: e.g. Portfolio.HoldStock. THIS IS AN EXAMPLE ALGORITHM FROM THE QUANTCONNECT'S API DOCUMENTATION ***************************************************************************/ public class PortfolioManagerExample : QCAlgorithm { string[] symbols = {"IBM", "AOL", "MSFT", "AAPL"}; public override void Initialize() { SetCash(30000); SetStartDate(2010, 2, 2); SetEndDate(2012, 2, 2); foreach (var symbol in symbols) { AddSecurity(SecurityType.Equity, symbol, Resolution.Minute); } } public void OnData(TradeBars securityData) { //Build a portfolio which 25% of each stock if portfolio is empty if (!Portfolio.HoldStock) { foreach (var symbol in symbols) { SetHoldings(symbol, 0.25); } } foreach (var symbol in symbols) { //Access a single Security from the Portfolio Manager if (Portfolio[symbol].UnrealizedProfit >= 0.05m && Portfolio.HoldStock) { Order(symbol, -Portfolio[symbol].Quantity); } } } } }