Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 6.635% Drawdown 17.000% Expectancy 0 Net Profit 52.290% Sharpe Ratio 0.625 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 3.392 Annual Standard Deviation 0.076 Annual Variance 0.006 Information Ratio 0.442 Tracking Error 0.076 Treynor Ratio 0.014 Total Fees $0.00 |
from clr import AddReference AddReference("System") AddReference("QuantConnect.Algorithm") AddReference("QuantConnect.Common") from System import * from QuantConnect import * from QuantConnect.Algorithm import * from QuantConnect.Data import SubscriptionDataSource from QuantConnect.Python import PythonData from datetime import date, timedelta, datetime import decimal import numpy as np import math import json class customDataScheduleOn(QCAlgorithm): def Initialize(self): self.SetStartDate(2008, 1, 8) self.SetEndDate(2014, 7, 25) self.SetCash(100000) self.AddData(DollarRupee, "USDINR") # Ignite printClose every 60 minutes self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.Every(TimeSpan.FromMinutes(60)), Action(self.printClose)) def OnData(self, data): if not data.ContainsKey("USDINR"): return if not self.Portfolio.Invested: self.SetHoldings("USDINR",1) # Print close price to log file def printClose(self): closePrice = self.Securities["USDINR"].Close self.Log("self.Time : " + str(self.Time) + " - closePrice : " + str(closePrice)) class DollarRupee(PythonData): '''Dollar Rupe is a custom data type we create for this algorithm''' def GetSource(self, config, date, isLiveMode): return SubscriptionDataSource("https://www.dropbox.com/s/m6ecmkg9aijwzy2/USDINR.csv?dl=1", SubscriptionTransportMedium.RemoteFile) def Reader(self, config, line, date, isLiveMode): if not (line.strip() and line[0].isdigit()): return None # New USDINR object currency = DollarRupee() currency.Symbol = config.Symbol try: data = line.split(',') currency.Time = datetime.strptime(data[0], "%Y-%m-%d") currency.Value = decimal.Decimal(data[1]) currency["Close"] = float(data[1]) except ValueError: # Do nothing return None return currency