Add project files.
This commit is contained in:
15
ConsoleApp1/ConsoleApp1.csproj
Normal file
15
ConsoleApp1/ConsoleApp1.csproj
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\OemanTrader.Domain\OemanTrader.Domain.csproj" />
|
||||||
|
<ProjectReference Include="..\OemanTrader.EntityFramework\OemanTrader.EntityFramework.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
9
ConsoleApp1/Program.cs
Normal file
9
ConsoleApp1/Program.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
|
||||||
|
using OemanTrader.Domain.Models;
|
||||||
|
using OemanTrader.Domain.Services;
|
||||||
|
using OemanTrader.EntityFramework;
|
||||||
|
using OemanTrader.EntityFramework.Services;
|
||||||
|
|
||||||
|
IDataService<User> userService = new GenericDataService<User>(new OemanTraderDbContextFactory());
|
||||||
|
userService.Create(new User { UserName = "Test" }).Wait();
|
||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
155
OemanTrader.EntityFramework/Migrations/20220508202548_initial.Designer.cs
generated
Normal file
155
OemanTrader.EntityFramework/Migrations/20220508202548_initial.Designer.cs
generated
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using OemanTrader.EntityFramework;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace OemanTrader.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(OemanTraderDbContext))]
|
||||||
|
[Migration("20220508202548_initial")]
|
||||||
|
partial class initial
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "6.0.4")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<int>("AccountHolderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Balance")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountHolderId");
|
||||||
|
|
||||||
|
b.ToTable("Accounts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.AssetTransaction", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<int>("AccountId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateProcessed")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<bool>("IsPurchase")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("ShareAmount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.ToTable("AssetTransactions");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateJoined")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("OemanTrader.Domain.Models.User", "AccountHolder")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AccountHolderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("AccountHolder");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.AssetTransaction", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("OemanTrader.Domain.Models.Account", "Account")
|
||||||
|
.WithMany("AssetTransactions")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.OwnsOne("OemanTrader.Domain.Models.Stock", "Stock", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<int>("AssetTransactionId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b1.Property<double>("PricePerShare")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b1.Property<string>("Symbol")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b1.HasKey("AssetTransactionId");
|
||||||
|
|
||||||
|
b1.ToTable("AssetTransactions");
|
||||||
|
|
||||||
|
b1.WithOwner()
|
||||||
|
.HasForeignKey("AssetTransactionId");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("Stock")
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AssetTransactions");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace OemanTrader.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
public partial class initial : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Users",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
UserName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
DateJoined = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Users", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Accounts",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
AccountHolderId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Balance = table.Column<double>(type: "float", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Accounts", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Accounts_Users_AccountHolderId",
|
||||||
|
column: x => x.AccountHolderId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AssetTransactions",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
AccountId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
IsPurchase = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Stock_Symbol = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Stock_PricePerShare = table.Column<double>(type: "float", nullable: false),
|
||||||
|
ShareAmount = table.Column<int>(type: "int", nullable: false),
|
||||||
|
DateProcessed = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AssetTransactions", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AssetTransactions_Accounts_AccountId",
|
||||||
|
column: x => x.AccountId,
|
||||||
|
principalTable: "Accounts",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Accounts_AccountHolderId",
|
||||||
|
table: "Accounts",
|
||||||
|
column: "AccountHolderId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AssetTransactions_AccountId",
|
||||||
|
table: "AssetTransactions",
|
||||||
|
column: "AccountId");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AssetTransactions");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Accounts");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Users");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
155
OemanTrader.EntityFramework/Migrations/20220519211347_stock-to-asset.Designer.cs
generated
Normal file
155
OemanTrader.EntityFramework/Migrations/20220519211347_stock-to-asset.Designer.cs
generated
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using OemanTrader.EntityFramework;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace OemanTrader.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(OemanTraderDbContext))]
|
||||||
|
[Migration("20220519211347_stock-to-asset")]
|
||||||
|
partial class stocktoasset
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "6.0.4")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<int>("AccountHolderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Balance")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountHolderId");
|
||||||
|
|
||||||
|
b.ToTable("Accounts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.AssetTransaction", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<int>("AccountId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateProcessed")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<bool>("IsPurchase")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("ShareAmount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.ToTable("AssetTransactions");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateJoined")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("OemanTrader.Domain.Models.User", "AccountHolder")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AccountHolderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("AccountHolder");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.AssetTransaction", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("OemanTrader.Domain.Models.Account", "Account")
|
||||||
|
.WithMany("AssetTransactions")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.OwnsOne("OemanTrader.Domain.Models.Asset", "Asset", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<int>("AssetTransactionId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b1.Property<double>("PricePerShare")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b1.Property<string>("Symbol")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b1.HasKey("AssetTransactionId");
|
||||||
|
|
||||||
|
b1.ToTable("AssetTransactions");
|
||||||
|
|
||||||
|
b1.WithOwner()
|
||||||
|
.HasForeignKey("AssetTransactionId");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("Asset")
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AssetTransactions");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace OemanTrader.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
public partial class stocktoasset : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Stock_Symbol",
|
||||||
|
table: "AssetTransactions",
|
||||||
|
newName: "Asset_Symbol");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Stock_PricePerShare",
|
||||||
|
table: "AssetTransactions",
|
||||||
|
newName: "Asset_PricePerShare");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Asset_Symbol",
|
||||||
|
table: "AssetTransactions",
|
||||||
|
newName: "Stock_Symbol");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Asset_PricePerShare",
|
||||||
|
table: "AssetTransactions",
|
||||||
|
newName: "Stock_PricePerShare");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,153 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using OemanTrader.EntityFramework;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace OemanTrader.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(OemanTraderDbContext))]
|
||||||
|
partial class OemanTraderDbContextModelSnapshot : ModelSnapshot
|
||||||
|
{
|
||||||
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "6.0.4")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<int>("AccountHolderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Balance")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountHolderId");
|
||||||
|
|
||||||
|
b.ToTable("Accounts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.AssetTransaction", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<int>("AccountId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateProcessed")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<bool>("IsPurchase")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("ShareAmount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.ToTable("AssetTransactions");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateJoined")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("OemanTrader.Domain.Models.User", "AccountHolder")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AccountHolderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("AccountHolder");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.AssetTransaction", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("OemanTrader.Domain.Models.Account", "Account")
|
||||||
|
.WithMany("AssetTransactions")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.OwnsOne("OemanTrader.Domain.Models.Asset", "Asset", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<int>("AssetTransactionId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b1.Property<double>("PricePerShare")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b1.Property<string>("Symbol")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b1.HasKey("AssetTransactionId");
|
||||||
|
|
||||||
|
b1.ToTable("AssetTransactions");
|
||||||
|
|
||||||
|
b1.WithOwner()
|
||||||
|
.HasForeignKey("AssetTransactionId");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("Asset")
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AssetTransactions");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.4">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\OemanTrader.Domain\OemanTrader.Domain.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
26
OemanTrader.EntityFramework/OemanTraderDbContext.cs
Normal file
26
OemanTrader.EntityFramework/OemanTraderDbContext.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using OemanTrader.Domain.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OemanTrader.EntityFramework
|
||||||
|
{
|
||||||
|
public class OemanTraderDbContext : DbContext
|
||||||
|
{
|
||||||
|
|
||||||
|
public DbSet<User> Users { get; set; }
|
||||||
|
public DbSet<Account> Accounts { get; set; }
|
||||||
|
public DbSet<AssetTransaction> AssetTransactions { get; set; }
|
||||||
|
public OemanTraderDbContext(DbContextOptions options) : base(options) { }
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.Entity<AssetTransaction>().OwnsOne(x => x.Asset);
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
20
OemanTrader.EntityFramework/OemanTraderDbContextFactory.cs
Normal file
20
OemanTrader.EntityFramework/OemanTraderDbContextFactory.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Design;
|
||||||
|
|
||||||
|
namespace OemanTrader.EntityFramework
|
||||||
|
{
|
||||||
|
public class OemanTraderDbContextFactory : IDesignTimeDbContextFactory<OemanTraderDbContext>
|
||||||
|
{
|
||||||
|
public OemanTraderDbContext CreateDbContext(string[] args = null)
|
||||||
|
{
|
||||||
|
var options = new DbContextOptionsBuilder<OemanTraderDbContext>();
|
||||||
|
options.UseSqlServer("Server=oemansv7win;Initial Catalog=OemanTraderDB;Persist Security Info=True;User ID=sa;Password=SAOemansv7SA;");
|
||||||
|
return new OemanTraderDbContext(options.Options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
73
OemanTrader.EntityFramework/Services/GenericDataService.cs
Normal file
73
OemanTrader.EntityFramework/Services/GenericDataService.cs
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
|
using OemanTrader.Domain.Models;
|
||||||
|
using OemanTrader.Domain.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OemanTrader.EntityFramework.Services
|
||||||
|
{
|
||||||
|
public class GenericDataService<T> : IDataService<T> where T : DomainObject
|
||||||
|
{
|
||||||
|
private readonly OemanTraderDbContextFactory _contextFactory;
|
||||||
|
|
||||||
|
public GenericDataService(OemanTraderDbContextFactory contextFactory)
|
||||||
|
{
|
||||||
|
_contextFactory = contextFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<T> Create(T entity)
|
||||||
|
{
|
||||||
|
using (var context = _contextFactory.CreateDbContext())
|
||||||
|
{
|
||||||
|
EntityEntry<T> createdResult = await context.Set<T>().AddAsync(entity);
|
||||||
|
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
return createdResult.Entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public async Task<bool> Delete(int id)
|
||||||
|
{
|
||||||
|
using (var context = _contextFactory.CreateDbContext())
|
||||||
|
{
|
||||||
|
|
||||||
|
T entity = await context.Set<T>().FirstOrDefaultAsync((e) => e.Id == id);
|
||||||
|
context.Set<T>().Remove(entity);
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<T> Get(int id)
|
||||||
|
{
|
||||||
|
using (var context = _contextFactory.CreateDbContext())
|
||||||
|
{
|
||||||
|
T entity = await context.Set<T>().FirstOrDefaultAsync((e) => e.Id == id);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<T>> GetAll()
|
||||||
|
{
|
||||||
|
using (var context = _contextFactory.CreateDbContext())
|
||||||
|
{
|
||||||
|
IEnumerable<T> entities = await context.Set<T>().ToListAsync();
|
||||||
|
return entities;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<T> Update(int Id, T entity)
|
||||||
|
{
|
||||||
|
using (var context = _contextFactory.CreateDbContext())
|
||||||
|
{
|
||||||
|
entity.Id = Id;
|
||||||
|
context.Set<T>().Update(entity);
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Net.Http;
|
||||||
|
|
||||||
|
namespace OemanTrader.FinantialModelingPrepAPI
|
||||||
|
{
|
||||||
|
public class FinancialModelingPrepHttpClient : HttpClient
|
||||||
|
{
|
||||||
|
private readonly string _apiKey;
|
||||||
|
|
||||||
|
public FinancialModelingPrepHttpClient(string apiKey)
|
||||||
|
{
|
||||||
|
this.BaseAddress = new Uri("https://financialmodelingprep.com/api/v3/");
|
||||||
|
_apiKey = apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<T> GetAsync<T>(string uri)
|
||||||
|
{
|
||||||
|
// HttpResponseMessage response = await GetAsync(uri + "?apikey=2035d4934632e1d7c38f15982e39d3aa");
|
||||||
|
//var apikey = "2035d4934632e1d7c38f15982e39d3aa";
|
||||||
|
HttpResponseMessage response = await GetAsync($"{uri}?apikey={_apiKey}");
|
||||||
|
string jsonResponse = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
return JsonConvert.DeserializeObject<T>(jsonResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OemanTrader.FinantialModelingPrepAPI
|
||||||
|
{
|
||||||
|
public class FinancialModelingPrepHttpClientFactory
|
||||||
|
{
|
||||||
|
private readonly string _apiKey;
|
||||||
|
|
||||||
|
public FinancialModelingPrepHttpClientFactory(string apiKey)
|
||||||
|
{
|
||||||
|
_apiKey = apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FinancialModelingPrepHttpClient CreateHttpClient()
|
||||||
|
{
|
||||||
|
return new FinancialModelingPrepHttpClient(_apiKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\OemanTrader.Domain\OemanTrader.Domain.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OemanTrader.FinantialModelingPrepAPI.Results
|
||||||
|
{
|
||||||
|
public class StockPriceResult
|
||||||
|
{
|
||||||
|
public double Price { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using OemanTrader.Domain.Models;
|
||||||
|
using OemanTrader.Domain.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OemanTrader.FinantialModelingPrepAPI.Services
|
||||||
|
{
|
||||||
|
public class MajorIndexService : IMajorIndexService
|
||||||
|
{
|
||||||
|
private readonly FinancialModelingPrepHttpClientFactory _httpClientFactory;
|
||||||
|
|
||||||
|
public MajorIndexService(FinancialModelingPrepHttpClientFactory httpClientFactory)
|
||||||
|
{
|
||||||
|
_httpClientFactory = httpClientFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<MajorIndex> GetMajorIndex(MajorIndexType indexType)
|
||||||
|
{
|
||||||
|
using (FinancialModelingPrepHttpClient client = _httpClientFactory.CreateHttpClient())
|
||||||
|
{
|
||||||
|
string uri = "majors-indexes/" + GetUriSuffix(indexType);
|
||||||
|
|
||||||
|
//HttpResponseMessage response = await client.GetAsync(uri + "?apikey=2035d4934632e1d7c38f15982e39d3aa");
|
||||||
|
MajorIndex majorIndex = await client.GetAsync<MajorIndex>(uri);
|
||||||
|
majorIndex.Type = indexType;
|
||||||
|
|
||||||
|
return majorIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetUriSuffix(MajorIndexType indexType)
|
||||||
|
{
|
||||||
|
switch (indexType)
|
||||||
|
{
|
||||||
|
case MajorIndexType.DowJones:
|
||||||
|
return ".DJI";
|
||||||
|
case MajorIndexType.Nasdaq:
|
||||||
|
return ".IXIC";
|
||||||
|
case MajorIndexType.SP500:
|
||||||
|
return ".INX";
|
||||||
|
default:
|
||||||
|
throw new Exception("MajorIndexType does not have a suffix defined.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using OemanTrader.Domain.Exceptions;
|
||||||
|
using OemanTrader.Domain.Services;
|
||||||
|
using OemanTrader.FinantialModelingPrepAPI.Results;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OemanTrader.FinantialModelingPrepAPI.Services
|
||||||
|
{
|
||||||
|
public class StockPriceService : IStockPriceService
|
||||||
|
{
|
||||||
|
private readonly FinancialModelingPrepHttpClientFactory _httpClientFactory;
|
||||||
|
|
||||||
|
public StockPriceService(FinancialModelingPrepHttpClientFactory httpClientFactory)
|
||||||
|
{
|
||||||
|
_httpClientFactory = httpClientFactory;
|
||||||
|
}
|
||||||
|
public async Task<double> GetPrice(string symbol)
|
||||||
|
{
|
||||||
|
using (FinancialModelingPrepHttpClient client = _httpClientFactory.CreateHttpClient())
|
||||||
|
{
|
||||||
|
string uri = "stock/real-time-price/" + symbol;
|
||||||
|
|
||||||
|
//HttpResponseMessage response = await client.GetAsync(uri + "?apikey=2035d4934632e1d7c38f15982e39d3aa");
|
||||||
|
StockPriceResult stockPriceResult = await client.GetAsync<StockPriceResult>(uri);
|
||||||
|
|
||||||
|
if (stockPriceResult.Price == 0)
|
||||||
|
{
|
||||||
|
throw new InvalidSymbolException(symbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
return stockPriceResult.Price;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
OemanTrader.WPF/App.xaml
Normal file
21
OemanTrader.WPF/App.xaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<Application x:Class="OemanTrader.WPF.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:viewmodels="clr-namespace:OemanTrader.WPF.ViewModels"
|
||||||
|
xmlns:views="clr-namespace:OemanTrader.WPF.Views"
|
||||||
|
xmlns:local="clr-namespace:OemanTrader.WPF">
|
||||||
|
<Application.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="/Styles/Common.xaml" />
|
||||||
|
<ResourceDictionary Source="/Styles/NavigationBar.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
<DataTemplate DataType="{x:Type viewmodels:HomeViewModel}">
|
||||||
|
<views:HomeView />
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type viewmodels:PortfolioViewModel}">
|
||||||
|
<views:PortfolioView />
|
||||||
|
</DataTemplate>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
44
OemanTrader.WPF/App.xaml.cs
Normal file
44
OemanTrader.WPF/App.xaml.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using OemanTrader.FinantialModelingPrepAPI.Services;
|
||||||
|
using OemanTrader.WPF.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
|
{
|
||||||
|
//new MajorIndexService().GetMajorIndex(Domain.Models.MajorIndexType.DowJones).ContinueWith((t) =>
|
||||||
|
//{
|
||||||
|
// var index = t.Result;
|
||||||
|
//});
|
||||||
|
|
||||||
|
Window window = new MainWindow();
|
||||||
|
window.DataContext = new MainViewModel();
|
||||||
|
window.Show();
|
||||||
|
|
||||||
|
base.OnStartup(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IServiceProvider CreateServiceProvider()
|
||||||
|
{
|
||||||
|
// 1. Singelton - one instance per application
|
||||||
|
// 2. Transient - different instance everytime
|
||||||
|
// 3. Scoped - one instance per "scope"
|
||||||
|
|
||||||
|
IServiceCollection services = new ServiceCollection();
|
||||||
|
return services.BuildServiceProvider();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
OemanTrader.WPF/AssemblyInfo.cs
Normal file
10
OemanTrader.WPF/AssemblyInfo.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
48
OemanTrader.WPF/Commands/UpdateCurrentViewModelCommand.cs
Normal file
48
OemanTrader.WPF/Commands/UpdateCurrentViewModelCommand.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using OemanTrader.FinantialModelingPrepAPI.Services;
|
||||||
|
using OemanTrader.WPF.State.Navigators;
|
||||||
|
using OemanTrader.WPF.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.Commands
|
||||||
|
{
|
||||||
|
public class UpdateCurrentViewModelCommand : ICommand
|
||||||
|
{
|
||||||
|
public event EventHandler? CanExecuteChanged;
|
||||||
|
private INavigator _navigator;
|
||||||
|
|
||||||
|
public UpdateCurrentViewModelCommand(INavigator navigator)
|
||||||
|
{
|
||||||
|
_navigator = navigator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanExecute(object? parameter)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute(object? parameter)
|
||||||
|
{
|
||||||
|
if (parameter is ViewType)
|
||||||
|
{
|
||||||
|
ViewType viewType = (ViewType)parameter;
|
||||||
|
switch (viewType)
|
||||||
|
{
|
||||||
|
case ViewType.Home:
|
||||||
|
// OBS OBS
|
||||||
|
//_navigator.CurrentViewModel = new HomeViewModel(MajorIndexViewModel.LoadMajorIndexViewModel(new MajorIndexService()));
|
||||||
|
break;
|
||||||
|
case ViewType.Portfolio:
|
||||||
|
_navigator.CurrentViewModel = new PortfolioViewModel();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
32
OemanTrader.WPF/Controls/MajorIndexCard.xaml
Normal file
32
OemanTrader.WPF/Controls/MajorIndexCard.xaml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<UserControl x:Class="OemanTrader.WPF.Controls.MajorIndexCard"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:OemanTrader.WPF.Controls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Border BorderBrush="LightGray" BorderThickness="1" CornerRadius="10">
|
||||||
|
<Grid Margin="10" >
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="{Binding Type, FallbackValue=Name}" FontSize="18" HorizontalAlignment="Center" />
|
||||||
|
<Grid Grid.Row="1" Margin="0 10">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="0" Margin="5" Text="Price" />
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="1" Margin="5" HorizontalAlignment="Right" Text="{Binding Price, StringFormat={}{0:c}, FallbackValue=$0.00}"/>
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" Margin="5" Text="Changes" />
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="1" Margin="5" HorizontalAlignment="Right" Text="{Binding Changes, StringFormat={}{0:c}, FallbackValue=$0.00}"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</UserControl>
|
||||||
28
OemanTrader.WPF/Controls/MajorIndexCard.xaml.cs
Normal file
28
OemanTrader.WPF/Controls/MajorIndexCard.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.Controls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MajorIndexCard.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MajorIndexCard : UserControl
|
||||||
|
{
|
||||||
|
public MajorIndexCard()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
OemanTrader.WPF/Controls/MajorIndexListing.xaml
Normal file
26
OemanTrader.WPF/Controls/MajorIndexListing.xaml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<UserControl x:Class="OemanTrader.WPF.Controls.MajorIndexListing"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:OemanTrader.WPF.Controls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions >
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="Major Indexes" FontSize="18" />
|
||||||
|
<Grid Grid.Row="1" Margin="0 10">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<local:MajorIndexCard Grid.Column="0" Margin="10 0" DataContext="{Binding Nasdaq}" />
|
||||||
|
<local:MajorIndexCard Grid.Column="1" Margin="10 0" DataContext="{Binding DowJones}" />
|
||||||
|
<local:MajorIndexCard Grid.Column="2" Margin="10 0" DataContext="{Binding SP500}" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
OemanTrader.WPF/Controls/MajorIndexListing.xaml.cs
Normal file
28
OemanTrader.WPF/Controls/MajorIndexListing.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.Controls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MajorIndexListing.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MajorIndexListing : UserControl
|
||||||
|
{
|
||||||
|
public MajorIndexListing()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
OemanTrader.WPF/Controls/NavigationBar.xaml
Normal file
40
OemanTrader.WPF/Controls/NavigationBar.xaml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<UserControl x:Class="OemanTrader.WPF.Controls.NavigationBar"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:OemanTrader.WPF.Controls"
|
||||||
|
xmlns:nav="clr-namespace:OemanTrader.WPF.State.Navigators" d:DataContext="{d:DesignInstance Type=nav:Navigator}"
|
||||||
|
xmlns:vm="clr-namespace:OemanTrader.WPF.ViewModels"
|
||||||
|
xmlns:converters="clr-namespace:OemanTrader.WPF.Converters"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<converters:EqualValueToParameterConverter x:Key="EqualValueToParameterConverter" />
|
||||||
|
</UserControl.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Padding="10" FontSize="28" Text="Oeman Trader" Foreground="White" Background="{StaticResource BrushPrimary1}"/>
|
||||||
|
<Grid Grid.Row="1" RenderOptions.EdgeMode="Aliased" Background="{StaticResource BrushPrimary2}">
|
||||||
|
<Grid.Resources>
|
||||||
|
<Style TargetType="RadioButton" BasedOn="{StaticResource NavButton}"/>
|
||||||
|
</Grid.Resources>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="auto" />
|
||||||
|
<ColumnDefinition Width="auto" />
|
||||||
|
<ColumnDefinition Width="auto" />
|
||||||
|
<ColumnDefinition Width="auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<RadioButton Grid.Column="0" Content="Home" IsChecked="{Binding CurrentViewModel, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type vm:HomeViewModel}}"
|
||||||
|
Command="{Binding UpdateCurrentViewModelCommand}"
|
||||||
|
CommandParameter="{x:Static nav:ViewType.Home}" />
|
||||||
|
<RadioButton Grid.Column="1" Content="Portfolio" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:ViewType.Portfolio}" />
|
||||||
|
<RadioButton Grid.Column="2" Content="Buy" />
|
||||||
|
<RadioButton Grid.Column="3" Content="Sell" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
OemanTrader.WPF/Controls/NavigationBar.xaml.cs
Normal file
28
OemanTrader.WPF/Controls/NavigationBar.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.Controls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for NavigationBar.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class NavigationBar : UserControl
|
||||||
|
{
|
||||||
|
public NavigationBar()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
OemanTrader.WPF/Converters/EqualValueToParameterConverter.cs
Normal file
26
OemanTrader.WPF/Converters/EqualValueToParameterConverter.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.Converters
|
||||||
|
{
|
||||||
|
public class EqualValueToParameterConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string valueString = value.ToString();
|
||||||
|
string parameterString = parameter.ToString();
|
||||||
|
|
||||||
|
return value.ToString() == parameter.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
OemanTrader.WPF/MainWindow.xaml
Normal file
21
OemanTrader.WPF/MainWindow.xaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
<Window x:Class="OemanTrader.WPF.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:OemanTrader.WPF"
|
||||||
|
xmlns:controls="clr-namespace:OemanTrader.WPF.Controls"
|
||||||
|
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Oeman Trader" Height="450" Width="800">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<controls:NavigationBar Grid.Row="0" DataContext="{Binding Navigator}"/>
|
||||||
|
<ContentControl Content="{Binding Navigator.CurrentViewModel}" Grid.Row="1" />
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
28
OemanTrader.WPF/MainWindow.xaml.cs
Normal file
28
OemanTrader.WPF/MainWindow.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
OemanTrader.WPF/Models/ObservableObject.cs
Normal file
18
OemanTrader.WPF/Models/ObservableObject.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.Models
|
||||||
|
{
|
||||||
|
public class ObservableObject : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
protected void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
OemanTrader.WPF/OemanTrader.WPF.csproj
Normal file
16
OemanTrader.WPF/OemanTrader.WPF.csproj
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\OemanTrader.Domain\OemanTrader.Domain.csproj" />
|
||||||
|
<ProjectReference Include="..\OemanTrader.EntityFramework\OemanTrader.EntityFramework.csproj" />
|
||||||
|
<ProjectReference Include="..\OemanTrader.FinantialModelingPrepAPI\OemanTrader.FinantialModelingPrepAPI.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
21
OemanTrader.WPF/State/Navigators/INavigator.cs
Normal file
21
OemanTrader.WPF/State/Navigators/INavigator.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using OemanTrader.WPF.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.State.Navigators
|
||||||
|
{
|
||||||
|
public enum ViewType
|
||||||
|
{
|
||||||
|
Home,
|
||||||
|
Portfolio
|
||||||
|
}
|
||||||
|
public interface INavigator
|
||||||
|
{
|
||||||
|
ViewModelBase CurrentViewModel { get; set; }
|
||||||
|
ICommand UpdateCurrentViewModelCommand { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
34
OemanTrader.WPF/State/Navigators/Navigator.cs
Normal file
34
OemanTrader.WPF/State/Navigators/Navigator.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using OemanTrader.WPF.Commands;
|
||||||
|
using OemanTrader.WPF.Models;
|
||||||
|
using OemanTrader.WPF.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.State.Navigators
|
||||||
|
{
|
||||||
|
public class Navigator : ObservableObject, INavigator
|
||||||
|
{
|
||||||
|
private ViewModelBase _currentViewModel;
|
||||||
|
public ViewModelBase CurrentViewModel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _currentViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentViewModel = value;
|
||||||
|
OnPropertyChanged(nameof(CurrentViewModel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ICommand UpdateCurrentViewModelCommand => new UpdateCurrentViewModelCommand(this);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
10
OemanTrader.WPF/Styles/Common.xaml
Normal file
10
OemanTrader.WPF/Styles/Common.xaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<!--Colors-->
|
||||||
|
<Color x:Key="ColorPrimary1">#799540</Color>
|
||||||
|
<Color x:Key="ColorPrimary2">#50632b</Color>
|
||||||
|
|
||||||
|
<!--Brushes-->
|
||||||
|
<SolidColorBrush x:Key="BrushPrimary1" Color="{StaticResource ColorPrimary1}"/>
|
||||||
|
<SolidColorBrush x:Key="BrushPrimary2" Color="{StaticResource ColorPrimary2}"/>
|
||||||
|
</ResourceDictionary>
|
||||||
43
OemanTrader.WPF/Styles/NavigationBar.xaml
Normal file
43
OemanTrader.WPF/Styles/NavigationBar.xaml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
|
||||||
|
<Style x:Key="NavButton" TargetType="RadioButton" >
|
||||||
|
<Setter Property="Foreground" Value="white"/>
|
||||||
|
<Setter Property="Padding" Value="10 5"/>
|
||||||
|
<Setter Property="FontSize" Value="18"/>
|
||||||
|
<Setter Property="Background" Value="{StaticResource BrushPrimary2}"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="RadioButton">
|
||||||
|
<Grid x:Name="gridMain" Background="{TemplateBinding Background}">
|
||||||
|
<TextBlock Text="{TemplateBinding Content}"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
|
||||||
|
</Grid>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsChecked" Value="True">
|
||||||
|
<Setter Property="Background" Value="{StaticResource BrushPrimary1}" TargetName="gridMain"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<EventTrigger RoutedEvent="MouseEnter">
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<ColorAnimation To="{StaticResource ColorPrimary1}" Duration="0:0:0.1" Storyboard.TargetProperty="Background.Color"/>
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</EventTrigger>
|
||||||
|
<EventTrigger RoutedEvent="MouseLeave">
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<ColorAnimation To="{StaticResource ColorPrimary2}" Duration="0:0:0.1" Storyboard.TargetProperty="Background.Color"/>
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</EventTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
18
OemanTrader.WPF/ViewModels/HomeViewModel.cs
Normal file
18
OemanTrader.WPF/ViewModels/HomeViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.ViewModels
|
||||||
|
{
|
||||||
|
public class HomeViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
public MajorIndexListingViewModel MajorIndexListingViewModel { get; set; }
|
||||||
|
|
||||||
|
public HomeViewModel(MajorIndexListingViewModel majorIndexListingViewModel)
|
||||||
|
{
|
||||||
|
MajorIndexListingViewModel = majorIndexListingViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
OemanTrader.WPF/ViewModels/MainViewModel.cs
Normal file
19
OemanTrader.WPF/ViewModels/MainViewModel.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using OemanTrader.WPF.State.Navigators;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.ViewModels
|
||||||
|
{
|
||||||
|
public class MainViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
public INavigator Navigator { get; set; } = new Navigator();
|
||||||
|
|
||||||
|
public MainViewModel()
|
||||||
|
{
|
||||||
|
Navigator.UpdateCurrentViewModelCommand.Execute(ViewType.Home);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
84
OemanTrader.WPF/ViewModels/MajorIndexListingViewModel.cs
Normal file
84
OemanTrader.WPF/ViewModels/MajorIndexListingViewModel.cs
Normal 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;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
OemanTrader.WPF/ViewModels/PortfolioViewModel.cs
Normal file
13
OemanTrader.WPF/ViewModels/PortfolioViewModel.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.WPF.ViewModels
|
||||||
|
{
|
||||||
|
public class PortfolioViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
13
OemanTrader.WPF/ViewModels/ViewModelBase.cs
Normal file
13
OemanTrader.WPF/ViewModels/ViewModelBase.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using OemanTrader.WPF.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.ViewModels
|
||||||
|
{
|
||||||
|
public class ViewModelBase : ObservableObject
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
18
OemanTrader.WPF/Views/HomeView.xaml
Normal file
18
OemanTrader.WPF/Views/HomeView.xaml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<UserControl x:Class="OemanTrader.WPF.Views.HomeView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:OemanTrader.WPF.Views"
|
||||||
|
xmlns:controls="clr-namespace:OemanTrader.WPF.Controls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="Home"/>
|
||||||
|
<controls:MajorIndexListing Grid.Row="1" Margin="0 10" HorizontalAlignment="Center" DataContext="{Binding MajorIndexListingViewModel}" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
OemanTrader.WPF/Views/HomeView.xaml.cs
Normal file
28
OemanTrader.WPF/Views/HomeView.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for HomeView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class HomeView : UserControl
|
||||||
|
{
|
||||||
|
public HomeView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
OemanTrader.WPF/Views/PortfolioView.xaml
Normal file
12
OemanTrader.WPF/Views/PortfolioView.xaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<UserControl x:Class="OemanTrader.WPF.Views.PortfolioView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:OemanTrader.WPF.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="Portfolio"/>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
OemanTrader.WPF/Views/PortfolioView.xaml.cs
Normal file
28
OemanTrader.WPF/Views/PortfolioView.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace OemanTrader.WPF.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for PortfolioView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class PortfolioView : UserControl
|
||||||
|
{
|
||||||
|
public PortfolioView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
43
OemanTrader.sln
Normal file
43
OemanTrader.sln
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.1.32421.90
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OemanTrader.Domain", "OemanTrader.Domain\OemanTrader.Domain.csproj", "{22283C0E-61FB-4012-82C8-A6099D52218B}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OemanTrader.EntityFramework", "OemanTrader.EntityFramework\OemanTrader.EntityFramework.csproj", "{961E1C1B-FA81-409A-9D83-3C142E58EA3E}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OemanTrader.WPF", "OemanTrader.WPF\OemanTrader.WPF.csproj", "{AD3FBE7D-8D92-4D5D-97A8-33CDE02C3A32}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OemanTrader.FinantialModelingPrepAPI", "OemanTrader.FinantialModelingPrepAPI\OemanTrader.FinantialModelingPrepAPI.csproj", "{27A084A0-9AF3-4179-AB73-29A7CC723F0C}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{22283C0E-61FB-4012-82C8-A6099D52218B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{22283C0E-61FB-4012-82C8-A6099D52218B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{22283C0E-61FB-4012-82C8-A6099D52218B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{22283C0E-61FB-4012-82C8-A6099D52218B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{961E1C1B-FA81-409A-9D83-3C142E58EA3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{961E1C1B-FA81-409A-9D83-3C142E58EA3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{961E1C1B-FA81-409A-9D83-3C142E58EA3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{961E1C1B-FA81-409A-9D83-3C142E58EA3E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{AD3FBE7D-8D92-4D5D-97A8-33CDE02C3A32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{AD3FBE7D-8D92-4D5D-97A8-33CDE02C3A32}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{AD3FBE7D-8D92-4D5D-97A8-33CDE02C3A32}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{AD3FBE7D-8D92-4D5D-97A8-33CDE02C3A32}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{27A084A0-9AF3-4179-AB73-29A7CC723F0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{27A084A0-9AF3-4179-AB73-29A7CC723F0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{27A084A0-9AF3-4179-AB73-29A7CC723F0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{27A084A0-9AF3-4179-AB73-29A7CC723F0C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {F83485AD-4BA3-4B1C-A53B-F835E0221573}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
Reference in New Issue
Block a user