Example #1
0
 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;
 }
Example #2
0
        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]);
        }
Example #3
0
 private IndicatorBase getOrCreate(Id id)
 {
     IndicatorBase result;
     if (!indicsById.TryGetValue(id, out result))
     {
         result = Create(id);
         indicsById.Add(id, result);
     }
     return result;
 }
Example #4
0
 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);
 }
Example #5
0
 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;
 }
Example #6
0
 public Instrument GetInstrument(Id id)
 {
     throw new NotImplementedException();
 }
Example #7
0
 private IndicatorBase Create(Id id)
 {
     IndicatorBase result = (IndicatorBase)Activator.CreateInstance(pluginType, true);
        // result.Initialize(id);
     return result;
 }
Example #8
0
        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;
        }
Example #9
0
 public string GetSymbol(Id id, SymbolType type)
 {
     return txmaps[type][id];
 }
Example #10
0
 private void Initialize(Id id)
 {
     instr = env.GetUniverseService().GetInstrument(id);
     Initialize();
 }
Example #11
0
 public Id CreateId(string[] symbols, SymbolType[] types)
 {
     Id id = new Id(this);
     Add(id, symbols, types);
     return id;
 }