Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return -78.618% Drawdown 5.700% Expectancy 0 Net Profit -1.988% Sharpe Ratio -2.943 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.154 Beta -101.417 Annual Standard Deviation 0.328 Annual Variance 0.108 Information Ratio -2.976 Tracking Error 0.328 Treynor Ratio 0.01 Total Fees $0.00 |
import numpy as np from decimal import Decimal from datetime import timedelta class VWAP(QCAlgorithm): def Initialize(self): self.SetStartDate(2013, 10, 7) self.SetEndDate(2013, 10, 12) self.SetCash(1000) security = self.AddForex("EURUSD", Resolution.Minute) self.vwap = VolumeWeightedAveragePriceIndicator("EURUSD", 5) hourlyConsolidator = QuoteBarConsolidator(timedelta(hours=1)) hourlyConsolidator.DataConsolidated += self.HourlyBarHandler self.SubscriptionManager.AddConsolidator("EURUSD", hourlyConsolidator) def OnData(self, data): if not self.Portfolio.Invested and self.vwap.IsReady: self.Debug(str(self.vwap.Current.Value)) self.MarketOrder("EURUSD", 5000) def HourlyBarHandler(self, sender, bar): # TradeBar( DateTime time, Symbol symbol, decimal open, decimal high, decimal low, decimal close, decimal volume) # assume the volume is 100 tradeBar = TradeBar(bar.EndTime, bar.Symbol, bar.Open, bar.High, bar.Low, bar.Close, 100) self.vwap.Update(tradeBar)