diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/01 Key Concepts/02 Set Models.php b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/01 Key Concepts/02 Set Models.php index bf36e97448..6802cc2510 100644 --- a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/01 Key Concepts/02 Set Models.php +++ b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/01 Key Concepts/02 Set Models.php @@ -2,12 +2,14 @@
// In Initialize -var security = AddEquity("SPY"); -security.SetFeeModel(new ConstantFeeModel(0));-
# In Initialize -security = self.add_equity("SPY") -security.set_fee_model(ConstantFeeModel(0))+
public override Initialize() +{ + var security = AddEquity("SPY"); + security.SetFeeModel(new ConstantFeeModel(0)); +}+
def initialize(self): + security = self.add_equity("SPY") + security.set_fee_model(ConstantFeeModel(0))
You can also set the fee model in a security initializer. If your algorithm has a dynamic universe, use the security initializer technique. In order to initialize single security subscriptions with the security initializer, call SetSecurityInitializer
set_security_initializer
before you create the subscriptions.
To model zero transaction fees, use the ConstantFeeModel with zero as fee
.
public override Initialize() +{ + var security = AddEquity("SPY"); + security.SetFeeModel(new ConstantFeeModel(fee: 0m)); +}+
def initialize(self): + security = self.add_equity("SPY") + security.set_fee_model(ConstantFeeModel(fee=0))+ \ No newline at end of file diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/02 Constant Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/02 Constant Model.html index da71b34d93..23e77daa53 100644 --- a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/02 Constant Model.html +++ b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/02 Constant Model.html @@ -1,4 +1,4 @@ -
The ConstantFeeModel
applies the absolute value of a constant fee to each order. It's the default fee model of the DefaultBrokerageModel if you trade Forex, CFD, or Crypto assets.
The ConstantFeeModel
applies the absolute value of a constant fee to each order. It's the default fee model of the DefaultBrokerageModel if you trade Forex, CFD, or Crypto assets. Use this model to set zero transaction fees.
security.SetFeeModel(new ConstantFeeModel(0.05m));@@ -20,13 +20,13 @@
fee
decimal
float
currency
string
str