public IndicatorBase getOrCreate(Id id) { Contract.Requires(instr == null, "use this method only on instances created without instrument, to be used as factories"); IndicatorBase result = IndicatorFactory.getOrCreate(this, id); result.Initialize(id); return result; }
protected void Add(Id id, string[] symbols, SymbolType[] types) { if (symbols.Length != types.Length) throw new ArgumentException("symbols.Length != types.Length"); for (int i = 0; i < symbols.Length; i++) Add(id, symbols[i].Trim(), types[i]); }
private IndicatorBase getOrCreate(Id id) { IndicatorBase result; if (!indicsById.TryGetValue(id, out result)) { result = Create(id); indicsById.Add(id, result); } return result; }
internal static IndicatorBase getOrCreate(IPlugin plugin, Id id) { IndicatorFactory result; if (!allIndics.TryGetValue(plugin, out result)) { result = new IndicatorFactory(plugin); allIndics.Add(plugin, result); } return result.getOrCreate(id); }
public IQuoteModel getOrCreateModel(Id id) { IQuoteModel instr; if (!instruments.TryGetValue(id, out instr)) { string symbol = idService.GetSymbol(id, symbolType); instr = CreateQuoteModel(env, backend.getReader(symbol)); instruments.Add(id, instr); } return instr; }
public Instrument GetInstrument(Id id) { throw new NotImplementedException(); }
private IndicatorBase Create(Id id) { IndicatorBase result = (IndicatorBase)Activator.CreateInstance(pluginType, true); // result.Initialize(id); return result; }
private void Add(Id id, string symbol, SymbolType type) { Dictionary<Id, string> txmap = null; if (!txmaps.TryGetValue(type, out txmap)) { txmap = new Dictionary<Id, string>(); txmaps.Add(type, txmap); } txmap[id] = symbol; Dictionary<string, Id> rxmap = null; if (!rxmaps.TryGetValue(type, out rxmap)) { rxmap = new Dictionary<string, Id>(); rxmaps.Add(type, rxmap); } rxmap[symbol] = id; }
public string GetSymbol(Id id, SymbolType type) { return txmaps[type][id]; }
private void Initialize(Id id) { instr = env.GetUniverseService().GetInstrument(id); Initialize(); }
public Id CreateId(string[] symbols, SymbolType[] types) { Id id = new Id(this); Add(id, symbols, types); return id; }