Overall Statistics
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))