Overall Statistics
Total Orders
453
Average Win
4.66%
Average Loss
-4.10%
Compounding Annual Return
31.448%
Drawdown
66.100%
Expectancy
0.116
Net Profit
73.017%
Sharpe Ratio
0.735
Sortino Ratio
0.801
Probabilistic Sharpe Ratio
27.160%
Loss Rate
48%
Win Rate
52%
Profit-Loss Ratio
1.14
Alpha
0.303
Beta
0.745
Annual Standard Deviation
0.587
Annual Variance
0.345
Information Ratio
0.455
Tracking Error
0.569
Treynor Ratio
0.58
Total Fees
$0.00
Estimated Strategy Capacity
$340000.00
Lowest Capacity Asset
ETHUSD 2XR
Portfolio Turnover
60.78%
#region imports
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Globalization;
    using System.Drawing;
    using QuantConnect;
    using System.Text.RegularExpressions;
    using QuantConnect.Algorithm.Framework;
    using QuantConnect.Algorithm.Framework.Selection;
    using QuantConnect.Algorithm.Framework.Alphas;
    using QuantConnect.Algorithm.Framework.Portfolio;
    using QuantConnect.Algorithm.Framework.Execution;
    using QuantConnect.Algorithm.Framework.Risk;
    using QuantConnect.Algorithm.Selection;
    using QuantConnect.Parameters;
    using QuantConnect.Benchmarks;
    using QuantConnect.Brokerages;
    using QuantConnect.Util;
    using QuantConnect.Interfaces;
    using QuantConnect.Algorithm;
    using QuantConnect.Indicators;
    using QuantConnect.Data;
    using QuantConnect.Data.Consolidators;
    using QuantConnect.Data.Custom;
    using QuantConnect.DataSource;
    using QuantConnect.Data.Fundamental;
    using QuantConnect.Data.Market;
    using QuantConnect.Data.UniverseSelection;
    using QuantConnect.Notifications;
    using QuantConnect.Orders;
    using QuantConnect.Orders.Fees;
    using QuantConnect.Orders.Fills;
    using QuantConnect.Orders.Slippage;
    using QuantConnect.Scheduling;
    using QuantConnect.Securities;
    using QuantConnect.Securities.Equity;
    using QuantConnect.Securities.Future;
    using QuantConnect.Securities.Option;
    using QuantConnect.Securities.Forex;
    using QuantConnect.Securities.Crypto;   
    using QuantConnect.Securities.Interfaces;
    using QuantConnect.Storage;
    using QCAlgorithmFramework = QuantConnect.Algorithm.QCAlgorithm;
    using QCAlgorithmFrameworkBridge = QuantConnect.Algorithm.QCAlgorithm;
#endregion

namespace QuantConnect.Algorithm.CSharp
{
    public class CryptoSlamNFTSalesAlgorithm : QCAlgorithm
    {
        private Symbol _nftSalesSymbol;
        private Symbol _ethSymbol;
        private decimal? _lastAvgSales = null;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 12, 31);
            SetCash(100000);

            _ethSymbol = AddCrypto("ETHUSD", Resolution.Minute).Symbol; 
            // Requesting data
            _nftSalesSymbol = AddData<CryptoSlamNFTSales>("ETH").Symbol;

            // Historical data
            var history = History(new[]{_nftSalesSymbol}, 60, Resolution.Daily);
            Debug($"We got {history.Count()} items from our history request for ETH CryptoSlam NFT Sales data");
        }

        public override void OnData(Slice slice)
        {
            // Retrieving data
            var data = slice.Get<CryptoSlamNFTSales>();
            if (!data.IsNullOrEmpty())
            {
                var currentAvgSales = data[_nftSalesSymbol].TotalPriceUSD / data[_nftSalesSymbol].TotalTransactions;

                // comparing the average sales changes, we will buy ethereum or hold cash
                if (_lastAvgSales != null && currentAvgSales > _lastAvgSales)
                {
                    SetHoldings(_ethSymbol, 1);
                }
                else
                {
                    SetHoldings(_ethSymbol, 0);
                }

                _lastAvgSales = currentAvgSales;
            }
        }
    }
}