Add project files.
This commit is contained in:
29
OemanTrader.Domain/Exceptions/InvalidSymbolException.cs
Normal file
29
OemanTrader.Domain/Exceptions/InvalidSymbolException.cs
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
15
OemanTrader.Domain/Models/Account.cs
Normal file
15
OemanTrader.Domain/Models/Account.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
14
OemanTrader.Domain/Models/Asset.cs
Normal file
14
OemanTrader.Domain/Models/Asset.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
17
OemanTrader.Domain/Models/AssetTransaction.cs
Normal file
17
OemanTrader.Domain/Models/AssetTransaction.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
13
OemanTrader.Domain/Models/DomainObject.cs
Normal file
13
OemanTrader.Domain/Models/DomainObject.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
22
OemanTrader.Domain/Models/MajorIndex.cs
Normal file
22
OemanTrader.Domain/Models/MajorIndex.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
16
OemanTrader.Domain/Models/User.cs
Normal file
16
OemanTrader.Domain/Models/User.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
9
OemanTrader.Domain/OemanTrader.Domain.csproj
Normal file
9
OemanTrader.Domain/OemanTrader.Domain.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
17
OemanTrader.Domain/Services/IDataService.cs
Normal file
17
OemanTrader.Domain/Services/IDataService.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
14
OemanTrader.Domain/Services/IMajorIndexService.cs
Normal file
14
OemanTrader.Domain/Services/IMajorIndexService.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
13
OemanTrader.Domain/Services/IStockPriceService.cs
Normal file
13
OemanTrader.Domain/Services/IStockPriceService.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user