Questions tagged [rx-py]

Reactive Extensions for Python

RxPY is a library for composing asynchronous and event-based programs using observable collections and LINQ-style query operators in Python.

RxPY is open sourced and available under the Apache License, Version 2.0

96 questions
1
vote
1 answer

Partitioned Observable second stream never reached

I have an Observable handling a web request, where I want to handle a success or failure in separate streams, very similar to this example. The main difference between my script and the example is that I do not want merge the streams and then…
thijsfranck
  • 778
  • 1
  • 10
  • 24
1
vote
1 answer

reactivex: how to make a behaviorsubject emit from observable

I'm going to be using rxandroid in an android app. I'm trying to model the behavior right now in rxpy because it was the easiest for me to set up and play with. In the example below, source3 is emitting the correct data; which is a concatenation…
malibu
  • 11
  • 1
1
vote
0 answers

rxpy: buffer_with_time with a random jitter?

I am using buffer_with_time, it accepts a keyword argument: timespan – Length of each buffer (specified as an integer denoting milliseconds) However, the timestamp is fixed. I want to add a random jitter to it. If my parallel task was started at…
est
  • 11,429
  • 14
  • 70
  • 118
1
vote
0 answers

How to add many values to Reactive Subject?

We have a s = Subject() object and a set of subscriptions to its values. We receive data in buckets (say by 1000 items) and currently perform: Observable.from_(data.items).subscribe( lambda x: s.on_next(x)) to activate subscribers and pass data to…
DuckQueen
  • 772
  • 10
  • 62
  • 134
1
vote
0 answers

Stream a csv file with Reactive Programming in Python (RxPy)

I start playing with RxPy but I can't find a way to stream a csv file which represents stock ticker with timestamp. Can someone help me to understand how to use scheduler to go back to my first tick and then stream each line from the csv at the…
wbeuil
  • 87
  • 1
  • 10
1
vote
2 answers

summarizing Observables in reactivex python

With ReactiveX in Python, how can I summarize a stream of Observables? I have a stream of dictionaries that are {"user": "...", "date": ...}. I want to make a function I can apply that accumulate the dictionary with the latest date for each user,…
1
vote
0 answers

Rx - Triggering Stock Price changes in live time?

As an example for a class, I'm trying to figure out the most robust way to create a hot Observable that emits current prices for a given stock ticker, but only have it emit a price when it changes. The best I could come up with on my own is create…
tmn
  • 11,121
  • 15
  • 56
  • 112
1
vote
1 answer

RxPy - Why are emissions interleaved with merging operators?

So I'm learning RxPy after doing RxJava and RxKotlin for two years. One thing I'm noticing is that certain operators cause crazy interleaving that does not happen in RxJava. For example, flat_map() will cause emissions to interleave out of order…
tmn
  • 11,121
  • 15
  • 56
  • 112
1
vote
2 answers

Why repeat(n) does not work with create in Reactive extensions

from rx import Observable, Observer from __future__ import print_function import random def create_observable(observer): while True: observer.on_next(random.randint(1,100)) Observable.create(create_observable).take_while(lambda x:…
Andrew Matiuk
  • 924
  • 1
  • 7
  • 21
1
vote
1 answer

Does RxPy have a `flatten` operator?

Does RxPy have a convenient flatten operator which is equivalent to flat_map(identity)? Or have flat_map's selector default to identity?
mchen
  • 9,808
  • 17
  • 72
  • 125
1
vote
1 answer

Usage of first() in RxPy

How do I recover elements from an Observable sequence in RxPy obs = Observable.from_([1,2,3]) print obs.first() should print 1, but it returns another AnonymousObservable, instead of the element. In general, what is the best operator to recover…
Jaewan Kim
  • 45
  • 5
1
vote
2 answers

Why does an RxPY Observable act as an infinite iterable?

I had a bug which accidentally used an Observable as an iterable. For most objects, this is usually easily detected: >>> tuple(object()) Traceback (most recent call last): File "C:\Program Files…
mchen
  • 9,808
  • 17
  • 72
  • 125
1
vote
2 answers

Building double infinite polling behavior in RX

The problem is to emulate the double looping behavior with RX: while True: try: token = get_token() while True: try: value = get_value_using_token(token) do_something(value) …
Jaewan Kim
  • 45
  • 5
1
vote
1 answer

How to find which version of RxPY I'm using?

I can't remember which version of RxPY I installed and the obvious does not seem to work: In[33]: import rx In[34]: rx.__version__ Traceback (most recent call last): File "C:\Program…
mchen
  • 9,808
  • 17
  • 72
  • 125
1
vote
1 answer

How to I create a ticking time series with Reactive Extensions for Python (RxPY)?

My Setup: I have a list of stock price data in (time, price) tuples: from datetime import datetime prices = [(datetime(2015, 1, 9), 101.9), (datetime(2015, 1, 12), 101.5), (datetime(2015, 1, 13), 101.7)] which I want to make into an RxPY Observable…
mchen
  • 9,808
  • 17
  • 72
  • 125