Flatten()

View as Markdown

Definition

Flattens the account on an instrument.

Syntax

Flatten(ICollection\<instrument\> instruments)

Parameters

ParameterDescription
instrumentsA collection of Instruments for orders to be cancelled and positions closed

Examples

Flatten a single instrument

1Account.Flatten(new [] { Instrument.GetInstrument("ES 12-15") });

Flatten a list of instruments

1// Please note that your 'Using declarations' section needs to have
2//
3// using System.Collections.ObjectModel;
4//
5//added in order for this example to compile correctly
6
7// instantiate a list of instruments
8Collection<cbi.instrument> instrumentsToClose = new Collection<instrument>();
9
10// add instruments to the collection
11instrumentsToClose.Add(Instrument.GetInstrument("AAPL"));
12instrumentsToClose.Add(Instrument.GetInstrument("MSFT"));
13
14// pass the instrument collection to the Flatten() method to be flattened
15Account.Flatten(instrumentsToClose);