Table of Contents

Class PositionTransferContract<A>

Namespace
Virtufin.Base
Assembly
Virtufin.Base.dll

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

A

The 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

position Position<A>
from Signatory
to Signatory
at TimeStamp
id ContractIdentifier

Properties

At

The settlement time.

public TimeStamp At { get; }

Property Value

TimeStamp

From

The transferring party.

public Signatory From { get; }

Property Value

Signatory

Id

public ContractIdentifier Id { get; }

Property Value

ContractIdentifier

Position

The position being transferred.

public Position<A> Position { get; }

Property Value

Position<A>

To

The receiving party.

public Signatory To { get; }

Property Value

Signatory

Methods

Equals(IContract?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(IContract? other)

Parameters

other IContract

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

IsRelatedTransaction(ITransaction)

Returns true iff the transaction targets this contract.

public bool IsRelatedTransaction(ITransaction transaction)

Parameters

transaction ITransaction

Candidate transaction.

Returns

bool

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

messages IEnumerable<IMessage>

Candidate messages arriving at this step.

scenarioHistory IScenarioHistory

Full history of prior scenarios.

Returns

IEnumerable<ITransaction>