Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

using QuantConnect.Data.Market;
using QuantConnect.Orders;
using QuantConnect.Orders.Fees;
using QuantConnect.Orders.Fills;
using QuantConnect.Orders.Slippage;
using QuantConnect.Securities;

namespace QuantConnect
{
    public class AutomatonTrade : QCAlgorithm
    {
    	private List<string> symbolTracker = new List<string>();
    	private bool hasBought = false;
    	
        public override void Initialize()
        {
            // Initialize.
            this.SetStartDate(2017, 1, 2);
            this.SetEndDate(2017, 1, 12);
            this.SetCash(1000);
            this.SetTimeZone(TimeZones.NewYork);

            // Setup brokerage.
            this.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin);

            // Setup universe.
            this.UniverseSettings.Resolution = Resolution.Minute;

        	// Live universe with selection.
        	this.AddUniverse(CoarseSelectionFunction);
        }

        public IEnumerable<Symbol> CoarseSelectionFunction(IEnumerable<CoarseFundamental> coarse)
        {
            var sortedByDollarVolume = coarse
            	.Where(x => x.Volume > 1000000)
                .OrderBy(x => x.Price)
                .ThenByDescending(x => x.DollarVolume)
                .ThenByDescending(x => x.Volume);

            var top = sortedByDollarVolume.Take(200);
            
            this.Log("CoarseSelectionFunction count: " + top.Count());

            return top.Select(x => x.Symbol);
        }
        
        public void OnData(TradeBars data)
        {
        	foreach (TradeBar bar in data.Values)
        	{
        		var currentBuyingPower = this.Portfolio.GetBuyingPower(bar.Symbol, OrderDirection.Buy);
        	}
        }
        
        private void Log(string message)
        {
        	base.Log(message);
        	Debug(message);
        }
    }
}