Flatten()

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Add On > Account >

Flatten()

Previous page Return to chapter overview Next page

Definition

Flattens the account on an instrument.

 

Syntax

Flatten(ICollection<Instrument> instruments)

 

Parameters

instruments

A collection of Instrument of the orders to be cancelled

 

 

Examples

ns

Flatten a single instrument


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

 

 

ns

Flatten a list of instruments


// Please note that your 'Using declarations' section needs to have
//
// using System.Collections.ObjectModel;
//
// added in order for this example to compile correctly

 

// instantiate a list of instruments
Collection<Cbi.Instrument> instrumentsToCancel = new Collection<Instrument>();        
 
// add instruments to the collection
instrumentsToCancel.Add(Instrument.GetInstrument("AAPL"));        
instrumentsToCancel.Add(Instrument.GetInstrument("MSFT"));
 
// pass the instrument collection to the Flatten() method to be flattened
Account.Flatten(instrumentsToCancel);