/*
* 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;
using QuantConnect.Orders.Fees;
using QuantConnect.Orders.Slippage;
using QuantConnect.Securities;
namespace QuantConnect.Brokerages
{
///
/// Provides properties specific to Alpha Streams
///
public class AlphaStreamsBrokerageModel : DefaultBrokerageModel
{
///
/// Initializes a new instance of the class
///
/// The type of account to be modeled, defaults to does not accept .
public AlphaStreamsBrokerageModel(AccountType accountType = AccountType.Margin)
: base(accountType)
{
if (accountType == AccountType.Cash)
{
throw new ArgumentException(Messages.AlphaStreamsBrokerageModel.UnsupportedAccountType, nameof(accountType));
}
}
///
/// Gets a new fee model that represents this brokerage's fee structure
///
/// The security to get a fee model for
/// The new fee model for this brokerage
public override IFeeModel GetFeeModel(Security security) => new AlphaStreamsFeeModel();
///
/// Gets a new slippage model that represents this brokerage's fill slippage behavior
///
/// The security to get a slippage model for
/// The new slippage model for this brokerage
public override ISlippageModel GetSlippageModel(Security security) => new AlphaStreamsSlippageModel();
///
/// Gets the brokerage's leverage for the specified security
///
/// The security's whose leverage we seek
/// The leverage for the specified security
public override decimal GetLeverage(Security security)
{
switch (security.Type)
{
case SecurityType.Forex:
case SecurityType.Cfd:
return 10m;
default:
return 1m;
}
}
///
/// Gets a new settlement model for the security
///
/// The security to get a settlement model for
/// The settlement model for this brokerage
public override ISettlementModel GetSettlementModel(Security security) => new ImmediateSettlementModel();
}
}