background preloader

Samples

Facebook Twitter

Insights of a Full Stack developer: DetectStale within a stream. The DetectStale<T> extension method within the Reactive Trader RX example application detects when a stream has stopped producing values and injects an IsStale indicator to allow the UI to react.

Insights of a Full Stack developer: DetectStale within a stream

The idea is that while the stream is steadily providing values all is good. As soon as a value hasn’t been received within a set period of time, a new value is sent down the stream to say “this steam has gone stale”. First here is an example of it being used within a test: The DetectStale internally uses a timer to know whether it should be sending in effect an null/empty stale value. The Rx Framework By Example. Introduction The Rx Framework is a very interesting and useful library recently released via DevLabs.

The Rx Framework By Example

The purpose of the framework is to provide a large framework for working with the Observer pattern. That is a nice academic description, but it is hardly enough to start using it immediately. So let us dig a little deeper. This article is to provide an introduction to the Rx Framework by example, not by description. Background All of the information presented here is either summarised or derived from the excellent video and text blog posts on Channel 9. For this article, it is assumed that the reader has a working knowledge of the Observer pattern. This article's code was written against version 1.0.10621.0 of the Reactive Framework from NuGet.

It would also help to watch the Rx Framework introductory video on Channel 9. IObservable<T> Reactive benefits with commodity option barrier events. Reactive programming offers many advantages over traditional imperative techniques when handling information streams like commodity market data.

Reactive benefits with commodity option barrier events

In this and several follow up posts I want to demonstrate some of the advantages I've found using these techniques. I'll be demonstrating this with c# and the Reactive Extensions framework. Reactive Programming What is reactive programming? From Wikipedia: "reactive programming is a programming paradigm oriented around data flows and the propagation of change. " en.wikipedia.org/wiki/Reactive_programming Spreadsheet calculations are a great example of reactive techniques. Barrier options on commodity futures I'm going to use barrier options to demonstrate the value of reactive programming. A barrier option is an exotic derivative typically an option on the underlying asset whose price breaching the pre-set barrier level either springs the option into existence or extinguishes an already existing option. en.wikipedia.org/wiki/Barrier_option Transform.

101 Rx Samples - a work in progress - Reactive Framework (Rx) Wiki. You!

101 Rx Samples - a work in progress - Reactive Framework (Rx) Wiki

Yes, you, the one who is still scratching their head trying to figure out this Rx thing. As you learn and explore, please feel free add your own samples here (or tweak existing ones!) Anyone can (and should!) Edit this page. (edit button is at the bottom right of each page) (and sorry for the years of spam pages there - they should be gone now. Start - Run Code Asynchronously Run a method asynchronously on demand Execute a long-running method asynchronously. // Synchronous operation public DataType DoLongRunningOperation(string param) { ... } public IObservable<DataType> LongRunningOperationAsync(string param) { return Observable.Create<DataType>( o => Observable.ToAsync<string,DataType>(DoLongRunningOperation)(param).Subscribe(o) ); } CombineLatest - Parallel Execution Merges the specified observable sequences into one observable sequence by emitting a list with the latest source elements whenever any of the observable sequences produces an element.

Observing an Event - Simple Window. Oscilloscope using RX and C# Async CTP. In my last blog post I described the implementation of a simple ‘oscilloscope app’ in F#, as I wanted to see how the code would be structured using only F# idioms ( ) My natural instinct would have been to implement it using the Reactive Extensions for .NET (RX Framework), but I first wanted to investigate a pure F# solution.

Oscilloscope using RX and C# Async CTP

This post describes an alternate RX implementation. Similar to my last post, I’ll describe the code inside-out. Creating the Observable This code returns an IObservable with a float array payload, representing each read from the CaptureBuffer. NetMQ+ RX (Streaming Data Demo App 2 of 2) You can grab the code from my github repository right here This is the 2nd part of this series of articles.

NetMQ+ RX (Streaming Data Demo App 2 of 2)

If you missed part one this is main points from the introduction section from the last article. I work in finance, and at the moment work in the Foreign Exchange (FX) space, where we have lots of requirements that involve streaming of various things, such as: Rates Trades Other financial instruments Historically what we would have done to accomodate these requirements was to use sockets and push our own data (usually JSON or XML) down the wire, and then had some quite knarly listeners above that, where each listener would want some slightly different view of the original streaming data. Thing is, time has never stands still in the world of software development, and new things come out all the time, literally every other day a new framework comes along that helps improve what came before it in some way or another.

RX comes with many many tools in it's arsenal, such as. AdaptiveConsulting/ReactiveTrader.