Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 539.848% Drawdown 4.400% Expectancy 0 Net Profit 26.998% Sharpe Ratio 19.596 Probabilistic Sharpe Ratio 99.518% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 3.747 Beta 1.15 Annual Standard Deviation 0.215 Annual Variance 0.046 Information Ratio 25.59 Tracking Error 0.149 Treynor Ratio 3.659 Total Fees $12.39 |
from clr import AddReference AddReference("System") AddReference("QuantConnect.Algorithm") AddReference("QuantConnect.Common") AddReference("QuantConnect.Indicators") from System import * from QuantConnect import * from QuantConnect.Algorithm import * from QuantConnect.Brokerages import * from QuantConnect.Orders import * from QuantConnect.Data import * from QuantConnect.Indicators import * #HABRA COTRADICCION CON EL INDICATORS DE ARRIBA? from datetime import timedelta, datetime from QuantConnect.Data.UniverseSelection import * from Selection.FundamentalUniverseSelectionModel import FundamentalUniverseSelectionModel #1. Import Tiingo Data from QuantConnect.Data.Custom.Tiingo import * from math import floor import numpy as np import decimal as d # CODIGO:--> #1- / # 1- # DUDAS : --> #2- / # 2- # FYI: --> #3- / # 3- # Idea : --> #4- / # 4- # INSTRUCTIONS : --> #5- / # 5- # # TASK:--> #6- / # 6- class GeekyFluorescentPinkLeopard(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 1, 1) # Set Start Date / IRBO empieza 2018,6,28 PERO p mas rapido lo pondre 2021,1,1 self.SetCash(100000) # Set Strategy Cash self.SetEndDate(datetime.now() - timedelta(1)) # Or use a relative date. self.AddEquity("DXYN", Resolution.Minute) #Hasta feb 16 tenia 11 insights self.AddEquity("FLGT", Resolution.Minute) #Hasta feb 16 tenia 7 insights self.AddEquity("Z", Resolution.Minute) #Hasta feb 16 tenia 5 insights self.AddEquity("ACUIF", Resolution.Minute) #Hasta feb 16 tenia 5 insights self.AddEquity("VERI", Resolution.Minute) #Hasta feb 16 tenia 4 insights self.AddEquity("SPWR", Resolution.Minute) #Hasta feb 16 tenia 4 insights self.AddEquity("GRBX", Resolution.Minute) #Hasta feb 16 tenia 4 insights self.AddEquity("FCEL", Resolution.Minute) #Hasta feb 16 tenia 4 insights self.AddEquity("ATKR", Resolution.Minute) #Hasta feb 16 tenia 4 insights self.AddEquity("URI", Resolution.Minute) #Hasta feb 16 tenia 3 insights self.AddEquity("RVLV", Resolution.Minute) #Hasta feb 16 tenia 3 insights self.AddEquity("NVEE", Resolution.Minute) #Hasta feb 16 tenia 3 insights self.AddEquity("INOD", Resolution.Minute) #Hasta feb 16 tenia 3 insights self.AddEquity("GRWG", Resolution.Minute) #Hasta feb 16 tenia 3 insights self.AddEquity("CROX", Resolution.Minute) #Hasta feb 16 tenia 3 insights self.AddEquity("CLDX", Resolution.Minute) #Hasta feb 16 tenia 3 insights self.AddEquity("IRBO", Resolution.Daily) # Hasta feb 16 tenia 10 insights irbo = self.AddEquity("IRBO", Resolution.Minute) irbo.SetDataNormalizationMode(DataNormalizationMode.Adjusted) # o sin crear variable: self.Securities["IRBO"].SetDataNormalizationMode(DataNormalizationMode.Adjusted) # Las divisiones y los dividendos se ajustan hacia atrás en el precio del activo. El precio actual es idéntico al precio actual del mercado. Para obtener más información sobre esto, consulte el artículo de Investopedia Adjusted Pricing. # FYI: Son 4 tipos de normalizacion de data, el 2do interesante es : DataNormalizationMode.TotalReturn = Rendimiento de la inversión añadiendo la suma del dividendo al precio inicial del activo. # Idea : Aprender con API? como importar data : https://www.quantconnect.com/docs/algorithm-reference/importing-custom-data # FYI: braquets son para llamar el security # 3-The self.Consolidate() method takes a ticker, timedelta, and event handler. It can also take a CalendarType or a Resolution parameter. # 1- self.Consolidate("IRBO", timedelta(minutes=45), self.OnDataConsolidated) # 3- Receive consolidated data with a CalendarType: # 1- self.Consolidate("IRBO", CalendarType.Weekly, self.OnDataConsolidated) # 3- Receive consolidated data with a Resolution: # 1-self.Consolidate("SPY", Resolution.Hour, TickType.Trade, self.OnDataConsolidated) # Create our consolidator with a timedelta of 30 min self.Consolidate("IRBO", timedelta(minutes = 30), self.OnDataConsolidated) self.Securities["IRBO"].SetLeverage(1.0) # TASK: Complete Add Equity API - Including Default Parameters: # FYI: AddEquity(string ticker, Resolution resolution = Resolution.Minute, string market = Market.USA, bool fillDataForward = true, decimal leverage = 0m, bool extendedMarketHours = false) # TASK: Set el SetWarmup! because ..--> Error: Before placing a trade (or using SetHoldings) warm up your algorithm with SetWarmup, or use slice.Contains(symbol) to confirm the Slice object has price before using the data. Data does not necessarily all arrive at the same time so your algorithm should confirm the data is ready before using it. def OnData(self, data): # FYI:The algorithm Self.Portfolio... dictionary also has helper properties for quick look ups of things like: Invested, TotalUnrealizedProfit, TotalPortfolioValue, TotalMarginUsed. You can see more properties in the documentation.:https://www.quantconnect.com/docs/algorithm-reference/securities-and-portfolio if not self.Portfolio.Invested: self.SetHoldings("IRBO", 1) # CODIGO = C-: self.MarketOrder("DXYN", 1) # c-: self.MarketOrder("IRBO", 1) # no se xq no jala si lo copie directo de su codigo! # C-: if self.Portfolio["IRBO"].Invested: # C-: self.Debug("Total unrealized profit: " + str(Portfolio.TotalUnrealizedProfit)) # Display the Quantity of IRBO Shares You Own self.Debug("Pau, Number of Shares: " + str(self.Portfolio["IRBO"].Quantity)) self.Debug("Guapa, exitosa, millonaria, sabrosa jajaj, The average Price is:" + str(self.Portfolio["IRBO"].AveragePrice)) # Consolidators require an event handler function to recieve data. Create a function OnDataConsolidator which saves the currentBar as bar def OnDataConsolidated(self, bar): #3- Check the bar data using EndTime #3- The EndTime of 10am ET is the bar from 9:30am to 10am using a 30 min consolidator #1- if bar.EndTime.hour == 10 and bar.EndTime.minute == 0: #1- self.openingBar = bar #3-Check the time, we only want to work with the first 30min after Market Open #3- Save one bar as openingBar if bar.Time.hour == 9 and bar.Time.minute == 30: # 3- Save the first bar of the trading day self.openingBar = bar pass