Overall Statistics
Total Orders
453
Average Win
4.66%
Average Loss
-4.10%
Compounding Annual Return
31.448%
Drawdown
66.100%
Expectancy
0.116
Start Equity
100000.00
End Equity
173016.66
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%
from AlgorithmImports import *
from QuantConnect.DataSource import *

class CryptoSlamNFTSalesAlgorithm(QCAlgorithm):
    
    def initialize(self) -> None:
        self.set_start_date(2019, 1, 1)   # Set Start Date
        self.set_end_date(2020, 12, 31)    # Set End Date
        self.set_cash(100000)

        self.ethusd = self.add_crypto("ETHUSD", Resolution.MINUTE).symbol
        ### Requesting data
        self.eth_nft_sales_symbol = self.add_data(CryptoSlamNFTSales, "ETH").symbol

        ### Historical data
        history = self.history(self.eth_nft_sales_symbol, 60, Resolution.DAILY)
        self.debug(f"We got {len(history)} items from our history request for ETH CryptoSlam NFT Sales data")

        self.last_avg_sales = None

    def on_data(self, slice: Slice) -> None:
        ### Retrieving data
        data = slice.Get(CryptoSlamNFTSales)
        
        if self.eth_nft_sales_symbol in data and data[self.eth_nft_sales_symbol] != None:
            
            current_avg_sales = data[self.eth_nft_sales_symbol].total_price_usd / data[self.eth_nft_sales_symbol].total_transactions

            # comparing the average sales changes, we will buy ethereum or hold cash
            if self.last_avg_sales != None and current_avg_sales > self.last_avg_sales:
                self.set_holdings(self.ethusd, 1)
            else:
                self.set_holdings(self.ethusd, 0)

            self.last_avg_sales = current_avg_sales