Giter Site home page Giter Site logo

simpletrader's Introduction

simpletrader's People

Contributors

singletonsean 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

simpletrader's Issues

Active loading and disposing of Dependency Injected Services

Hi Sean,

First, as a newbie to WPF, thank you so much for doing your series and tutorials. They have been quite invaluable over the past couple of months. Using your application as a template has been wonderful, but I had two questions surrounding the dependency injection process.

  1. The services registered with dependency injection are only constructed when the application needs them (i.e. switching to a view or viewmodel for the first time). Is there a preferred method for loading specific services ahead of time so that any required (and time-consuming) startup processes for those services might be loaded ahead of time?

  2. I have services that need to do cleanup, and so they inherit from IDisposable. I noticed those services that were loaded with dependency injection are not being disposed when the application closes. The ServiceProvider implementation itself also inherits from IDisposable, but is not being called (since the service provider only exists in the OnStartup method of the App (and not in some type of "using" statement). What is the preferred way to dispose of the service provider or any services registered within the service provider so that proper cleanup can occur?

Thanks for your help!

-Jason

Utilizing CoinbasePro-Csharp for httpclient

Greetings,

This tutorial has been awesome, I have created my own using your tutorial geared more towards the crypto markets.
Instead of a custom APIHttpClient, I am attempting to inject a "CoinbaseProClient" from the CoinbasePro-Csharp library.

This "works" for the intial loading of the MajorIndexViewModel but only for first card. secondary, and 3rd cards are not loading.

How can inject this client instead of the "FinancialModelAPIHttpClient" when utilizing the "AddFinancialModelingAPIHostBuilderExtension" ?

-Or Rather-

What is preventing the current setup from running the GetTicker() command for the other two indexes?
There are no errors when debugging, the 2nd and 3rd "Tasks" in MajorIndexViewModel.LoadMajorIndexes() but tasks do not run/update values on "Cards".

Example Gist - AddFinancialModelingAPIHostBuilderExtension.cs

Example Gist - MajorIndexService.cs

Example Gist - CoinBaseProAPIHttpClient.cs

Example Gist - MajorIndexViewModel.cs

Example Screen Shot

**Note I am only calling 3 "indexes" from list of types (BtcUsd, LtcUsd, EthUsd) from CoinbasePro library.

EF Migration it works only to transient scope

Hi guys !!! Why doesn't works when singleton or scoped scope are used ?
var connectionString = "server=localhost\\sqlexpress;initial catalog=db_sgone_desktop;user id=sa;password=123456;"; services.AddDbContext<ErpDbContext>(opt => opt.UseSqlServer(connectionString)); services.AddSingleton<ErpDbContext>(); services.AddSingleton<IVersaoSistemaRepository, VersaoSistemaRepository>(); services.AddSingleton<IVersionamentoRepository, VersionamentoRepository>();
now, I write the command
add-migration initial, and after update-database
I get the following error:
An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Dsbr.Source.Domain.Interfaces.Repositories.INumeroNotaSerieRepository Lifetime: Singleton ImplementationType: Dsbr.Source.Infra.Repositories.NumeroNotaSerieRepository': Cannot consume scoped service 'Microsoft.EntityFrameworkCore.DbContextOptions`1[Dsbr.Source.Infra.EF.Context.ErpDbContext]' from singleton 'Dsbr.Source.Domain.Interfaces.Repositories.INumeroNotaSerieRepository'.)

Therefore, when i change the scope to services.AddTransient it works fine ...

Reduce Code duplication in AccountDataService even further

AccountDataService could inherit from NonQueryDataService thereby removing the need to write out or have to explicitly delegate functionality to NonQueryDataService... here's what I mean:

public class AccountDataService : NonQueryDataService<Account>, IDataService<Account>
{
    private readonly SimpleTraderDbContextFactory _contextFactory;

    public AccountDataService(SimpleTraderDbContextFactory contextFactory) : base(contextFactory)
    {
        _contextFactory = contextFactory;
    }

    public async Task<IEnumerable<Account>> GetAll()
    {
        await using var context = _contextFactory.CreateDbContext(new[] {""});
        var list = await context.Accounts.Include(x => x.AssetTransactions).Include(x => x.AccountHolder)
            .ToListAsync();
        return list;
    }

    public async Task<Account> Get(int id)
    {
        await using var context = _contextFactory.CreateDbContext(new[] {""});
        var entity = await context.Accounts.Include(x => x.AssetTransactions).Include(x => x.AccountHolder)
            .FirstOrDefaultAsync(x => x.Id == id);
        return entity;
    }
}

request for additional service

Hi Sean,
I'm very impressed of what you're doing and about the ease, you're creating the app. This shows up the huge gap between a youngster and me...
However, I be using your SimpleTrader as a template to a) learn to switch from VB to C# since there is much more information around about the latter; and b) creating my own solution to administrate tenancy, which is here in Germany quite a complex task. However I would prefer to have a connection to my personal Card-DAV instead of creating and maintaining user data within the app.

As you were asking for suggestions and as you stated, you like complex challenges, I dare to ask you if you could fancy creating a base for a Card-DAV (Web-DAV) interface in your trader?

Best regards,
Gerald

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.