Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 1.513% Drawdown 0.100% Expectancy 0 Net Profit 0.081% Sharpe Ratio 3.026 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.022 Beta -0.707 Annual Standard Deviation 0.004 Annual Variance 0 Information Ratio -0.846 Tracking Error 0.004 Treynor Ratio -0.016 Total Fees $0.00 |
from datetime import timedelta class TransdimensionalDynamicThrustAssembly(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 4, 14) # Set Start Date self.SetEndDate(2019, 5, 3) # Set End Date self.SetCash(1000) # Set Strategy Cash # request forex data self.AddForex("NZDUSD", Resolution.Minute, Market.Oanda) self.AddForex("NZDUSD", Resolution.Tick, Market.Oanda) # set brokerage model self.SetBrokerageModel(BrokerageName.OandaBrokerage) def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data''' #ticks = slice["NZDUSD"] #for Tick in Ticks: # self.price = tick.Price newsdates= ["2019,4,16/22:45:00", "2019,4,30/22:45:00", "2019,5,8/2:00:00", "2019,5,8/3:00:00", "2019,5,8/20:00:00", "2019,5,21/22:45:00"] eventTime = datetime.strptime(newsdates[0],'%Y,%m,%d/%H:%M:%S') if self.Time == eventTime- timedelta(minutes=3): self.DoSomething() # if not self.Portfolio.Invested: # self.SetHoldings("SPY", 1) def DoSomething(self): self.StopMarketOrder("NZDUSD", -100, 0.67676-(300*0.00001))