Table of Contents

Class InstrumentCollection

Namespace
Balsam
Assembly
Balsam.Backtester.dll

A collection of instruments indexed by symbol.

public class InstrumentCollection : KeyedCollection<string, Instrument>, IList<Instrument>, ICollection<Instrument>, IReadOnlyList<Instrument>, IReadOnlyCollection<Instrument>, IEnumerable<Instrument>, IList, ICollection, IEnumerable
Inheritance
InstrumentCollection
Implements
Inherited Members
Extension Methods

Constructors

InstrumentCollection()

Initializes an empty instrument collection.

public InstrumentCollection()

InstrumentCollection(IEnumerable<Instrument>)

Initializes a new instrument collection and populates using specified items.

public InstrumentCollection(IEnumerable<Instrument> items)

Parameters

items IEnumerable<Instrument>

Methods

Add(IEnumerable<Instrument>)

Adds the specified instruments to the collection using the symbol as the key.

public void Add(IEnumerable<Instrument> instruments)

Parameters

instruments IEnumerable<Instrument>

FromXElement(XElement)

Converts the specified xml representation to an instrument.

public static Instrument FromXElement(XElement element)

Parameters

element XElement

Returns

Instrument

GetKeyForItem(Instrument)

Returns the instrument symbol.

protected override string GetKeyForItem(Instrument item)

Parameters

item Instrument

Returns

string

Load(string)

Loads the specfied xml file into a new instrument collection.

public static InstrumentCollection Load(string fileName)

Parameters

fileName string

Returns

InstrumentCollection

Save(string)

Saves the instrument collection as xml to the specified file.

public void Save(string fileName)

Parameters

fileName string

ToXElement(Instrument)

Converts the specified instrument to an xml respresentation.

public static XElement ToXElement(Instrument instrument)

Parameters

instrument Instrument

Returns

XElement