diff --git a/Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj b/Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj
index cac852bd079e..1c7346939192 100644
--- a/Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj
+++ b/Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj
@@ -32,7 +32,7 @@
portable
-
+
diff --git a/Algorithm.Framework/QuantConnect.Algorithm.Framework.csproj b/Algorithm.Framework/QuantConnect.Algorithm.Framework.csproj
index 3fcf6c80ee5c..6476a175bd97 100644
--- a/Algorithm.Framework/QuantConnect.Algorithm.Framework.csproj
+++ b/Algorithm.Framework/QuantConnect.Algorithm.Framework.csproj
@@ -29,7 +29,7 @@
LICENSE
-
+
diff --git a/Algorithm.Python/QuantConnect.Algorithm.Python.csproj b/Algorithm.Python/QuantConnect.Algorithm.Python.csproj
index b06316b8e7ad..6483f6f99704 100644
--- a/Algorithm.Python/QuantConnect.Algorithm.Python.csproj
+++ b/Algorithm.Python/QuantConnect.Algorithm.Python.csproj
@@ -37,7 +37,7 @@
-
+
diff --git a/Algorithm/QuantConnect.Algorithm.csproj b/Algorithm/QuantConnect.Algorithm.csproj
index 6c7748030b82..46aff6715ddf 100644
--- a/Algorithm/QuantConnect.Algorithm.csproj
+++ b/Algorithm/QuantConnect.Algorithm.csproj
@@ -29,7 +29,7 @@
LICENSE
-
+
diff --git a/AlgorithmFactory/QuantConnect.AlgorithmFactory.csproj b/AlgorithmFactory/QuantConnect.AlgorithmFactory.csproj
index 081e7e22d804..4aeb20cc51aa 100644
--- a/AlgorithmFactory/QuantConnect.AlgorithmFactory.csproj
+++ b/AlgorithmFactory/QuantConnect.AlgorithmFactory.csproj
@@ -28,7 +28,7 @@
LICENSE
-
+
diff --git a/Common/QuantConnect.csproj b/Common/QuantConnect.csproj
index f6d1c4c74b26..c36e7fc807c8 100644
--- a/Common/QuantConnect.csproj
+++ b/Common/QuantConnect.csproj
@@ -35,7 +35,7 @@
-
+
diff --git a/Engine/QuantConnect.Lean.Engine.csproj b/Engine/QuantConnect.Lean.Engine.csproj
index f65d6f495783..53f0cb795082 100644
--- a/Engine/QuantConnect.Lean.Engine.csproj
+++ b/Engine/QuantConnect.Lean.Engine.csproj
@@ -41,7 +41,7 @@
-
+
diff --git a/Indicators/QuantConnect.Indicators.csproj b/Indicators/QuantConnect.Indicators.csproj
index 7e15053f87ba..c902ba9def89 100644
--- a/Indicators/QuantConnect.Indicators.csproj
+++ b/Indicators/QuantConnect.Indicators.csproj
@@ -31,7 +31,7 @@
-
+
diff --git a/Report/QuantConnect.Report.csproj b/Report/QuantConnect.Report.csproj
index 41ca39388e20..af1b1a04ddea 100644
--- a/Report/QuantConnect.Report.csproj
+++ b/Report/QuantConnect.Report.csproj
@@ -39,7 +39,7 @@
LICENSE
-
+
diff --git a/Research/QuantConnect.Research.csproj b/Research/QuantConnect.Research.csproj
index 19c1c205eb8b..ec3bb5e5de79 100644
--- a/Research/QuantConnect.Research.csproj
+++ b/Research/QuantConnect.Research.csproj
@@ -34,7 +34,7 @@
-
+
diff --git a/Tests/Common/Orders/Fees/OrderFeesTests.cs b/Tests/Common/Orders/Fees/OrderFeesTests.cs
index d81f10cc69a6..a0babded5bdb 100644
--- a/Tests/Common/Orders/Fees/OrderFeesTests.cs
+++ b/Tests/Common/Orders/Fees/OrderFeesTests.cs
@@ -14,7 +14,10 @@
*
*/
+using System;
using NUnit.Framework;
+using Python.Runtime;
+using QuantConnect.Orders;
using QuantConnect.Orders.Fees;
using QuantConnect.Securities;
@@ -44,5 +47,35 @@ public void OrderFeeZeroCanBeConvertedToAccountCurrency()
Assert.AreEqual(0, result3);
}
+
+ [Test]
+ public void OrderFeeIsNumericFromPython()
+ {
+ var fee = new OrderFee(new CashAmount(2m, Currencies.USD));
+ var order = new MarketOrder(Symbols.BTCUSD, 0.123m, DateTime.UtcNow);
+ var orderEvent = new OrderEvent(order, DateTime.UtcNow, new OrderFee(new CashAmount(3m, Currencies.USD)));
+
+ using (Py.GIL())
+ {
+ var module = PyModule.FromString("testModule",
+ @"
+from AlgorithmImports import *
+
+def check(fee: OrderFee, order_event: OrderEvent):
+ fees = [fee, order_event.order_fee]
+ return sum(fees), fee + order_event.order_fee, fee > 0, fee < order_event.order_fee, float(order_event.order_fee), max(fees).value.amount
+");
+
+ dynamic check = module.GetAttr("check");
+ var result = check(fee, orderEvent);
+
+ Assert.AreEqual(5.0, (double)result[0]);
+ Assert.AreEqual(5.0, (double)result[1]);
+ Assert.IsTrue((bool)result[2]);
+ Assert.IsTrue((bool)result[3]);
+ Assert.AreEqual(3.0, (double)result[4]);
+ Assert.AreEqual(3m, (decimal)result[5]);
+ }
+ }
}
}
diff --git a/Tests/Common/Orders/OrderEventTests.cs b/Tests/Common/Orders/OrderEventTests.cs
index 170c6bf3081c..b0ec564f98e0 100644
--- a/Tests/Common/Orders/OrderEventTests.cs
+++ b/Tests/Common/Orders/OrderEventTests.cs
@@ -16,6 +16,7 @@
using System;
using Newtonsoft.Json;
using NUnit.Framework;
+using Python.Runtime;
using QuantConnect.Orders;
using QuantConnect.Orders.Fees;
using QuantConnect.Orders.Serialization;
@@ -169,5 +170,34 @@ public void BackwardsCompatibleDeserialization()
Assert.AreEqual(orderEvent.OrderFee.Value.Amount, deserializeObject.OrderFee.Value.Amount);
Assert.AreEqual(orderEvent.OrderFee.Value.Currency, deserializeObject.OrderFee.Value.Currency);
}
+
+ [Test]
+ public void EnumExtensionMethodsAreCallableFromPython()
+ {
+ var order = new LimitOrder(Symbols.BTCUSD, 0.123m, 100m, DateTime.UtcNow);
+ var orderEvent = new OrderEvent(order, DateTime.UtcNow, OrderFee.Zero) { Status = OrderStatus.Submitted };
+
+ using (Py.GIL())
+ {
+ var module = PyModule.FromString("testModule",
+ @"
+from AlgorithmImports import *
+
+def check(order_event: OrderEvent, order: Order):
+ return (order_event.status.is_open(), order_event.status.is_closed(), order_event.status.IsFill(),
+ order.type.is_limit_order(), order.type.is_stop_order(), Resolution.MINUTE.to_time_span() == timedelta(minutes=1))
+");
+
+ dynamic check = module.GetAttr("check");
+ var result = check(orderEvent, order);
+
+ Assert.IsTrue((bool)result[0]);
+ Assert.IsFalse((bool)result[1]);
+ Assert.IsFalse((bool)result[2]);
+ Assert.IsTrue((bool)result[3]);
+ Assert.IsFalse((bool)result[4]);
+ Assert.IsTrue((bool)result[5]);
+ }
+ }
}
}
diff --git a/Tests/QuantConnect.Tests.csproj b/Tests/QuantConnect.Tests.csproj
index 30dab6a1cacc..93888c6688d5 100644
--- a/Tests/QuantConnect.Tests.csproj
+++ b/Tests/QuantConnect.Tests.csproj
@@ -31,7 +31,7 @@
-
+