/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Collections.Generic;
using QuantConnect.Data.Market;
using QuantConnect.Orders;
using QuantConnect.Securities;
using QuantConnect.Statistics;
namespace QuantConnect.Interfaces
{
///
/// Generates trades from executions and market price updates
///
public interface ITradeBuilder
{
///
/// Sets the security manager instance
///
/// The security manager
void SetSecurityManager(SecurityManager securities);
///
/// Sets the live mode flag
///
/// The live mode flag
void SetLiveMode(bool live);
///
/// The list of closed trades
///
List ClosedTrades { get; }
///
/// Returns true if there is an open position for the symbol
///
/// The symbol
/// true if there is an open position for the symbol
bool HasOpenPosition(Symbol symbol);
///
/// Sets the current market price for the symbol
///
///
///
void SetMarketPrice(Symbol symbol, decimal price);
///
/// Applies a split to the trade builder
///
/// The split to be applied
/// True if live mode, false for backtest
/// The for this security
void ApplySplit(Split split, bool liveMode, DataNormalizationMode dataNormalizationMode);
///
/// Processes a new fill, eventually creating new trades
///
/// The new fill order event
/// The current security market conversion rate into the account currency
/// The current order fee in the account currency
/// The contract multiplier
void ProcessFill(OrderEvent fill,
decimal securityConversionRate,
decimal feeInAccountCurrency,
decimal multiplier = 1.0m);
}
}