public MetaStrategy(Framework framework, string name) : base(framework, name) { this.strategiesByInstrument = new IdArray <List <Strategy> >(1000); this.strategyById = new IdArray <Strategy>(1000); this.strategyByPortfolioId = new IdArray <Strategy>(1000); this.strategies = new List <Strategy>(); }
public SellSideInstrumentStrategy(Framework framework, string name) : base(framework, name) { this.raiseEvents = false; this.strategyByInstrument = new IdArray <List <SellSideInstrumentStrategy> >(1000); this.strategyByPortfolio = new IdArray <SellSideInstrumentStrategy>(1000); this.strategyBySynthInstrument = new IdArray <SellSideInstrumentStrategy>(1000); this.strategies = new List <Strategy>(); }
public void CopyTo(IdArray <T> array) { array.Clear(); for (int i = 0; i < this.size; ++i) { array[i] = this[i]; } }
public GroupDispatcher(Framework framework) { this.framework = framework; this.listeners = new List <IGroupListener>(); this.listenerTable = new IdArray <List <IGroupListener> >(1000); this.groupByListenerTable = new Dictionary <IGroupListener, List <int> >(); framework.eventManager.Dispatcher.NewGroup += new GroupEventHandler(this.Dispatcher_NewGroup); framework.eventManager.Dispatcher.NewGroupEvent += new GroupEventEventHandler(this.Dispatcher_NewGroupEvent); framework.eventManager.Dispatcher.NewGroupUpdate += new GroupUpdateEventHandler(this.Dispatcher_NewGroupUpdate); framework.EventManager.Dispatcher.FrameworkCleared += new FrameworkEventHandler(this.Dispatcher_FrameworkCleared); }
public Portfolio(Framework framework, string name = "") { this.framework = framework; this.name = name; this.account = new Account(framework); this.fills = new FillSeries(name); this.positions = new List <Position>(); this.positionByInstrument = new IdArray <Position>(1000); this.pricer = framework.portfolioManager.pricer; this.performance = new PortfolioPerformance(this); this.statistics = new PortfolioStatistics(this); }
private void ReadCache() { this.cacheKey = this.file.ReadKey(this.cachePosition, 38); this.cache = ((DataKeyIdArray)this.cacheKey.GetObject()).keys; for (int i = 0; i < this.cache.Size; i++) { if (this.cache[i] != null) { this.cache[i].file = this.file; this.cache[i].number = i; } } }
public double this[byte index] { get { return(this.fields[index]); } set { if (this.fields == null) { this.fields = new IdArray <double>(16); } this.fields[index] = value; } }
public MatchingEngine(Framework framework) : base(framework) { this.id = 101; this.name = "MatchingEngine"; this.fillOnQuote = true; this.fillOnTrade = false; this.fillOnBar = false; this.fillOnLevel2 = false; this.fillMarketOnNext = false; this.fillLimitOnNext = false; this.fillStopOnNext = false; this.fillStopLimitOnNext = false; this.fillAtLimitPrice = true; this.addQueueToOrderText = false; this.orders = new IdArray <List <Order> >(1000); }
public ExecutionSimulator(Framework framework) : base(framework) { this.id = 2; this.name = "ExecutionSimulator"; this.description = "Default execution simulator"; this.url = "www.smartquant.com"; this.fillOnQuote = true; this.fillOnTrade = true; this.fillOnBar = false; this.fillMarketOnNext = false; this.fillLimitOnNext = false; this.fillStopOnNext = false; this.fillStopLimitOnNext = false; this.fillAtLimitPrice = true; this.orders = new IdArray <List <Order> >(1000); }
public override void Write(BinaryWriter writer, object obj) { DataKeyIdArray dataKeyIdArray = (DataKeyIdArray)obj; IdArray <DataKey> keys = dataKeyIdArray.keys; writer.Write(0); writer.Write(keys.Size); for (int i = 0; i < keys.Size; i++) { if (keys[i] != null) { writer.Write(i); keys[i].WriteKey(writer); } } writer.Write(-1); }
public override object Read(BinaryReader reader) { reader.ReadByte(); int size = reader.ReadInt32(); IdArray <DataKey> idArray = new IdArray <DataKey>(size); while (true) { int num = reader.ReadInt32(); if (num == -1) { break; } DataKey dataKey = new DataKey(null, null, -1L, -1L); dataKey.Read(reader, true); idArray.Add(num, dataKey); } return(new DataKeyIdArray(idArray)); }
internal void Init(DataFile file, ObjectKey key) { this.file = file; this.key = key; key.compressionLevel = 0; key.compressionMethod = 0; if (this.cachePosition == -1L) { if (this.buffer_count < 4096) { this.cache = new IdArray <DataKey>(4096); } else { this.cache = new IdArray <DataKey>(this.buffer_count); } this.cacheKey = new ObjectKey(file, "", new DataKeyIdArray(this.cache)); } }
public Strategy(Framework framework, string name) { this.framework = framework; this.Name = name; this.strategiesByInstrument = new IdArray <LinkedList <Strategy> >(1000); this.strategyByOrderId = new IdArray <Strategy>(1000); this.strategies = new LinkedList <Strategy>(); this.status = StrategyStatus.Stopped; this.instruments = new InstrumentList(); this.instrumentCountTable = new IdArray <int>(1000); if (framework != null) { this.portfolio = new Portfolio(framework, this.Name); framework.PortfolioManager.Add(this.portfolio); } this.bars = new BarSeries("", ""); this.equity = new TimeSeries(); this.bids = new TickSeries(""); this.asks = new TickSeries(""); this.stops = new List <Stop>(); this.stopsByInstrument = new IdArray <List <Stop> >(1000); }
public void Clear() { if (this.cache == null) { this.ReadCache(); } if (this.position1 != -1L) { DataKey dataKey = this.ReadKey(this.position1); while (true) { this.file.DeleteKey(dataKey, false); if (dataKey.next == -1L) { break; } dataKey = this.ReadKey(dataKey.next); } } this.count = 0L; this.buffer_count = 0; this.dateTime1 = new DateTime(0L); this.dateTime2 = new DateTime(0L); this.position1 = -1L; this.position2 = -1L; this.isOpenRead = false; this.isOpenWrite = false; this.cache = new IdArray <DataKey>(4096); this.cacheKey.obj = new DataKeyIdArray(this.cache); this.readKey = null; this.writeKey = null; this.deleteKey = null; this.insertKey = null; this.changed = true; this.Flush(); }
public StrategyList() { this.strategies = new List <Strategy>(); this.strategyById = new IdArray <Strategy>(1000); }
private Instrument() { this.legs = new List <Leg>(); this.fields = new IdArray <double>(10); }
internal DataKeyIdArray(IdArray <DataKey> keys) { this.keys = keys; }
public BarFactory(Framework framework) { this.framework = framework; this.itemLists = new IdArray <List <BarFactoryItem> >(1000); this.reminderTable = new SortedList <DateTime, SortedList <long, List <BarFactoryItem> > >(); }