Overall Statistics
namespace QuantConnect.Securities 
{
    
    public class FXCMTransactionModel : SecurityTransactionModel
    {
        public FXCMTransactionModel() 
        {  }

        public override decimal GetSlippageApproximation(Security security, Order order)
        {
            return 20m; //$ 20 units of currency slippage
        }

        /// <summary>
        /// Default implementation returns 0 for fees.
        /// </summary>
        /// <param name="security">The security matching the order</param>
        /// <param name="order">The order to compute fees for</param>
        /// <returns>The cost of the order in units of the account currency</returns>
        public override decimal GetOrderFee(Security security, Order order)
        {
            return 0m;
        }
    }

} // End QC Namespace
namespace QuantConnect 
{
    /*
    *   QuantConnect University: Overriding Transaction Models
    *
    *   Create your own fee models to better model your brokerage or market conditions. 
    *   With QuantConnect you can configure Slippage, Transaction Fees and Fill Models.
    */
    public class OverrideTransactionModelsAlgorithm : QCAlgorithm
    { 
        string _symbol = "EURUSD";
        bool _boughtToday = false;

        /// <summary>
        /// Initialize your algorithm configuration (cash, dates, securities)
        /// </summary>
        public override void Initialize() 
        {  
            //Set the start and end dates for backtest:
            SetStartDate(2013, 06, 01);
            SetEndDate(DateTime.Now.Date.AddDays(-1));
            
            //Set algorithm cash:
            SetCash(200000);
            
            //Add all the securities you'd like:
            AddSecurity(SecurityType.Forex, _symbol, Resolution.Minute);
            
            Securities[_symbol].TransactionModel = new FXCMTransactionModel();
        }
        
        /// <summary>
        /// TradeBars Data Event Handler - all IBM data passed into the data object: data["IBM"].Close
        /// </summary>
        public void OnData(TradeBars data) 
        {
            //Meaningless algorithm which buys on the 15th day of the month:
            // Using this we can test our $5,000 order fee :)
            if (Time.Day % 15 == 0 && _boughtToday == false) {
                Order(_symbol, 5);
                Debug("Sent order for " + _symbol + " on " + Time.ToShortDateString());
                _boughtToday = true;
            } else if (Time.Day % 15 != 0) {
                _boughtToday = false;
            }
        }
    }
}