using System;
using System.Collections;
using System.Collections.Generic;
using QuantConnect.Securities;
using QuantConnect.Models;
namespace QuantConnect {
/***************************************************************************
SECURITY MANAGER CLASS
Acccess or iterate over your stocks/securities, using a string indexed
Dictionary. It is a global in the QCAlgorithm base class, and implements
a Dictionary Interface: IDictionary<string, Security> Securities
THIS IS AN EXAMPLE ALGORITHM FROM THE QUANTCONNECT'S API DOCUMENTATION
***************************************************************************/
public class SecurityManagerExample : QCAlgorithm
{
public override void Initialize()
{
AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute);
}
//You can access the Securities object like:
public void OnData(TradeBars securityData)
{
if (!Portfolio.HoldStock)
{
SetHoldings("SPY", 1);
}
foreach(Security stock in Securities.Values)
{
/*Remember Minute and second resolution data arrives at your algorithm
with time, open, high, low, close and total volume values*/
if (stock.Low > stock.High)
{
Debug("Data is wrong!");
}
}
}
}
}