WebServer controller changes along with JSON settings
This commit is contained in:
82
.gitignore
vendored
82
.gitignore
vendored
@@ -17,82 +17,6 @@ eNavigator/eNavigatorUI/bin/**
|
|||||||
eNavigator/eNavigatorUI/obj/**
|
eNavigator/eNavigatorUI/obj/**
|
||||||
eNavigator/MarketDataLib/bin/**
|
eNavigator/MarketDataLib/bin/**
|
||||||
eNavigator/MarketDataLib/obj/**
|
eNavigator/MarketDataLib/obj/**
|
||||||
MarketDataServer/bin/Debug/net8.0/appsettings.json
|
MarketDataServer/bin/**
|
||||||
MarketDataServer/bin/Debug/net8.0/Axiom.Core.dll
|
MarketDataServer/obj/**
|
||||||
MarketDataServer/bin/Debug/net8.0/Axiom.Core.pdb
|
MarketDataServer/logs/**
|
||||||
MarketDataServer/bin/Debug/net8.0/BouncyCastle.Cryptography.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Google.Protobuf.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/HtmlAgilityPack.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/K4os.Compression.LZ4.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/K4os.Compression.LZ4.Streams.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/K4os.Hash.xxHash.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/log4net.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/log4net.xml
|
|
||||||
MarketDataServer/bin/Debug/net8.0/MarketDataLib.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/MarketDataLib.pdb
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Microsoft.Extensions.Configuration.Abstractions.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Microsoft.Extensions.Configuration.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Microsoft.Extensions.Configuration.FileExtensions.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Microsoft.Extensions.Configuration.Json.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Microsoft.Extensions.FileProviders.Abstractions.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Microsoft.Extensions.FileProviders.Physical.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Microsoft.Extensions.FileSystemGlobbing.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Microsoft.Extensions.Primitives.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Microsoft.OpenApi.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Microsoft.Win32.SystemEvents.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/mks
|
|
||||||
MarketDataServer/bin/Debug/net8.0/mks.deps.json
|
|
||||||
MarketDataServer/bin/Debug/net8.0/mks.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/mks.pdb
|
|
||||||
MarketDataServer/bin/Debug/net8.0/mks.runtimeconfig.json
|
|
||||||
MarketDataServer/bin/Debug/net8.0/MySql.Data.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Newtonsoft.Json.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Swashbuckle.AspNetCore.Swagger.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Swashbuckle.AspNetCore.SwaggerGen.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/Swashbuckle.AspNetCore.SwaggerUI.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/System.Configuration.ConfigurationManager.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/System.Drawing.Common.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/System.IO.Pipelines.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/System.Private.Windows.Core.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/System.Security.Cryptography.ProtectedData.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/System.Security.Permissions.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/System.Text.Encodings.Web.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/System.Text.Json.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/System.Windows.Extensions.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/ZstdSharp.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/logs/marketdata_marketdataserver.log
|
|
||||||
MarketDataServer/bin/Debug/net8.0/runtimes/browser/lib/net8.0/System.Text.Encodings.Web.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/runtimes/win/lib/net8.0/Microsoft.Win32.SystemEvents.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/runtimes/win/lib/net8.0/System.Windows.Extensions.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/runtimes/win-x64/native/comerr64.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/runtimes/win-x64/native/gssapi64.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/runtimes/win-x64/native/k5sprt64.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/runtimes/win-x64/native/krb5_64.dll
|
|
||||||
MarketDataServer/bin/Debug/net8.0/runtimes/win-x64/native/krbcc64.dll
|
|
||||||
MarketDataServer/obj/MarketDataServer.csproj.nuget.dgspec.json
|
|
||||||
MarketDataServer/obj/MarketDataServer.csproj.nuget.g.props
|
|
||||||
MarketDataServer/obj/MarketDataServer.csproj.nuget.g.targets
|
|
||||||
MarketDataServer/obj/project.assets.json
|
|
||||||
MarketDataServer/obj/project.nuget.cache
|
|
||||||
MarketDataServer/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs
|
|
||||||
MarketDataServer/obj/Debug/net8.0/apphost
|
|
||||||
MarketDataServer/obj/Debug/net8.0/MarketDa.2D592492.Up2Date
|
|
||||||
MarketDataServer/obj/Debug/net8.0/MarketDataServer.AssemblyInfo.cs
|
|
||||||
MarketDataServer/obj/Debug/net8.0/MarketDataServer.AssemblyInfoInputs.cache
|
|
||||||
MarketDataServer/obj/Debug/net8.0/MarketDataServer.assets.cache
|
|
||||||
MarketDataServer/obj/Debug/net8.0/MarketDataServer.csproj.AssemblyReference.cache
|
|
||||||
MarketDataServer/obj/Debug/net8.0/MarketDataServer.csproj.CoreCompileInputs.cache
|
|
||||||
MarketDataServer/obj/Debug/net8.0/MarketDataServer.csproj.FileListAbsolute.txt
|
|
||||||
MarketDataServer/obj/Debug/net8.0/MarketDataServer.GeneratedMSBuildEditorConfig.editorconfig
|
|
||||||
MarketDataServer/obj/Debug/net8.0/MarketDataServer.genruntimeconfig.cache
|
|
||||||
MarketDataServer/obj/Debug/net8.0/MarketDataServer.GlobalUsings.g.cs
|
|
||||||
MarketDataServer/obj/Debug/net8.0/mks.dll
|
|
||||||
MarketDataServer/obj/Debug/net8.0/mks.MvcApplicationPartsAssemblyInfo.cache
|
|
||||||
MarketDataServer/obj/Debug/net8.0/mks.MvcApplicationPartsAssemblyInfo.cs
|
|
||||||
MarketDataServer/obj/Debug/net8.0/mks.pdb
|
|
||||||
MarketDataServer/obj/Debug/net8.0/staticwebassets.build.json
|
|
||||||
MarketDataServer/obj/Debug/net8.0/ref/mks.dll
|
|
||||||
MarketDataServer/obj/Debug/net8.0/refint/mks.dll
|
|
||||||
MarketDataServer/obj/Debug/net8.0/staticwebassets/msbuild.build.mks.props
|
|
||||||
MarketDataServer/obj/Debug/net8.0/staticwebassets/msbuild.buildMultiTargeting.mks.props
|
|
||||||
MarketDataServer/obj/Debug/net8.0/staticwebassets/msbuild.buildTransitive.mks.props
|
|
||||||
|
|||||||
14
.vscode/launch.json
vendored
14
.vscode/launch.json
vendored
@@ -5,7 +5,7 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": ".NET Core Launch (console)",
|
"name": ".NET Core Launch (mk)",
|
||||||
"type": "coreclr",
|
"type": "coreclr",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build",
|
"preLaunchTask": "build",
|
||||||
@@ -16,9 +16,15 @@
|
|||||||
"stopAtEntry": false
|
"stopAtEntry": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": ".NET Core Attach",
|
"name": ".NET Core Launch (mks)",
|
||||||
"type": "coreclr",
|
"type": "coreclr",
|
||||||
"request": "attach"
|
"request": "launch",
|
||||||
}
|
"preLaunchTask": "build",
|
||||||
|
"program": "${workspaceFolder}/MarketDataServer/bin/Debug/net8.0/mks.dll",
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${workspaceFolder}/MarketDataServer",
|
||||||
|
"console": "internalConsole",
|
||||||
|
"stopAtEntry": false
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ namespace MarketData.Cache
|
|||||||
DateTime maxDate=symbolPrices.MaxDate; // get the latest date in the cache
|
DateTime maxDate=symbolPrices.MaxDate; // get the latest date in the cache
|
||||||
if(maxDbDates.ContainsKey(symbol) && !maxDbDates[symbol].Date.Equals(maxDate.Date)) // if the cache date and the database date are not equal then reload the cache
|
if(maxDbDates.ContainsKey(symbol) && !maxDbDates[symbol].Date.Equals(maxDate.Date)) // if the cache date and the database date are not equal then reload the cache
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"[LocalPriceCache] Cache date and Database date for {symbol} are not equal, reloading cache. Cache Date:{maxDate.ToShortDateString()} Database Date:{maxDbDates[symbol].Date.ToShortDateString()}");
|
// MDTrace.WriteLine(LogLevel.DEBUG,$"[LocalPriceCache] Cache date and Database date for {symbol} are not equal, reloading cache. Cache Date:{maxDate.ToShortDateString()} Database Date:{maxDbDates[symbol].Date.ToShortDateString()}");
|
||||||
Prices prices=PricingDA.GetPrices(symbol,symbolPrices.MinDate); // reload the prices for this symbol using the current minDate in the cache as a lower boundary
|
Prices prices=PricingDA.GetPrices(symbol,symbolPrices.MinDate); // reload the prices for this symbol using the current minDate in the cache as a lower boundary
|
||||||
if(null==prices)continue; // if we can't load any prices for symbol then just continue
|
if(null==prices)continue; // if we can't load any prices for symbol then just continue
|
||||||
priceCache.Remove(symbol); // remove the pricing entries in the price cache for the symbol
|
priceCache.Remove(symbol); // remove the pricing entries in the price cache for the symbol
|
||||||
@@ -77,7 +77,7 @@ namespace MarketData.Cache
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"[LocalPriceCache] Fetching latest price from database for {symbol} on {maxDate.ToShortDateString()}");
|
// MDTrace.WriteLine(LogLevel.DEBUG,$"[LocalPriceCache] Fetching latest price from database for {symbol} on {maxDate.ToShortDateString()}");
|
||||||
Price price=PricingDA.GetPrice(symbol,maxDate); // the max date from the cache equals the max date from the database so just reload the latest price from the database
|
Price price=PricingDA.GetPrice(symbol,maxDate); // the max date from the cache equals the max date from the database so just reload the latest price from the database
|
||||||
if(null==price)continue; // if no latest price then just continue
|
if(null==price)continue; // if no latest price then just continue
|
||||||
symbolPrices.Remove(maxDate); // remove the current price associated with the max date
|
symbolPrices.Remove(maxDate); // remove the current price associated with the max date
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ namespace MarketData.DataAccess
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if(null == symbols || 0==symbols.Count)return hasStopLimit;
|
||||||
StringBuilder sb=new StringBuilder();
|
StringBuilder sb=new StringBuilder();
|
||||||
if(null==symbols) return null;
|
if(null==symbols) return null;
|
||||||
sqlConnection=SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("portfolio_data"));
|
sqlConnection=SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("portfolio_data"));
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ namespace MarketData.DataAccess
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if(null ==symbols || 0==symbols.Count)return latestDates;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
|
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
|
||||||
sb.Append(" select symbol, max(date) as date ");
|
sb.Append(" select symbol, max(date) as date ");
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace MarketDataServer.Controllers
|
|||||||
{
|
{
|
||||||
private ActiveGainLossGenerator gainLossGenerator=new ActiveGainLossGenerator();
|
private ActiveGainLossGenerator gainLossGenerator=new ActiveGainLossGenerator();
|
||||||
|
|
||||||
[HttpGet(Name = "GetGainLoss")]
|
[HttpGet]
|
||||||
public IEnumerable<GainLossSummaryItem> GetGainLoss(String token, DateTime selectedDate)
|
public IEnumerable<GainLossSummaryItem> GetGainLossByDate(String token,DateTime selectedDate)
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLoss](String token, DateTime selectedDate)", DateTime.Now));
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLoss](String token, DateTime selectedDate)", DateTime.Now));
|
||||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||||
@@ -53,8 +53,8 @@ namespace MarketDataServer.Controllers
|
|||||||
return gainLossSummaryItems;
|
return gainLossSummaryItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet(Name = "GetGainLoss")]
|
[HttpGet]
|
||||||
public IEnumerable<GainLossSummaryItem> GetGainLoss(String token, DateTime selectedDate,String account)
|
public IEnumerable<GainLossSummaryItem> GetGainLossByDateAndAccount(String token,DateTime selectedDate,String account)
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLoss](String token, DateTime selectedDate,String account)", DateTime.Now));
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLoss](String token, DateTime selectedDate,String account)", DateTime.Now));
|
||||||
LocalPriceCache.GetInstance().Refresh();
|
LocalPriceCache.GetInstance().Refresh();
|
||||||
@@ -89,8 +89,8 @@ namespace MarketDataServer.Controllers
|
|||||||
return gainLossSummaryItems;
|
return gainLossSummaryItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet(Name = "GetGainLossWithDetail")]
|
[HttpGet]
|
||||||
public IEnumerable<GainLossSummaryItemDetail> GetGainLossWithDetail(String token, DateTime selectedDate)
|
public IEnumerable<GainLossSummaryItemDetail> GetGainLossWithDetailByDate(String token,DateTime selectedDate)
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLossWithDetail](String token, DateTime selectedDate)", DateTime.Now));
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLossWithDetail](String token, DateTime selectedDate)", DateTime.Now));
|
||||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||||
@@ -175,8 +175,8 @@ namespace MarketDataServer.Controllers
|
|||||||
return gainLossSummaryItemDetailCollection;
|
return gainLossSummaryItemDetailCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet(Name = "GetGainLossWithDetail")]
|
[HttpGet]
|
||||||
public IEnumerable<GainLossSummaryItemDetail> GetGainLossWithDetail(String token, DateTime selectedDate, String account)
|
public IEnumerable<GainLossSummaryItemDetail> GetGainLossWithDetailByDateAndAccount(String token, DateTime selectedDate, String account)
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLossWithDetail](String token, DateTime selectedDate,String account)", DateTime.Now));
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLossWithDetail](String token, DateTime selectedDate,String account)", DateTime.Now));
|
||||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using MarketData;
|
using MarketData;
|
||||||
using MarketData.Configuration;
|
using MarketData.Configuration;
|
||||||
using MarketData.Utils;
|
using MarketData.Utils;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using MarketDataServer.Authorization;
|
using MarketDataServer.Authorization;
|
||||||
|
|
||||||
namespace MarketDataServer
|
namespace MarketDataServer
|
||||||
@@ -13,7 +16,7 @@ namespace MarketDataServer
|
|||||||
String logFileName="marketdataserver";
|
String logFileName="marketdataserver";
|
||||||
Authorizations.GetInstance().IsEnabled=false;
|
Authorizations.GetInstance().IsEnabled=false;
|
||||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
GlobalConfig.Instance.Configuration = builder.Configuration;
|
GlobalConfig.Instance.Configuration = builder.Configuration;
|
||||||
String baseAddress = GlobalConfig.Instance.Configuration["server_address"];
|
String baseAddress = GlobalConfig.Instance.Configuration["server_address"];
|
||||||
@@ -21,7 +24,16 @@ namespace MarketDataServer
|
|||||||
|
|
||||||
MDTrace.WriteLine(MarketData.LogLevel.DEBUG,$"Server Address:{baseAddress}");
|
MDTrace.WriteLine(MarketData.LogLevel.DEBUG,$"Server Address:{baseAddress}");
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers().AddJsonOptions(options =>
|
||||||
|
{
|
||||||
|
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
|
||||||
|
options.JsonSerializerOptions.DictionaryKeyPolicy = JsonNamingPolicy.CamelCase;
|
||||||
|
options.JsonSerializerOptions.NumberHandling = JsonNumberHandling.WriteAsString;
|
||||||
|
options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
|
||||||
|
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen( config =>
|
builder.Services.AddSwaggerGen( config =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"market_data" : "Database=market_data;Datasource=euporie;Username=guest;Password=guest",
|
"market_data" : "Database=market_data;Datasource=euporie;Username=guest;Password=guest",
|
||||||
"portfolio_data" : "Database=portfolio_data;Datasource=euporie;Username=guest;Password=guest",
|
"portfolio_data" : "Database=portfolio_data;Datasource=euporie;Username=guest;Password=guest",
|
||||||
"user_data" : "Database=user_data;Datasource=euporie;Username=guest;Password=guest",
|
"user_data" : "Database=user_data;Datasource=euporie;Username=guest;Password=guest",
|
||||||
"server_address" : "http://localhost:8000/",
|
"server_address" : "http://0.0.0.0:8000/",
|
||||||
"sms_smtpaddress" : "smtp.gmail.com",
|
"sms_smtpaddress" : "smtp.gmail.com",
|
||||||
"sms_smsusername" : "skessler1964@gmail.com",
|
"sms_smsusername" : "skessler1964@gmail.com",
|
||||||
"sms_smspassword" : "xjfo isnf gmyi zovr",
|
"sms_smspassword" : "xjfo isnf gmyi zovr",
|
||||||
|
|||||||
Reference in New Issue
Block a user