Add project files.

This commit is contained in:
2022-05-26 15:19:31 +02:00
parent 44afa68e45
commit a57dcfe03b
57 changed files with 1907 additions and 0 deletions

View File

@ -0,0 +1,84 @@
using OemanTrader.Domain.Models;
using OemanTrader.Domain.Services;
using OemanTrader.FinantialModelingPrepAPI.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OemanTrader.WPF.ViewModels
{
public class MajorIndexListingViewModel : ViewModelBase
{
private readonly IMajorIndexService _majorIndexService;
private MajorIndex _dowJones;
public MajorIndex DowJones {
get { return _dowJones; }
set {
_dowJones = value;
OnPropertyChanged(nameof(DowJones));
}
}
private MajorIndex _nasdaq;
public MajorIndex Nasdaq
{
get { return _nasdaq; }
set
{
_nasdaq = value;
OnPropertyChanged(nameof(Nasdaq));
}
}
private MajorIndex _sp500;
public MajorIndex SP500
{
get { return _sp500; }
set
{
_sp500 = value;
OnPropertyChanged(nameof(SP500));
}
}
public MajorIndexListingViewModel(IMajorIndexService majorIndexService)
{
_majorIndexService = majorIndexService;
}
public static MajorIndexListingViewModel LoadMajorIndexViewModel(IMajorIndexService majorIndexService)
{
MajorIndexListingViewModel majorIndexViewModel = new MajorIndexListingViewModel(majorIndexService);
majorIndexViewModel.LoadMajorIndexes();
return majorIndexViewModel;
}
private void LoadMajorIndexes()
{
_majorIndexService.GetMajorIndex(MajorIndexType.DowJones).ContinueWith(task =>
{
if(task.Exception == null) {
DowJones = task.Result;
}
});
_majorIndexService.GetMajorIndex(MajorIndexType.Nasdaq).ContinueWith(task =>
{
if (task.Exception == null)
{
Nasdaq = task.Result;
}
});
_majorIndexService.GetMajorIndex(MajorIndexType.SP500).ContinueWith(task =>
{
if (task.Exception == null)
{
SP500 = task.Result;
}
});
}
}
}