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