Lean
$LEAN_TAG$
SettlementModelPythonWrapper.cs
1
/*
2
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
3
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*
15
*/
16
17
using
Python
.Runtime;
18
using
QuantConnect
.
Securities
;
19
20
namespace
QuantConnect.Python
21
{
22
/// <summary>
23
/// Provides an implementation of <see cref="ISettlementModel"/> that wraps a <see cref="PyObject"/> object
24
/// </summary>
25
public
class
SettlementModelPythonWrapper
:
BasePythonWrapper
<ISettlementModel>,
ISettlementModel
26
{
27
/// <summary>
28
/// Constructor for initialising the <see cref="SettlementModelPythonWrapper"/> class with wrapped <see cref="PyObject"/> object
29
/// </summary>
30
/// <param name="model">Settlement Python Model</param>
31
public
SettlementModelPythonWrapper
(PyObject model)
32
: base(model)
33
{
34
}
35
36
/// <summary>
37
/// Applies cash settlement rules using the method defined in the Python class
38
/// </summary>
39
/// <param name="applyFundsParameters">The funds application parameters</param>
40
public
void
ApplyFunds
(
ApplyFundsSettlementModelParameters
applyFundsParameters)
41
{
42
InvokeMethod
(nameof(
ApplyFunds
), applyFundsParameters);
43
}
44
45
/// <summary>
46
/// Scan for pending settlements using the method defined in the Python class
47
/// </summary>
48
/// <param name="settlementParameters">The settlement parameters</param>
49
public
void
Scan
(
ScanSettlementModelParameters
settlementParameters)
50
{
51
InvokeMethod
(nameof(
Scan
), settlementParameters);
52
}
53
54
/// <summary>
55
/// Gets the unsettled cash amount for the security
56
/// </summary>
57
public
CashAmount
GetUnsettledCash
()
58
{
59
var result = InvokeMethod<CashAmount?>(nameof(
GetUnsettledCash
));
60
if
(result ==
null
)
61
{
62
return
default
;
63
}
64
65
return
result.Value;
66
}
67
}
68
}
Common
Python
SettlementModelPythonWrapper.cs
Generated by
1.8.17