GithubHelp home page GithubHelp logo

kiwipiet / dynamic.trader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rolandpheasant/dynamic.trader

0.0 2.0 0.0 5.69 MB

WPF demo showing off dynamic data and reactive extensions

Home Page: http://dynamic-data.org

C# 100.00%

dynamic.trader's Introduction

Dynamic Trader

Dynamic data is a portable class library which brings the power of reactive (rx) to collections. It is open source and the code base lives here Dynamic Data on GitHub.

To help illustrate how powerful and easy Dynamic Data is, and to help you get up and running I have created this WPF demo app. I have made the code behind each screen as simple as possible so it is easy to follow.

Most of the example screens have been written about on the blog at dynamic-data.org

The demo illustrates how the following code:

var loader = tradeService.All
    .Connect(trade => trade.Status == TradeStatus.Live) //prefilter live trades only
    .Filter(_filter) // apply user filter
    .Transform(trade => new TradeProxy(trade),new ParallelisationOptions(ParallelType.Ordered,5))
    .Sort(SortExpressionComparer<TradeProxy>.Descending(t => t.Timestamp),SortOptimisations.ComparesImmutableValuesOnly)
    .ObserveOnDispatcher()
    .Bind(_data)   // update observable collection bindings
    .DisposeMany() //since TradeProxy is disposable dispose when no longer required
    .Subscribe();

produces this

Live Trades View

or how the following extract

var loader = tradeService.Live.Connect()
           .Group(trade => trade.CurrencyPair)
           .Transform(group => new CurrencyPairPosition(group))
           .Sort(SortExpressionComparer<CurrencyPairPosition>.Ascending(t => t.CurrencyPair))
           .ObserveOn(schedulerProvider.MainThread)
           .Bind(_data)
           .DisposeMany()
           .Subscribe();

   //when CurrencyPairPosition class does this
   tradesByCurrencyPair.Cache.Connect()
   		.QueryWhenChanged(query =>
   		{
   			var buy = query.Items.Where(trade => trade.BuyOrSell == BuyOrSell.Buy).Sum(trade=>trade.Amount);
   			var sell = query.Items.Where(trade => trade.BuyOrSell == BuyOrSell.Sell).Sum(trade => trade.Amount);
   			var count = query.Count;
   			return new TradesPosition(buy,sell,count);
   		})
   		.Subscribe(position => Position = position);
       }

Produces this.

Aggregated Positions View

This is so easy, a few lines of code which after a short learning curve becomes very easy.

Plus many more dynamic data examples. Additionally there are some examples which show how to integrate with ReactiveUI.

The menu looks like this and as you can see there are links to the code behind which hopefully will get you up to speed in no time at all

Menu

The examples are being regularly maintained so download again to see more examples.

Run the demo

  • Build status
  • Press 'Download Zip', unpack and open Dynamic.Trader.sln
  • Ensure Nuget Restore is enabled
  • Set 'Trader.Client' as the startup project
  • Press F5

Feedback

Please feel free to me a on any of the following channels

Also a big thanks to the guys behind Mahapps and Dragablz for their awesome oss projects. These have enabled me to easily make this demo look good.

dynamic.trader's People

Contributors

butchersboy avatar gitter-badger avatar rolandpheasant avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.