Giter Site home page Giter Site logo

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 glennawatson avatar partyzone avatar rolandpheasant avatar stroked avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dynamic.trader's Issues

SelectionController not referenced

The SelectionController class is not referenced within the project. Is there an example of where it is used? It would be great if it could be wired up to the trades view to build out the sample.

ReactiveCommand is changed?

Trying to learn, and downloaded this code, but after upgrading reactive and stuff, I get error in LogEntryViewer, that the ReactiveCommand is defined wrong?

Severity Code Description Project File Line Suppression State
Error CS1061 'ReactiveCommand' does not contain a definition for 'Dispose' and no accessible extension method 'Dispose' accepting a first argument of type 'ReactiveCommand' could be found (are you missing a using directive or an assembly reference?) Trader.Client LogEntryViewer.cs 91 Active
Error CS0029 Cannot implicitly convert type 'ReactiveUI.ReactiveCommand<System.Reactive.Unit, System.Reactive.Unit>' to 'ReactiveUI.ReactiveCommand' Trader.Client LogEntryViewer.cs 77 Active
Error CS0718 'ReactiveCommand': static types cannot be used as type arguments Trader.Client LogEntryView.xaml.cs 26 Active
Error CS0722 'ReactiveCommand': static types cannot be used as return types Trader.Client LogEntryViewer.cs 27 Active

Since I'm trying to learn this, I don't know what the error is though.. blush

Cannot open solution in Visual Studio 2013

I get that in the in visual studio console after it refuses to open the projects inside the solution.

C:\Code\Dynamic.Trader\Trader.Domain\Trader.Domain.csproj : error : The attribute "Version" in element is unrecognized. C:\Code\Dynamic.Trader\Trader.Domain\Trader.Domain.csproj

C:\Code\Dynamic.Trader\Trader.Client\Trader.Client.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Code\Dynamic.Trader\Trader.Client\Trader.Client.csproj

If got data by http (restapi),maybe much better !

When i view this demo and try to add some features, get data by http, but get many problems !

{"调用线程无法访问此对象,因为另一个线程拥有该对象。"}

maybe to much reflections for ReactiveUI framework ?

i want to use ReactiveUI make a Redis GUI client .

Cannot open in VS 2019

Hi and thanks for the wonderful work.

I'm unable to open either of the projects in VS 16.1.1.

I get the following error when trying to load the project on demand:

Project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\16.0\Bin\Microsoft.CSharp.targets" was not imported by "C:\Program Files\dotnet\sdk\2.2.100\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.targets" at (41,3), due to the file not existing.

I have verified Core 2.2.100 Sdk is installed.

Unable to build with VS 2019

Hi, errors when trying to build with VS 2019 (16.2.3):

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1175,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.6.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
1>Done building project "Trader.Domain.csproj" -- FAILED.
2>------ Rebuild All started: Project: Trader.Client, Configuration: Debug Any CPU ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1175,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.6.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
2>Done building project "Trader.Client.csproj" -- FAILED.

Unfortunately I am not able to set higher version of the target framework because projects settings fail to porperly open also

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.