public ChannelSubscription(GdaxFeedApi api, Func <IChannel <T> > channelFactory, IEnumerable <IObserver <T> > observers) { this.api = api; this.channel = channelFactory(); this.upstreamSusbcription = ((IObservable <JObject>)api).Subscribe(this.channel as IObserver <JObject>); this.downstreamSusbcriptions = new List <IDisposable>(); foreach (var observer in observers) { this.downstreamSusbcriptions.Add(this.channel.Subscribe(observer)); } api.SubscriptionManager.SubscribeAsync( new SubscriptionRequest { ProductIds = new List <string>(this.channel.ProductIds), Channels = new List <string> { this.channel.Name } }); }
public static ChannelSubscription <PriceMatch> StartMatchChannel(this GdaxFeedApi api, IEnumerable <IObserver <PriceMatch> > observers, params string[] productIds) { return(new ChannelSubscription <PriceMatch>(api, () => new MatchChannel(productIds), observers)); }
public static ChannelSubscription <PriceMatch> StartMatchChannel(this GdaxFeedApi api, IObserver <PriceMatch> observer, params string[] productIds) { return(new ChannelSubscription <PriceMatch>(api, () => new MatchChannel(productIds), new IObserver <PriceMatch>[] { observer })); }
public static ChannelSubscription <Heartbeat> StartHeartbeatChannel(this GdaxFeedApi api, IEnumerable <IObserver <Heartbeat> > observers, params string[] productIds) { return(new ChannelSubscription <Heartbeat>(api, () => new HeartbeatChannel(productIds), observers)); }
public static ChannelSubscription <Heartbeat> StartHeartbeatChannel(this GdaxFeedApi api, IObserver <Heartbeat> observer, params string[] productIds) { return(new ChannelSubscription <Heartbeat>(api, () => new HeartbeatChannel(productIds), new IObserver <Heartbeat>[] { observer })); }
internal SubscriptionManager(GdaxFeedApi api) { this.api = api; this.state = new Dictionary <string, Dictionary <string, int> >(); }