Algorithm Analysis notebook

Start AlgorithmAnalysis

  • Add the references and imports
  • Create a AlgorithmAnalysis instance

Find your user id and api access token at https://www.quantconnect.com/account


In [ ]:
%matplotlib inline
# Imports
from clr import AddReference
AddReference("System")
AddReference("QuantConnect.Common")
AddReference("QuantConnect.Jupyter")
from QuantConnect import *
from QuantConnect.Jupyter import *
from datetime import datetime
import matplotlib.pyplot as plt

user_id = 0
api_access_token = ""

# Create an instance
aa = AlgorithmAnalysis(user_id, api_access_token)

List projects

It may take a few seconds if you have a lot of projects


In [ ]:
aa.ListProjects().head(10)   # List the 10 last modified projects

List backtests

Lists all backtest from a given project

It may take a few seconds if you have a lot of projects


In [ ]:
aa.ListBacktests(628051)

Read out the orders of a specific backtest


In [ ]:
aa.GetOrders(628051, "4fdd334f2a04c0197342b6870bcc93d1")

Read out the P/L of a specific backtest

Use DataFrame cumsum method to compute the cumulative returs and plot


In [ ]:
aa.GetProfitLoss(628051, "f2f9b85264e5edd4c9ea957a314ec573").cumsum().plot()