Table of Contents

Class TradeStatsCollection

Namespace
Balsam
Assembly
Balsam.Backtester.dll

A collection of TradeStats.

[ProtoContract]
public class TradeStatsCollection : ICollection<TradeStats>, IEnumerable<TradeStats>, IEnumerable
Inheritance
TradeStatsCollection
Implements
Inherited Members
Extension Methods

Constructors

TradeStatsCollection()

Instantiates a new empty TradeStatsCollection.

public TradeStatsCollection()

TradeStatsCollection(IEnumerable<TradeStats>)

Instantiates a new TradeStatsCollection populating it with the specified items.

public TradeStatsCollection(IEnumerable<TradeStats> items)

Parameters

items IEnumerable<TradeStats>

Properties

Count

Returns the number of items in the collection.

public int Count { get; }

Property Value

int

this[int]

Returns the item at the specified index.

public TradeStats this[int index] { get; }

Parameters

index int

Property Value

TradeStats

Methods

Add(TradeStats)

Adds the specified item to the collection.

public void Add(TradeStats item)

Parameters

item TradeStats

Add(IEnumerable<TradeStats>)

Adds the specified items to the collection.

public void Add(IEnumerable<TradeStats> items)

Parameters

items IEnumerable<TradeStats>

Clear()

Clears the collection.

public void Clear()

Contains(TradeStats)

Returns true if the collection contains the specified item.

public bool Contains(TradeStats item)

Parameters

item TradeStats

Returns

bool

ExportToFile(IEnumerable<string>, string, string)

Exports the specified fields to a text file.

public void ExportToFile(IEnumerable<string> fields, string fileName, string delimiter = ",")

Parameters

fields IEnumerable<string>
fileName string
delimiter string

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<TradeStats> GetEnumerator()

Returns

IEnumerator<TradeStats>

Load(string)

Loads the specified TradeStatsCollection file from disk using the default deserializer.

public static TradeStatsCollection Load(string fileName)

Parameters

fileName string

Returns

TradeStatsCollection

Rank()

Returns an equal-weighted ranking on Sharpe Ratio, MAR Ratio, Ulcer Performanance Index.

public TradeStatsCollection Rank()

Returns

TradeStatsCollection

Rank(IEnumerable<TradeStatRank>)

Returns a ranking based on the specified trade stat fields and weights.

public TradeStatsCollection Rank(IEnumerable<TradeStatsCollection.TradeStatRank> stats)

Parameters

stats IEnumerable<TradeStatsCollection.TradeStatRank>

Returns

TradeStatsCollection

Exceptions

ArgumentNullException
InvalidOperationException

Rank(params string[])

Returns an equal-weighted ranking based on the specified TradeStat fields.

public TradeStatsCollection Rank(params string[] stats)

Parameters

stats string[]

Returns

TradeStatsCollection

Exceptions

ArgumentNullException

Remove(TradeStats)

Removes the specified item from the collection.

public bool Remove(TradeStats item)

Parameters

item TradeStats

Returns

bool

Save(Stream)

Saves the collection to a stream using protobuf.

public void Save(Stream stream)

Parameters

stream Stream

Save(string)

Saves the collection to a file using protobuf.

public void Save(string fileName)

Parameters

fileName string

ToString()

Returns a string representation of this TradeStatsCollection object.

public override string ToString()

Returns

string