public Controller(string name, string addr, ActionQueue actionQueue, ZContext ctx = null) { if (ctx == null) { ctx = ZContext.Current; } _actionQueue = actionQueue; _name = name; _tag = "[" + _name + "] "; Socket = new ZSocket(ctx, ZSocketType.ROUTER); Socket.Bind(addr); BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; var methods = GetType() .GetMethods(flags) .Where(x => x.GetCustomAttributes(typeof(Command), false).Length > 0); foreach (var method in methods) { string cmd = MethodNameToCommandName(method.Name); _commands[cmd] = method; } _subscriptions = new ConcurrentDict <string, SubscriptionDefinition>(); _subscriptions.Initializer = () => new SubscriptionDefinition(); _subLocks = new ConcurrentDict <string, object>(); _subLocks.Initializer = () => new object(); }
public MDController(string name, string addr, ActionQueue actionQueue, ZContext ctx = null) : base(name, addr, actionQueue, ctx) { _ctsSubscriptions = new ConcurrentDict <string, CTSSubDef>(); _ctsSubscriptions.Initializer = () => new CTSSubDef(); CAPABILITIES.Add("LIST_DIRECTORY"); CAPABILITIES.Add("SUBSCRIBE"); CAPABILITIES.Add("GET_TICKER_FIELDS"); CAPABILITIES.Add("GET_TICKER_INFO_PRICE_TICK_SIZE"); CAPABILITIES.Add("GET_TICKER_INFO_VOLUME_TICK_SIZE"); CAPABILITIES.Add("PUB_ORDER_BOOK_POSITIONS"); CAPABILITIES = new JArray(CAPABILITIES.OrderBy((x) => x.ToString())); AVAILABLE_QUOTES = new JObject(); AVAILABLE_QUOTES["ask_price"] = null; AVAILABLE_QUOTES["ask_size"] = null; AVAILABLE_QUOTES["ask_num_orders"] = null; AVAILABLE_QUOTES["bid_price"] = null; AVAILABLE_QUOTES["bid_size"] = null; AVAILABLE_QUOTES["bid_num_orders"] = null; AVAILABLE_QUOTES["daily"] = new JObject(); AVAILABLE_QUOTES["daily"]["volume"] = null; AVAILABLE_QUOTES["daily"]["num_trades"] = null; AVAILABLE_QUOTES["daily"]["high"] = null; AVAILABLE_QUOTES["daily"]["low"] = null; }