Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 0.163% Drawdown 1.200% Expectancy 0 Net Profit 0.463% Sharpe Ratio 0.161 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.006 Beta -0.269 Annual Standard Deviation 0.008 Annual Variance 0 Information Ratio -1.755 Tracking Error 0.008 Treynor Ratio -0.005 Total Fees $0.04 |
import numpy as np from decimal import * class averagePriceExample(QCAlgorithm): def Initialize(self): self.SetStartDate(2016,1, 1) #Set Start Date self.SetEndDate(2018,10,31) #Set End Date self.SetCash(10000) #Set Strategy Cash self.eurusd=self.AddForex("EURUSD", Resolution.Daily,Market.FXCM) self.SetBrokerageModel(BrokerageName.FxcmBrokerage) self.AveragePrice = None def OnData(self, data): if not self.Portfolio.Invested: # Buy 1000 units self.MarketOrder("EURUSD", 1000) def OnOrderEvent(self, orderEvent): order = self.Transactions.GetOrderById(orderEvent.OrderId) # Log average holding price if order.Status == OrderStatus.Filled: self.AveragePrice = self.Portfolio["EURUSD"].AveragePrice self.Log("Average Price:" + str(self.AveragePrice))