Class PositionTransferContract<A>
A contract that transfers a Position<A> from one Signatory to another at a fixed TimeStamp (its maturity).
public sealed record PositionTransferContract<A> : IWithMaturity, IContract, IEquatable<IContract>, IEquatable<PositionTransferContract<A>> where A : IFixedPointAmount<A>
Type Parameters
AThe fixed-point amount type measuring the position.
- Inheritance
-
PositionTransferContract<A>
- Implements
- Inherited Members
Examples
var from = Signatory.New();
var to = Signatory.New();
var pos = Position.Of(100, CurrencyIdentifier.USD);
var at = TimeStamp.New(2024, 12, 31);
var id = ContractIdentifier.NewWithUuid();
var contract = new PositionTransferContract<DecimalAmount>(pos, from, to, at, id);
Remarks
IContract and IWithMaturity are non-generic, so a contract registry or history holding IContract is unaffected by the type parameter.
Constructors
PositionTransferContract(Position<A>, Signatory, Signatory, TimeStamp, ContractIdentifier)
Construct a position-transfer contract.
public PositionTransferContract(Position<A> position, Signatory from, Signatory to, TimeStamp at, ContractIdentifier id)
Parameters
positionPosition<A>fromSignatorytoSignatoryatTimeStampidContractIdentifier
Properties
At
The settlement time.
public TimeStamp At { get; }
Property Value
From
The transferring party.
public Signatory From { get; }
Property Value
Id
public ContractIdentifier Id { get; }
Property Value
Position
The position being transferred.
public Position<A> Position { get; }
Property Value
- Position<A>
To
The receiving party.
public Signatory To { get; }
Property Value
Methods
Equals(IContract?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(IContract? other)
Parameters
otherIContractAn object to compare with this object.
Returns
IsRelatedTransaction(ITransaction)
Returns true iff the transaction targets this contract.
public bool IsRelatedTransaction(ITransaction transaction)
Parameters
transactionITransactionCandidate transaction.
Returns
VerifyMessages(IEnumerable<IMessage>, IScenarioHistory)
Validates the supplied messages against the contract and the prior
scenario history, returning the subset of transactions deemed valid.
Returns null when the input is invalid for this contract at the
current time.
public IEnumerable<ITransaction>? VerifyMessages(IEnumerable<IMessage> messages, IScenarioHistory scenarioHistory)
Parameters
messagesIEnumerable<IMessage>Candidate messages arriving at this step.
scenarioHistoryIScenarioHistoryFull history of prior scenarios.