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,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace OemanTrader.Domain.Exceptions
{
public class InvalidSymbolException : Exception
{
public string Symbol { get; set; }
public InvalidSymbolException(string symbol)
{
Symbol = symbol;
}
public InvalidSymbolException(string symbol, string? message) : base(message)
{
Symbol = symbol;
}
public InvalidSymbolException(string symbol, string? message, Exception? innerException) : base(message, innerException)
{
Symbol = symbol;
}
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OemanTrader.Domain.Models
{
public class Account : DomainObject
{
public User AccountHolder { get; set; }
public double Balance { get; set; }
public IEnumerable<AssetTransaction> AssetTransactions { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OemanTrader.Domain.Models
{
public class Asset
{
public string Symbol { get; set; }
public double PricePerShare { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OemanTrader.Domain.Models
{
public class AssetTransaction : DomainObject
{
public Account Account { get; set; }
public bool IsPurchase { get; set; }
public Asset Asset { get; set; }
public int ShareAmount { get; set; }
public DateTime DateProcessed { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OemanTrader.Domain.Models
{
public class DomainObject
{
public int Id { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OemanTrader.Domain.Models
{
public enum MajorIndexType
{
DowJones,
Nasdaq,
SP500
}
public class MajorIndex
{
public string IndexName { get; set; }
public double Price { get; set; }
public double Changes { get; set; }
public MajorIndexType Type { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OemanTrader.Domain.Models
{
public class User : DomainObject
{
public string Email { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public DateTime DateJoined { get; set; }
}
}

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OemanTrader.Domain.Services
{
public interface IDataService<T>
{
Task<IEnumerable<T>> GetAll();
Task<T> Get(int id);
Task<T> Create(T entity);
Task<T> Update(int Id, T entity);
Task<bool> Delete(int Id);
}
}

View File

@ -0,0 +1,14 @@
using OemanTrader.Domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OemanTrader.Domain.Services
{
public interface IMajorIndexService
{
Task<MajorIndex> GetMajorIndex(MajorIndexType indexType);
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OemanTrader.Domain.Services
{
public interface IStockPriceService
{
Task<double> GetPrice(string symbol);
}
}