Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28b03e1cd2 | ||
|
|
a7acb89c15 | ||
|
|
35289710ba | ||
|
|
4677acfb39 | ||
|
|
ac05d0d69e | ||
|
|
25a9b6b433 | ||
|
|
b78713ad0d | ||
|
|
1f3d0e879c | ||
|
|
baad4dc68e | ||
|
|
ef7c0c7a30 | ||
|
|
3b3c4a2a35 | ||
|
|
ef9fc66a31 | ||
|
|
212d9c853b | ||
|
|
7815b18b6b | ||
|
|
05126074d4 | ||
|
|
3611d2c1f3 | ||
|
|
b5ad4b8104 | ||
|
|
43d7c0a2b5 | ||
|
|
12e361cec7 | ||
|
|
82c126362d | ||
|
|
fd2ba70031 | ||
|
|
ab410c339f | ||
|
|
9e3f16d8bc | ||
|
|
a3f194d708 | ||
|
|
bf87c46fcd | ||
|
|
222d4b266e | ||
|
|
d593eaf058 | ||
|
|
55d021ccb1 |
No files matched your search
@@ -7,6 +7,24 @@
|
||||
"commands": [
|
||||
"dotnet-format"
|
||||
]
|
||||
},
|
||||
"fable": {
|
||||
"version": "4.0.0-theta-018",
|
||||
"commands": [
|
||||
"fable"
|
||||
]
|
||||
},
|
||||
"fantomas": {
|
||||
"version": "5.2.2",
|
||||
"commands": [
|
||||
"fantomas"
|
||||
]
|
||||
},
|
||||
"fake-cli": {
|
||||
"version": "6.0.0",
|
||||
"commands": [
|
||||
"fake"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
Submodule externals updated: 4d96613ca8...4a3e40193e.
@@ -1,53 +1,55 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<ComputerSpecificConfig>..\..\tools\override\$(computername).props</ComputerSpecificConfig>
|
||||
<SparkRoot>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\..))</SparkRoot>
|
||||
<SourceRoot>$([System.IO.Path]::GetFullPath($(SparkRoot)\src))</SourceRoot>
|
||||
<Externals>$(SparkRoot)\externals\windows</Externals>
|
||||
<DepotName>$([System.IO.Path]::GetFileName($([System.IO.Path]::GetFullPath($(SparkRoot)))))</DepotName>
|
||||
<ErrorReport>None</ErrorReport>
|
||||
<Prefer32Bit>False</Prefer32Bit>
|
||||
<Deterministic>true</Deterministic>
|
||||
<EnableDefaultContentItems>False</EnableDefaultContentItems>
|
||||
<ShowMissingItemTypes>false</ShowMissingItemTypes>
|
||||
<Configuration Condition="'$(configuration)'==''">Debug</Configuration>
|
||||
<EnablePreviewFeatures>true</EnablePreviewFeatures>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Label="Output">
|
||||
<BaseOutputPath>$(SparkRoot)\build\$(Configuration)</BaseOutputPath>
|
||||
<OutputPath>$(BaseOutputPath)\bin</OutputPath>
|
||||
<BaseIntermediateOutputPath>$(BaseOutputPath)\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<IntermediateOutputPath>$(BaseOutputPath)\obj\$(MSBuildProjectName)</IntermediateOutputPath>
|
||||
<GenDir>$(BaseOutputPath)\gen\$(MSBuildProjectName)</GenDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import
|
||||
Project="$(ComputerSpecificConfig)"
|
||||
Condition="Exists($(ComputerSpecificConfig))" />
|
||||
|
||||
<PropertyGroup Label="ProtoBuf">
|
||||
<ProtocPluginBase>$(SparkRoot)\src\lib\api\service_compiler</ProtocPluginBase>
|
||||
<protoc>$(Externals)\bin\protoc.exe</protoc>
|
||||
<protogen>$(Externals)\bin\protogen.exe</protogen>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemDefinitionGroup>
|
||||
<Proto2></Proto2>
|
||||
<Proto3>
|
||||
<OutBase>$(IntermediateOutputPath)\gen\%(relativedir)</OutBase>
|
||||
<OutCS>%(OutBase)%(FileName).cs</OutCS>
|
||||
<OutCSClient>%(OutBase)%(FileName).client.pb.cs</OutCSClient>
|
||||
<OutCSServer>%(OutBase)%(FileName).server.pb.cs</OutCSServer>
|
||||
<OutCSImmutable>%(OutBase)%(FileName).immutable.pb.cs</OutCSImmutable>
|
||||
<CompileOptions></CompileOptions>
|
||||
</Proto3>
|
||||
<Proto3Excel>
|
||||
<OutBase>$(IntermediateOutputPath)\gen\%(relativedir)</OutBase>
|
||||
<OutCSExcel>%(OutBase)%(FileName).excel.pb.cs</OutCSExcel>
|
||||
<CompileOptions></CompileOptions>
|
||||
</Proto3Excel>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
</Project>
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<ComputerSpecificConfig>..\..\tools\override\$(computername).props</ComputerSpecificConfig>
|
||||
<SparkRoot>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\..))</SparkRoot>
|
||||
<SourceRoot>$([System.IO.Path]::GetFullPath($(SparkRoot)\src))</SourceRoot>
|
||||
<Externals>$(SparkRoot)\externals\windows</Externals>
|
||||
<DepotName>$([System.IO.Path]::GetFileName($([System.IO.Path]::GetFullPath($(SparkRoot)))))</DepotName>
|
||||
<ErrorReport>None</ErrorReport>
|
||||
<Prefer32Bit>False</Prefer32Bit>
|
||||
<Deterministic>true</Deterministic>
|
||||
<EnableDefaultContentItems>False</EnableDefaultContentItems>
|
||||
<ShowMissingItemTypes>false</ShowMissingItemTypes>
|
||||
<Configuration Condition="'$(configuration)'==''">Debug</Configuration>
|
||||
<EnablePreviewFeatures>true</EnablePreviewFeatures>
|
||||
<LangVersion>11</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Label="Output">
|
||||
<BaseOutputPath>$(SparkRoot)\build\$(Configuration)</BaseOutputPath>
|
||||
<OutputPath>$(BaseOutputPath)\bin</OutputPath>
|
||||
<BaseIntermediateOutputPath>$(BaseOutputPath)\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<IntermediateOutputPath>$(BaseOutputPath)\obj\$(MSBuildProjectName)</IntermediateOutputPath>
|
||||
<ProtoOutputPath>$(BaseOutputPath)\obj\$(MSBuildProjectName)</ProtoOutputPath>
|
||||
<GenDir>$(BaseOutputPath)\gen\$(MSBuildProjectName)</GenDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import
|
||||
Project="$(ComputerSpecificConfig)"
|
||||
Condition="Exists($(ComputerSpecificConfig))" />
|
||||
|
||||
<PropertyGroup Label="ProtoBuf">
|
||||
<ProtocPluginBase>$(SparkRoot)\src\lib\api\service_compiler</ProtocPluginBase>
|
||||
<protoc>$(Externals)\bin\protoc.exe</protoc>
|
||||
<protogen>$(Externals)\bin\protogen.exe</protogen>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemDefinitionGroup>
|
||||
<Proto2></Proto2>
|
||||
<Proto3>
|
||||
<OutBase>$(IntermediateOutputPath)\gen\%(relativedir)</OutBase>
|
||||
<OutCS>%(OutBase)%(FileName).cs</OutCS>
|
||||
<OutCSClient>%(OutBase)%(FileName).client.pb.cs</OutCSClient>
|
||||
<OutCSServer>%(OutBase)%(FileName).server.pb.cs</OutCSServer>
|
||||
<OutCSImmutable>%(OutBase)%(FileName).immutable.pb.cs</OutCSImmutable>
|
||||
<CompileOptions></CompileOptions>
|
||||
</Proto3>
|
||||
<Proto3Excel>
|
||||
<OutBase>$(IntermediateOutputPath)\gen\%(relativedir)</OutBase>
|
||||
<OutCSExcel>%(OutBase)%(FileName).excel.pb.cs</OutCSExcel>
|
||||
<CompileOptions></CompileOptions>
|
||||
</Proto3Excel>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
</Project>
|
||||
@@ -3,7 +3,6 @@ namespace mbts.spark {
|
||||
using bts.api;
|
||||
using bts.api.analytics;
|
||||
using bts.collections;
|
||||
using bts.reactive;
|
||||
using bts.utils;
|
||||
|
||||
using mbts;
|
||||
@@ -18,6 +17,7 @@ namespace mbts.spark {
|
||||
using Spark.Core;
|
||||
using Spark.Core.Collections;
|
||||
using Spark.Core.Disposables;
|
||||
using Spark.Core.Reactive;
|
||||
using Spark.ViewModel.Commands;
|
||||
|
||||
using System;
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
namespace mbts.spark {
|
||||
using bts;
|
||||
using bts.api;
|
||||
|
||||
using mbts;
|
||||
using mbts.analytics;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Collections;
|
||||
|
||||
// For each vs, it sends the vol surface calc request (_do_periodic_auto_fit)
|
||||
// and then commits the response
|
||||
public class SingleVolSurfaceAutoFitSource : IDisposable {
|
||||
private readonly ThreadedBlackboard _bb;
|
||||
private readonly int _vs_id;
|
||||
private readonly ITag<VolSurfaceInput> _vs_input_tag;
|
||||
private readonly ITag<VolSurfaceCalculationResponse> _vs_calc_response_tag;
|
||||
private DateTime _last_req_time = DateTime.MinValue;
|
||||
private TimeSpan _req_period = TimeSpan.MaxValue;
|
||||
private int _req_id = 0;
|
||||
public SingleVolSurfaceAutoFitSource(int vs_id, ThreadedBlackboard bb) {
|
||||
_bb = bb;
|
||||
_vs_id = vs_id;
|
||||
_vs_input_tag = SparkTags.VolSurfaceCommittedInputTag(vs_id);
|
||||
_vs_calc_response_tag = SparkTags.VolSurfaceAutoCalculationResponseTag(vs_id);
|
||||
_bb.subscribe(_vs_input_tag);
|
||||
_bb.subscribe(_vs_calc_response_tag);
|
||||
_bb.subscribe(SparkTags.CurrentUser);
|
||||
_bb.data_callback += _on_bb_data;
|
||||
_bb.timer_callback += _on_bb_timer;
|
||||
}
|
||||
|
||||
private void _on_bb_data(object tag, object data) {
|
||||
if (tag.Equals(_vs_input_tag))
|
||||
_possibly_autofit();
|
||||
else if (tag.Equals(_vs_calc_response_tag)) {
|
||||
VolSurfaceCalculationResponse calc_resp = data as VolSurfaceCalculationResponse;
|
||||
bts.Log.Gen.info($"SingleVolSurfaceAutoFitSource._on_bb_data vs_id: {_vs_id} " +
|
||||
$"received calculation response");
|
||||
_bb.post(SparkTags.VolSurfaceCommitTag(_vs_id),
|
||||
calc_resp.volsurface_calculation_output.volsurface_input);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _user_has_vs_control() {
|
||||
VolSurfaceInput vs_input = _bb.read_state(_vs_input_tag);
|
||||
string current_user = _bb.read_state(SparkTags.CurrentUser).name;
|
||||
return vs_input != null &&
|
||||
vs_input.surface_settings.core_settings.vs_manager == current_user;
|
||||
}
|
||||
|
||||
private void _on_bb_timer() {
|
||||
_possibly_autofit();
|
||||
}
|
||||
|
||||
private void _possibly_autofit() {
|
||||
var auto_fit_period = _get_auto_fit_periodic();
|
||||
if (!auto_fit_period.HasValue)
|
||||
return;
|
||||
if (DateTime.Now - _last_req_time <= auto_fit_period)
|
||||
return;
|
||||
if (!_user_has_vs_control())
|
||||
return;
|
||||
// auto fit here
|
||||
bts.Log.Gen.info($"SingleVolSurfaceAutoFitSource vs_id: {_vs_id} requesting fit " +
|
||||
$"last_req_time: {_last_req_time} period: {auto_fit_period.Value}");
|
||||
_send_request();
|
||||
}
|
||||
|
||||
private Nullable<TimeSpan> _get_auto_fit_periodic() {
|
||||
VolSurfaceInput vs_input = _bb.read_state(_vs_input_tag);
|
||||
if (vs_input == null)
|
||||
return null;
|
||||
var fit_settings =
|
||||
VolSurfaceDataFunctions.get_market_fit_settings(vs_input.surface_settings);
|
||||
if (fit_settings == null)
|
||||
return null;
|
||||
var auto_fit_setting = fit_settings.vs_auto_fit_settings;
|
||||
if (auto_fit_setting == null)
|
||||
return null;
|
||||
if (auto_fit_setting.auto_fit_region == VolSurfaceEnums.VolCurveFitRegion.None)
|
||||
return null;
|
||||
var time_based_fit_setting = auto_fit_setting.time_based_settings;
|
||||
if (time_based_fit_setting == null)
|
||||
return null;
|
||||
if (!time_based_fit_setting.period_seconds.HasValue)
|
||||
return null;
|
||||
return TimeSpan.FromSeconds(time_based_fit_setting.period_seconds.Value);
|
||||
}
|
||||
|
||||
private void _send_request() {
|
||||
VolSurfaceInput vs_input = _bb.read_state(_vs_input_tag);
|
||||
if (vs_input == null)
|
||||
return;
|
||||
VolCurveMarketFitAction mf_action = new VolCurveMarketFitAction(
|
||||
VolCurveMarketFitAction.ActionType.FitWholeCurve, null, false);
|
||||
VolCurveAction vc_action = new VolCurveAction(mf_action);
|
||||
IDictionary<VolSurfaceExpiration, VolCurveAction> action_map =
|
||||
vs_input.surface_parameters.curve_parameters_map.ToDictionary(
|
||||
i => i.Item1,
|
||||
i => vc_action
|
||||
);
|
||||
VolSurfaceCalculationRequest req = new VolSurfaceCalculationRequest(vs_input,
|
||||
_req_id++, action_map, true, true);
|
||||
_last_req_time = DateTime.Now;
|
||||
_bb.post(SparkTags.VolSurfaceAutoCalculationRequestTag(_vs_id), req);
|
||||
}
|
||||
|
||||
|
||||
#region IDisposable
|
||||
public void Dispose() {
|
||||
_bb.data_callback -= _on_bb_data;
|
||||
_bb.timer_callback -= _on_bb_timer;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -63,9 +63,9 @@ namespace mbts.spark {
|
||||
vs_input, vs_nonvol_data.contracts, aux_data_map);
|
||||
_timer.stop();
|
||||
var tag_str = tag == null ? "Null" : tag.ToString();
|
||||
bts.Log.Gen.info($"SingleVolSurfaceCommittedOutputRetriever._recompute_and_publish " +
|
||||
$"vs_id: {_vs_id} time:{_timer.lastIntervalTime} ms tag:{tag_str} " +
|
||||
$"tid:{_tid()}"); //output: {vs_output.log_string()}*/");
|
||||
// bts.Log.Gen.info($"SingleVolSurfaceCommittedOutputRetriever._recompute_and_publish " +
|
||||
// $"vs_id: {_vs_id} time:{_timer.lastIntervalTime} ms tag:{tag_str} " +
|
||||
// $"tid:{_tid()}"); //output: {vs_output.log_string()}*/");
|
||||
_logger.log(_log_id, _log_id, _timer.lastIntervalTime);
|
||||
_bb.post(_out_bb_computed_vol_tag, vs_output);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using bts.api.analytics;
|
||||
|
||||
using mbts.analytics;
|
||||
using mbts.ui;
|
||||
|
||||
using Spark.Core.Protobuf;
|
||||
|
||||
@@ -13,6 +14,7 @@
|
||||
using System.Linq;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
// For a single VolSurface this class
|
||||
// 1. Listents to commmits and calls the service to persist data
|
||||
@@ -24,7 +26,6 @@
|
||||
private readonly ITag<VolSurfaceInput> _in_bb_committ_tag;
|
||||
private readonly AnalyticsService _analytics_service;
|
||||
private readonly HighPerformanceTimer _timer = new HighPerformanceTimer();
|
||||
private readonly string _user;
|
||||
private readonly List<IDisposable> _disposables = new List<IDisposable>();
|
||||
private IDictionary<UInt64, VolSurfaceInputSnapshot> _snp_shot_map = new
|
||||
Dictionary<UInt64, VolSurfaceInputSnapshot>();
|
||||
@@ -35,10 +36,10 @@
|
||||
volsurface_id));
|
||||
_volsurface_id = volsurface_id;
|
||||
_bb = threaded_bb;
|
||||
_user = "TEST_USER"; // TODO
|
||||
_in_bb_committ_tag = SparkTags.VolSurfaceCommitTag(volsurface_id);
|
||||
_analytics_service = analytics_service;
|
||||
_bb.subscribe(_in_bb_committ_tag);
|
||||
_bb.subscribe(SparkTags.CurrentUser);
|
||||
_bb.data_callback += _on_bb_data;
|
||||
var vs_sub = _analytics_service.subscribei_volsurfaces()
|
||||
.ObserveOn(SynchronizationContext.Current)
|
||||
@@ -83,15 +84,27 @@
|
||||
static VolSurfaceInput _to_vs_input(VolSurfaceEntryImmutable vs) =>
|
||||
ProtobufSerializationHelper.deserialize<VolSurfaceInput>(vs.Volsurface.ToByteArray());
|
||||
|
||||
// private void _show_save_error(string message) {
|
||||
// BTSMessageBox.Show(message, "Vol Save Error", BTSMessageBoxButtons.OK);
|
||||
// }
|
||||
|
||||
private void _on_bb_data(object tag, object data) {
|
||||
if (_in_bb_committ_tag.Equals(tag)) {
|
||||
try {
|
||||
_timer.start();
|
||||
VolSurfaceInput vs_input = data as VolSurfaceInput;
|
||||
var user_tup = _bb.read_state(SparkTags.CurrentUser);
|
||||
string current_user = user_tup.name;
|
||||
string vs_manager = vs_input.surface_settings.core_settings.vs_manager;
|
||||
if (current_user != vs_manager) {
|
||||
string msg = $"User {current_user} does not have the permission to save vols. " +
|
||||
$"Permission can be obtained via the grid context menu item 'Acquire ownership from {vs_manager}'";
|
||||
BTSMessageBox.Show(msg, "Vol Save Error", BTSMessageBoxButtons.OK);
|
||||
return;
|
||||
}
|
||||
_sanitize_input(ref vs_input);
|
||||
vs_input = VolSurfaceDataFunctions.unset_driver_overrides(vs_input);
|
||||
vs_input.saver_login = _user;
|
||||
VolSurfaceUtilityFunctions.save_volsurface(vs_input, _analytics_service, _user);
|
||||
VolSurfaceUtilityFunctions.save_volsurface(vs_input, _analytics_service, current_user);
|
||||
_timer.stop();
|
||||
Log.Gen.info(String.Format(
|
||||
"SingleVolSurfaceGateway._on_bb_data Time to commit volsurface {0} {1} msecs",
|
||||
|
||||
@@ -36,7 +36,11 @@ namespace mbts.spark {
|
||||
new SingleVolSurfaceDataSource(SingleVolSurfaceDataSource.SymbolListType.Committed, _vs_id, _bb,
|
||||
a_syms => new SingleVolSurfaceCommittedOutputRetriever(_vs_id, _bb, a_syms)),
|
||||
new SingleVolSurfaceDataSource(SingleVolSurfaceDataSource.SymbolListType.Combined, _vs_id, _bb,
|
||||
a_syms => new SingleVolSurfaceRequestCalculator(_vs_id, a_syms, _bb)),
|
||||
a_syms => new SingleVolSurfaceRequestCalculator(
|
||||
SingleVolSurfaceRequestCalculator.RequestType.UI, _vs_id, a_syms, _bb)),
|
||||
new SingleVolSurfaceDataSource(SingleVolSurfaceDataSource.SymbolListType.Combined, _vs_id, _bb,
|
||||
a_syms => new SingleVolSurfaceRequestCalculator(
|
||||
SingleVolSurfaceRequestCalculator.RequestType.AUTO, _vs_id, a_syms, _bb)),
|
||||
new SingleVolSurfaceMarketImpliedVolSource(_vs_id, _bb),
|
||||
// new SingleVolSurfaceTheoSource(_vs_id, _bb),
|
||||
// TODO: suspending heatmaps for now (12/24/21)
|
||||
@@ -44,6 +48,7 @@ namespace mbts.spark {
|
||||
// server work that can optionally be done on the client
|
||||
new SingleVolSurfaceDataSource (SingleVolSurfaceDataSource.SymbolListType.Committed, _vs_id, _bb,
|
||||
a_syms => new SingleVolSurfaceInterpGreeksPublisher (_vs_id, _bb, a_syms)),
|
||||
new SingleVolSurfaceAutoFitSource(_vs_id, _bb),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace mbts.spark {
|
||||
var exp_price_map = OptionDriverPriceMap.get_vs_price_map(
|
||||
all_sym_price_map, (s) => _option_symbols.Contains(s));
|
||||
if (sc_data != null && vs_nonvol_input != null && exp_price_map != null) {
|
||||
bts.Log.Gen.info($"SingleVolSurfaceNonVolDataSource vs_id:{_vs_id} " +
|
||||
bts.Log.Gen.diag($"SingleVolSurfaceNonVolDataSource vs_id:{_vs_id} " +
|
||||
"publishing VolSurfaceNonVolData");
|
||||
_bb.post(_out_bb_vs_nonvol_data_tag,
|
||||
new VolSurfaceNonVolData(
|
||||
|
||||
@@ -18,10 +18,16 @@ namespace mbts.spark {
|
||||
// Pubs :
|
||||
// 1. Calc Resp
|
||||
public class SingleVolSurfaceRequestCalculator : IDisposable {
|
||||
public enum RequestType {
|
||||
UI = 0,
|
||||
AUTO
|
||||
}
|
||||
private readonly RequestType _request_type = RequestType.UI;
|
||||
private readonly int _vs_id;
|
||||
private readonly HashSet<string> _symbols;
|
||||
private readonly ThreadedBlackboard _bb;
|
||||
private readonly ITag<VolSurfaceCalculationRequest> _in_bb_request_tag;
|
||||
private readonly ITag<VolSurfaceCalculationRequest> _in_bb_auto_request_tag;
|
||||
private readonly ITag<VolSurfaceNonVolData> _in_bb_nonvol_data_tag;
|
||||
private readonly ITag<VolSurfaceStandardTime> _in_bb_vs_standard_time_tag;
|
||||
private readonly ITag<VolSurfaceEnums.MarketSide> _in_bb_market_impliedvol_side_tag;
|
||||
@@ -30,18 +36,22 @@ namespace mbts.spark {
|
||||
/// data
|
||||
private VolSurfaceOutput _last_output;
|
||||
|
||||
public SingleVolSurfaceRequestCalculator(int vs_id, IEnumerable<string> symbols,
|
||||
public SingleVolSurfaceRequestCalculator(RequestType request_type,
|
||||
int vs_id, IEnumerable<string> symbols,
|
||||
ThreadedBlackboard threaded_bb) {
|
||||
bts.Log.Gen.info($"SingleVolSurfaceRequestCalculator cons vs_id: {vs_id}");
|
||||
bts.Log.Gen.info($"SingleVolSurfaceRequestCalculator cons vs_id: {vs_id} request_type: {request_type}");
|
||||
_request_type = request_type;
|
||||
_vs_id = vs_id;
|
||||
_symbols = new HashSet<string>(symbols);
|
||||
_bb = threaded_bb;
|
||||
_in_bb_request_tag = SparkTags.VolSurfaceCalculationRequestTag(vs_id);
|
||||
_in_bb_auto_request_tag = SparkTags.VolSurfaceAutoCalculationRequestTag(vs_id);
|
||||
_in_bb_nonvol_data_tag = SparkTags.VolSurfaceNonVolDataTag(vs_id);
|
||||
_in_bb_vs_standard_time_tag = SparkTags.VolSurfaceStandardTimeTag(vs_id);
|
||||
_in_bb_market_impliedvol_side_tag = SparkTags.VolSurfaceMarketImpliedVolSide(vs_id);
|
||||
_in_bb_dirty_tag = SparkTags.VolSurfaceDirtyStateTag(vs_id);
|
||||
_bb.subscribe(_in_bb_request_tag);
|
||||
_bb.subscribe(_in_bb_auto_request_tag);
|
||||
_bb.subscribe(_in_bb_nonvol_data_tag);
|
||||
_bb.subscribe(_in_bb_vs_standard_time_tag);
|
||||
_bb.subscribe(_in_bb_vs_standard_time_tag);
|
||||
@@ -51,11 +61,21 @@ namespace mbts.spark {
|
||||
}
|
||||
|
||||
private void _on_bb_data(object tag, object data) {
|
||||
if (_in_bb_request_tag.Equals(tag) || _in_bb_dirty_tag.Equals(tag))
|
||||
_recompute_and_publish(true);
|
||||
else if (_in_bb_nonvol_data_tag.Equals(tag) || _in_bb_vs_standard_time_tag.Equals(tag))
|
||||
_recompute_and_publish(false);
|
||||
|
||||
switch (_request_type) {
|
||||
case RequestType.UI: {
|
||||
if (_in_bb_request_tag.Equals(tag) || _in_bb_dirty_tag.Equals(tag))
|
||||
_recompute_and_publish(true);
|
||||
else if (_in_bb_nonvol_data_tag.Equals(tag) || _in_bb_vs_standard_time_tag.Equals(tag))
|
||||
_recompute_and_publish(false);
|
||||
break;
|
||||
}
|
||||
case RequestType.AUTO: {
|
||||
if (tag.Equals(_in_bb_auto_request_tag)) {
|
||||
_serve_auto_request();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void _recompute_and_publish(bool is_new_request) {
|
||||
@@ -80,7 +100,7 @@ namespace mbts.spark {
|
||||
nonvol_data.driver_price_map,
|
||||
vs_standard_time, true);
|
||||
IDictionary<VolSurfaceExpiration, VolCurveAction> action_map =
|
||||
_post_process_action(effective_req, aux_data_map);
|
||||
_post_process_action(_bb, _vs_id, effective_req, aux_data_map);
|
||||
_last_output = GeneralVolSurfaceCalculator.compute(effective_req.volsurface_input,
|
||||
nonvol_data.contracts,
|
||||
aux_data_map,
|
||||
@@ -89,16 +109,49 @@ namespace mbts.spark {
|
||||
effective_req.cascade_up,
|
||||
effective_req.cascade_down);
|
||||
_timer.stop();
|
||||
bts.Log.Gen.info($"SingleVolSurfaceRequestCalculator._recompute_and_publish time: " +
|
||||
$"{_timer.lastIntervalTime}");
|
||||
bts.Log.Gen.info($"SingleVolSurfaceRequestCalculator._recompute_and_publish vs_id: {_vs_id} " +
|
||||
$"time: {_timer.lastIntervalTime}");
|
||||
_bb.post(SparkTags.VolSurfaceCalculationResponseTag(_vs_id),
|
||||
new VolSurfaceCalculationResponse(_last_output, effective_req.request_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void _serve_auto_request() {
|
||||
bts.Log.Gen.info($"SingleVolSurfaceRequestCalculator._serve_auto_request " +
|
||||
$"vs_id: {_vs_id} auto request received");
|
||||
bool is_dirty = _bb.read_state(_in_bb_dirty_tag, false);
|
||||
VolSurfaceNonVolData nonvol_data = _bb.read_state(_in_bb_nonvol_data_tag);
|
||||
VolSurfaceStandardTime vs_standard_time = _bb.read_state(_in_bb_vs_standard_time_tag);
|
||||
VolSurfaceCalculationRequest auto_req = _bb.read_state(_in_bb_auto_request_tag);
|
||||
if (is_dirty || nonvol_data == null || vs_standard_time == null || auto_req == null) {
|
||||
return;
|
||||
}
|
||||
_timer.start();
|
||||
IDictionary<VolSurfaceExpiration, VolSurfaceExpirationAuxiliaryData> aux_data_map =
|
||||
VolSurfaceUtilityFunctions.compute_aux_data(auto_req.volsurface_input,
|
||||
nonvol_data.input,
|
||||
nonvol_data.driver_price_map,
|
||||
vs_standard_time, true);
|
||||
IDictionary<VolSurfaceExpiration, VolCurveAction> action_map =
|
||||
_post_process_action(_bb, _vs_id, auto_req, aux_data_map);
|
||||
var vs_output = GeneralVolSurfaceCalculator.compute(auto_req.volsurface_input,
|
||||
nonvol_data.contracts,
|
||||
aux_data_map,
|
||||
action_map,
|
||||
null,
|
||||
auto_req.cascade_up,
|
||||
auto_req.cascade_down);
|
||||
_timer.stop();
|
||||
bts.Log.Gen.info($"SingleVolSurfaceRequestCalculator._serve_auto_request vs_id: {_vs_id} " +
|
||||
$"time: {_timer.lastIntervalTime}");
|
||||
_bb.post(SparkTags.VolSurfaceAutoCalculationResponseTag(_vs_id),
|
||||
new VolSurfaceCalculationResponse(vs_output, auto_req.request_id));
|
||||
}
|
||||
|
||||
/// Computes the impl vol if the action is fit to market
|
||||
private IDictionary<VolSurfaceExpiration, VolCurveAction> _post_process_action(
|
||||
private static IDictionary<VolSurfaceExpiration, VolCurveAction> _post_process_action(
|
||||
ThreadedBlackboard bb, int vs_id,
|
||||
VolSurfaceCalculationRequest req,
|
||||
IDictionary<VolSurfaceExpiration, VolSurfaceExpirationAuxiliaryData> aux_data_map) {
|
||||
IDictionary<VolSurfaceExpiration, VolCurveAction> rv = req.action_map;
|
||||
@@ -109,7 +162,7 @@ namespace mbts.spark {
|
||||
VolCurveAction rep_action = rv.ElementAt(0).Value;
|
||||
if (rep_action.action_type == VolCurveAction.ActionType.FitToMarket) {
|
||||
IDictionary<VolSurfaceExpiration, VolCurveMarketImpliedVolData> impl_vol_map =
|
||||
_fill_in_implied_vols(req.volsurface_input, req.action_map, aux_data_map,
|
||||
_fill_in_implied_vols(bb, vs_id, req.volsurface_input, req.action_map, aux_data_map,
|
||||
req.cascade_up, req.cascade_down);
|
||||
rv = impl_vol_map.ToDictionary(kv => kv.Key, kv => new VolCurveAction(
|
||||
new VolCurveMarketFitAction(rep_action.market_fit_action.fit_action, kv.Value,
|
||||
@@ -119,7 +172,8 @@ namespace mbts.spark {
|
||||
return rv;
|
||||
}
|
||||
|
||||
private IDictionary<VolSurfaceExpiration, VolCurveMarketImpliedVolData> _fill_in_implied_vols(
|
||||
private static IDictionary<VolSurfaceExpiration, VolCurveMarketImpliedVolData> _fill_in_implied_vols(
|
||||
ThreadedBlackboard bb, int vs_id,
|
||||
VolSurfaceInput vs_inp,
|
||||
IDictionary<VolSurfaceExpiration, VolCurveAction> action_map,
|
||||
IDictionary<VolSurfaceExpiration, VolSurfaceExpirationAuxiliaryData> aux_data_map,
|
||||
@@ -140,15 +194,15 @@ namespace mbts.spark {
|
||||
applicable_exps = applicable_exps.Where(vs_exp => master_exps.Contains(vs_exp));
|
||||
|
||||
VolSurfaceEnums.MarketSide impliedvol_side =
|
||||
SingleVolSurfaceMarketImpliedVolSource._get_market_impliedvol_side(_bb, _vs_id);
|
||||
SingleVolSurfaceMarketImpliedVolSource._get_market_impliedvol_side(bb, vs_id);
|
||||
foreach (VolSurfaceExpiration vs_exp in applicable_exps) {
|
||||
VolSurfaceExpiration md_exp;
|
||||
VolCurveMarketImpliedVolData exp_impl_data =
|
||||
VolSurfaceCoreFunctions.compute_implied_vols(vs_inp, vs_exp, aux_data_map,
|
||||
arg_vs_exp => SingleVolSurfaceMarketImpliedVolSource.get_option_bbo(_bb, arg_vs_exp),
|
||||
arg_vs_exp => SingleVolSurfaceMarketImpliedVolSource.get_option_bbo(bb, arg_vs_exp),
|
||||
impliedvol_side,
|
||||
SingleVolSurfaceMarketImpliedVolSource._ignore_market_implied_vol_source_settings(
|
||||
_bb, _vs_id),
|
||||
bb, vs_id),
|
||||
out md_exp);
|
||||
rv[vs_exp] = exp_impl_data;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace mbts.analytics {
|
||||
output.Add(symbol, symbol_data);
|
||||
}
|
||||
IReadOnlyDictionary<string, TData> ro_output = output;
|
||||
bts.Log.Gen.info($"SymbolAggregationPublisher._on_timer publishing " +
|
||||
bts.Log.Gen.diag($"SymbolAggregationPublisher._on_timer publishing " +
|
||||
$"tag: {_out_tag} sz: {ro_output.Count}");
|
||||
_bb.post(_out_tag, ro_output);
|
||||
}
|
||||
|
||||
@@ -26,12 +26,13 @@ namespace mbts.spark {
|
||||
_refresh = new(_is_dirty.refresh);
|
||||
_committed_value.Changed += on_committed_changed;
|
||||
_candidate_value.Changed += on_candidate_changed;
|
||||
_is_dirty.Changed += (o, n) => {
|
||||
Log.assert(o != n);
|
||||
Log.Ui.info(
|
||||
$"VolSurface '{expiration}.{column}' is_dirty changed to {n}. " +
|
||||
$"commited: {committed_value}; candidate: {candidate_value}");
|
||||
};
|
||||
if (column.type.is_editable()) {
|
||||
_is_dirty.Changed += (o, n) => {
|
||||
Log.Ui.info(
|
||||
$"VolSurface '{expiration}.{column}' is_dirty changed to {n}. " +
|
||||
$"commited: {committed_value}; candidate: {candidate_value}");
|
||||
};
|
||||
}
|
||||
|
||||
void on_committed_changed(object? oldval, object? newval) =>
|
||||
_is_dirty.refresh();
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace mbts.spark.VolSurface {
|
||||
|
||||
class VolSurfaceGridVM : DisposableViewModelBase {
|
||||
readonly VolSurfaceVM _parent;
|
||||
readonly UserTuple _user;
|
||||
readonly ObservableCollection<VolSurfaceDisplayGridExpiration> _expirations = new();
|
||||
readonly DeferrableAction _invalidate_rows;
|
||||
readonly ColumnsModel _columns_model;
|
||||
@@ -41,10 +42,12 @@ namespace mbts.spark.VolSurface {
|
||||
VolSurfaceVM vm,
|
||||
VolSurfaceDisplayModel model,
|
||||
ISet<string> hidden_columns,
|
||||
ISet<VolSurfaceExpiration> hidden_expirations) {
|
||||
ISet<VolSurfaceExpiration> hidden_expirations,
|
||||
UserTuple user) {
|
||||
Log.notnull(hidden_columns);
|
||||
Log.notnull(hidden_expirations);
|
||||
_parent = vm;
|
||||
_user = user;
|
||||
this.model = model;
|
||||
_columns_model = new(create_exp_column_view());
|
||||
_hidden_columns = hidden_columns;
|
||||
@@ -83,7 +86,7 @@ namespace mbts.spark.VolSurface {
|
||||
_columns_model);
|
||||
|
||||
VolSurfaceRowVM row_factory(VolSurfaceDisplayGridExpiration exp) =>
|
||||
new(this, exp);
|
||||
new(this, exp, _user);
|
||||
|
||||
IDisposable connect_row(VolSurfaceRowVM row) {
|
||||
row.request_calculate += request_recalc;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#nullable enable
|
||||
namespace mbts.spark {
|
||||
using bts;
|
||||
using bts.collections;
|
||||
|
||||
using mbts.spark.VolSurface;
|
||||
@@ -9,6 +10,7 @@ namespace mbts.spark {
|
||||
using mbts.ui.utility;
|
||||
|
||||
using Spark.Core.Disposables;
|
||||
using Spark.Core.Reactive;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -22,6 +24,10 @@ namespace mbts.spark {
|
||||
readonly VolSurfaceGridVM _parent;
|
||||
readonly Property<VolSurfaceColumn?> _column;
|
||||
readonly Property<DIYGridSuperHeaderVM?> _super_header;
|
||||
readonly UserTuple _user;
|
||||
readonly Property<bool> _is_open;
|
||||
readonly DelegateProperty<string> _vs_manager;
|
||||
readonly List<IDisposable> _resources = new();
|
||||
|
||||
ICommand? _revert_cmd;
|
||||
ICommand? _shift_selection_cmd;
|
||||
@@ -34,21 +40,29 @@ namespace mbts.spark {
|
||||
ICommand? _copy_all_to_clipboard_cmd;
|
||||
ICommand? _smart_copy_rolls_rates_cmd;
|
||||
ICommand? _import_csv_cmd;
|
||||
ObservantCommand? _acquire_ownership_cmd;
|
||||
|
||||
public VolSurfaceRowContextMenuVM(VolSurfaceGridVM parent, VolSurfaceRowVM row) {
|
||||
public VolSurfaceRowContextMenuVM(VolSurfaceGridVM parent, VolSurfaceRowVM row, UserTuple user) {
|
||||
_parent = parent;
|
||||
_row = row;
|
||||
_user = user;
|
||||
_column = backing<VolSurfaceColumn?>(nameof(column));
|
||||
_super_header = backing<DIYGridSuperHeaderVM?>(nameof(super_header));
|
||||
_vs_manager = backing(
|
||||
nameof(vs_manager),
|
||||
() => _parent.model.get_active_settings()?.core_settings?.vs_manager ?? string.Empty);
|
||||
_is_open = backing(nameof(is_open), false);
|
||||
|
||||
_dispose = Disposable.Create(
|
||||
_resources.AddRange(
|
||||
_column.invalidate_others_on_change(nameof(column_name)),
|
||||
_super_header.invalidate_others_on_change(nameof(group_name)),
|
||||
_is_open.Subscribe(_ => _vs_manager.refresh()),
|
||||
_parent.visible_rows.ObserveSelf()
|
||||
.BufferLatest(TimeSpan.FromSeconds(1))
|
||||
.OnDispatcher()
|
||||
.Subscribe(_ => sync_symbols()));
|
||||
|
||||
_dispose = Disposable.Create(() => _resources.DisposeAll(true));
|
||||
void sync_symbols() {
|
||||
var visible_exps = _parent.visible_rows.Map(r => r.expiration.symbol);
|
||||
symbols.sync_with_models(
|
||||
@@ -164,6 +178,34 @@ namespace mbts.spark {
|
||||
_parent.model.csv_importing_enabled,
|
||||
null);
|
||||
|
||||
public ICommand acquire_ownership_cmd {
|
||||
get {
|
||||
if (_acquire_ownership_cmd is null) {
|
||||
_acquire_ownership_cmd = new(
|
||||
() => {
|
||||
var settings = _parent.model.get_active_settings();
|
||||
if (settings is null) {
|
||||
Log.Ui.error("Unable to acquire volsurface ownership: settings are null.");
|
||||
return;
|
||||
}
|
||||
settings.core_settings.vs_manager = _user.name;
|
||||
_parent.model.set_candidate_settings(settings);
|
||||
});
|
||||
_resources.Add(_vs_manager.observe_current(true)
|
||||
.Subscribe(SelectorObserver.builder(_acquire_ownership_cmd).wrap<string>(
|
||||
curr => curr != _user.name)));
|
||||
}
|
||||
return _acquire_ownership_cmd;
|
||||
}
|
||||
}
|
||||
|
||||
public bool is_open {
|
||||
get => _is_open.Value;
|
||||
set => _is_open.set(value);
|
||||
}
|
||||
|
||||
public string vs_manager => _vs_manager.Value;
|
||||
|
||||
VolSurfaceDisplayGridColumn _assert_model() =>
|
||||
column?.model ?? throw new InvalidOperationException();
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#nullable enable
|
||||
namespace mbts.spark.VolSurface {
|
||||
using bts;
|
||||
|
||||
using mbts.ui;
|
||||
using mbts.ui.controls;
|
||||
using mbts.ui.shell;
|
||||
@@ -16,14 +18,16 @@ namespace mbts.spark.VolSurface {
|
||||
readonly VolSurfaceGridVM _parent;
|
||||
readonly VolSurfaceDisplayGridExpiration _exp;
|
||||
readonly Dictionary<string, CellData> _cells = new();
|
||||
readonly UserTuple _user;
|
||||
readonly DeferrableAction _request_calculate;
|
||||
|
||||
VolSurfaceRowContextMenuVM? _context_menu;
|
||||
bool _is_selected;
|
||||
|
||||
public VolSurfaceRowVM(VolSurfaceGridVM parent, VolSurfaceDisplayGridExpiration exp) {
|
||||
public VolSurfaceRowVM(VolSurfaceGridVM parent, VolSurfaceDisplayGridExpiration exp, UserTuple user) {
|
||||
_parent = parent;
|
||||
_exp = exp;
|
||||
_user = user;
|
||||
_request_calculate = new(() => request_calculate?.Invoke());
|
||||
_dispose = Disposable.Create(() => {
|
||||
_cells.Values.DisposeAll();
|
||||
@@ -49,7 +53,7 @@ namespace mbts.spark.VolSurface {
|
||||
}
|
||||
|
||||
public VolSurfaceRowContextMenuVM context_menu =>
|
||||
_context_menu ??= new(_parent, this);
|
||||
_context_menu ??= new(_parent, this, _user);
|
||||
|
||||
public VolSurfaceCellVM get_cell(VolSurfaceDisplayGridColumn column) =>
|
||||
_cells.GetOrAdd(column.unique_col_name, _ => _create_cell(column)).vm;
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
#nullable enable
|
||||
|
||||
namespace mbts.spark {
|
||||
using bts.api.domain;
|
||||
|
||||
using mbts.analytics;
|
||||
using mbts.ui.shell;
|
||||
using mbts.ui.utility;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using VolCurveFitRegion = analytics.VolSurfaceEnums.VolCurveFitRegion;
|
||||
|
||||
public class VolSurfaceAutoFitSettingsVM : DisposableViewModelBase {
|
||||
readonly Property<VolCurveFitRegion> _fit_region;
|
||||
readonly Property<uint?> _period_secs;
|
||||
readonly Property<double?> _driver_points_moved;
|
||||
readonly Property<double?> _atm_points_moved;
|
||||
readonly Property<bool> _is_auto_fit_enabled;
|
||||
|
||||
public VolSurfaceAutoFitSettingsVM() {
|
||||
_fit_region = backing(nameof(fit_region), VolCurveFitRegion.None);
|
||||
_is_auto_fit_enabled = backing(
|
||||
nameof(is_auto_fit_enabled),
|
||||
_fit_region.observe_current(true),
|
||||
r => r != VolCurveFitRegion.None);
|
||||
_period_secs = backing<uint?>(nameof(period_secs), 10);
|
||||
_driver_points_moved = backing<double?>(nameof(driver_points_moved));
|
||||
_atm_points_moved = backing<double?>(nameof(atm_points_moved));
|
||||
_fit_region.Changed += (o, n) => RaisePropertyChanged(nameof(is_auto_fit_enabled));
|
||||
}
|
||||
|
||||
public IEnumerable<VolCurveFitRegion> fit_regions =>
|
||||
EnumHelper.get_values<VolCurveFitRegion>();
|
||||
|
||||
public VolCurveFitRegion fit_region {
|
||||
get => _fit_region.Value;
|
||||
set => _fit_region.set(value);
|
||||
}
|
||||
|
||||
public bool is_auto_fit_enabled => _is_auto_fit_enabled.Value;
|
||||
|
||||
public uint? period_secs {
|
||||
get => _period_secs.Value;
|
||||
set => _period_secs.set(value);
|
||||
}
|
||||
|
||||
public double? driver_points_moved {
|
||||
get => _driver_points_moved.Value;
|
||||
set => _driver_points_moved.set(value);
|
||||
}
|
||||
|
||||
public TickDisplaySettingsImmutable? driver_points_display =>
|
||||
user.settings.TickFactors.pennies.to_api_tick_display_settingsi();
|
||||
|
||||
public double? atm_points_moved {
|
||||
get => _atm_points_moved.Value;
|
||||
set => _atm_points_moved.set(value);
|
||||
}
|
||||
|
||||
public TickDisplaySettingsImmutable? atm_points_display =>
|
||||
user.settings.TickFactors.pennies.to_api_tick_display_settingsi();
|
||||
|
||||
public void load_from(VolSurfaceAutoFitSettings value) {
|
||||
fit_region = value?.auto_fit_region ?? VolCurveFitRegion.None;
|
||||
period_secs = value?.time_based_settings?.period_seconds;
|
||||
driver_points_moved = value?.driver_move_based_settings?.points_moved;
|
||||
atm_points_moved = value?.atm_implied_vol_based_settings?.points_moved;
|
||||
}
|
||||
|
||||
public void assign_to(VolSurfaceAutoFitSettings value) {
|
||||
if (value is null) {
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
value.auto_fit_region = fit_region;
|
||||
value.time_based_settings = new() {
|
||||
period_seconds = period_secs
|
||||
};
|
||||
value.driver_move_based_settings = new() {
|
||||
points_moved = driver_points_moved
|
||||
};
|
||||
value.atm_implied_vol_based_settings = new() {
|
||||
points_moved = atm_points_moved
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,7 @@ namespace mbts.spark {
|
||||
vol_model_cubic_spline_vm.load_from(settings.spline_model_settings);
|
||||
vol_model_dual_quadratic_vm.load_from(settings.dualquadratic_model_settings);
|
||||
vol_path_parabolic_vm.load_from(settings.core_settings.volpath_settings.parabolic_vol_path_settings);
|
||||
auto_fit_vm.load_from(settings.core_settings.market_fit_settings.vs_auto_fit_settings);
|
||||
|
||||
init_rotation_vms(call_rotations, _core_settings.call_rotation.strike_vol_movement_pairs);
|
||||
init_rotation_vms(put_rotations, _core_settings.put_rotation.strike_vol_movement_pairs);
|
||||
@@ -105,6 +106,7 @@ namespace mbts.spark {
|
||||
}).ToList();
|
||||
_core_settings.strangle.strike_vol_movement_pairs = strangles.SelectMany(r => new[] { Tuple.Create(r.target_put_strike, r.put_move), Tuple.Create(r.target_call_strike, r.call_move) }).ToList();
|
||||
_core_settings.atm_shift.atm_strike_vol_movement = atm_shifts.Count == 1 ? atm_shifts[0].move : 0;
|
||||
auto_fit_vm.assign_to(_core_settings.market_fit_settings.vs_auto_fit_settings);
|
||||
commit(_settings);
|
||||
}
|
||||
|
||||
@@ -233,23 +235,7 @@ namespace mbts.spark {
|
||||
}
|
||||
}
|
||||
|
||||
public bool enable_auto_fit {
|
||||
get => _core_settings.market_fit_settings.enable_auto_fit;
|
||||
set {
|
||||
using var _ = detect_property_change();
|
||||
_core_settings.market_fit_settings.enable_auto_fit = value;
|
||||
}
|
||||
}
|
||||
|
||||
public VolSurfaceEnums.VolCurveFitRegion auto_fit_region {
|
||||
get => _core_settings.market_fit_settings.auto_fit_region;
|
||||
set { _core_settings.market_fit_settings.auto_fit_region = value; }
|
||||
}
|
||||
|
||||
public double auto_fit_time_ms {
|
||||
get => _core_settings.market_fit_settings.auto_fit_time_ms;
|
||||
set { _core_settings.market_fit_settings.auto_fit_time_ms = value; }
|
||||
}
|
||||
public VolSurfaceAutoFitSettingsVM auto_fit_vm { get; } = new();
|
||||
|
||||
public bool auto_decay_vol_time {
|
||||
get => _core_settings.time_settings.time_mode == VolSurfaceEnums.VolSurfaceTimeMode.AutoDecay;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#nullable enable
|
||||
namespace mbts.spark {
|
||||
using bts;
|
||||
using bts.api;
|
||||
using bts.collections;
|
||||
|
||||
@@ -27,6 +28,7 @@ namespace mbts.spark {
|
||||
readonly IBus _bus;
|
||||
readonly string _request_id = Guid.NewGuid().ToString();
|
||||
readonly VolSurfaceDisplayModel _model;
|
||||
readonly UserTuple _user;
|
||||
readonly IRaiseCanExecuteChangedCommand _revert_cmd;
|
||||
readonly IRaiseCanExecuteChangedCommand _commit_cmd;
|
||||
readonly IDialogCommand _main_settings_cmd;
|
||||
@@ -38,10 +40,16 @@ namespace mbts.spark {
|
||||
bool _ignore_implied_vol_settings;
|
||||
|
||||
public VolSurfaceVM(
|
||||
VolSurfaceDisplayModel model, int id, IBus bus, VolSurfaceWindowSettings startup_data) {
|
||||
VolSurfaceDisplayModel model,
|
||||
int id,
|
||||
IBus bus,
|
||||
VolSurfaceWindowSettings startup_data,
|
||||
UserTuple user
|
||||
) {
|
||||
_model = model;
|
||||
_vs_id = id;
|
||||
_bus = bus;
|
||||
_user = user;
|
||||
macro_actions = new VolSurfaceMacroActionsVM(_model);
|
||||
globals = new VolSurfaceGlobalParameterVM(_model);
|
||||
|
||||
@@ -49,7 +57,7 @@ namespace mbts.spark {
|
||||
_grid_settings = startup_data.macro_grid_settings ?? new VolSurfaceMacroGridSettings();
|
||||
var hidden_exps_set = startup_data.hidden_exps.empty_if_null().ToHashSet();
|
||||
grid = new VolSurfaceGridVM(
|
||||
this, _model, _grid_settings.hidden_cols(), hidden_exps_set);
|
||||
this, _model, _grid_settings.hidden_cols(), hidden_exps_set, _user);
|
||||
grid.on_selection_changed += _on_grid_selection_changed;
|
||||
_model.publish_grid_settings(_grid_settings);
|
||||
|
||||
|
||||
@@ -4,13 +4,11 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace mbts.analytics
|
||||
{
|
||||
namespace mbts.analytics {
|
||||
/// These are the VolSurface settings that are common
|
||||
/// to any Vol Model
|
||||
[ProtoBuf.ProtoContract(Name = "VolSurfaceCoreSettings")]
|
||||
public class VolSurfaceCoreSettings
|
||||
{
|
||||
public class VolSurfaceCoreSettings {
|
||||
[ProtoBuf.ProtoMember(1)]
|
||||
public string vol_surface_name;
|
||||
[ProtoBuf.ProtoMember(2)]
|
||||
@@ -87,5 +85,7 @@ namespace mbts.analytics
|
||||
get => _time_settings ??= new();
|
||||
set => _time_settings = value;
|
||||
}
|
||||
[ProtoBuf.ProtoMember(240)]
|
||||
public string vs_manager { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -75,6 +75,7 @@ namespace mbts.analytics {
|
||||
if (core_settings.market_fit_settings == null) {
|
||||
core_settings.market_fit_settings = new VolSurfaceMarketFitSettings();
|
||||
}
|
||||
core_settings.market_fit_settings.vs_auto_fit_settings ??= new();
|
||||
if (core_settings.time_settings == null) {
|
||||
core_settings.time_settings = new VolSurfaceTimeSettings();
|
||||
}
|
||||
|
||||
@@ -141,6 +141,7 @@ namespace mbts.analytics
|
||||
|
||||
public enum VolCurveFitRegion
|
||||
{
|
||||
None,
|
||||
ATM,
|
||||
All
|
||||
}
|
||||
@@ -230,4 +231,4 @@ namespace mbts.analytics
|
||||
USE_CALENDAR_FOR_BUSINESS
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace mbts.analytics
|
||||
{
|
||||
namespace mbts.analytics {
|
||||
[ProtoBuf.ProtoContract(Name = "VolSurfaceMarketFitSettings")]
|
||||
public class VolSurfaceMarketFitSettings
|
||||
{
|
||||
public class VolSurfaceMarketFitSettings {
|
||||
/// use one sided market or not
|
||||
[ProtoBuf.ProtoMember(10)]
|
||||
public bool ignore_one_sided_markets;
|
||||
@@ -22,19 +20,44 @@ namespace mbts.analytics
|
||||
public double graph_update_period_ms = 2500;
|
||||
/// If this is set to true a regression curve is drawn
|
||||
/// and the vol model adheres to that
|
||||
[ProtoBuf.ProtoMember(50)]
|
||||
[ProtoBuf.ProtoMember(50)]
|
||||
public bool use_weighted_regression_fit = false;
|
||||
[ProtoBuf.ProtoMember(55)]
|
||||
public uint regression_order = 4;
|
||||
/// The system auto fits and saves vols if this is
|
||||
/// set to true
|
||||
[ProtoBuf.ProtoMember(60)]
|
||||
public bool enable_auto_fit = false;
|
||||
/// If enable_auto_fit = true, this governs
|
||||
/// how often the system auto-fits
|
||||
[ProtoBuf.ProtoMember(70)]
|
||||
public double auto_fit_time_ms = 30000;
|
||||
[ProtoBuf.ProtoMember(80)]
|
||||
public VolSurfaceEnums.VolCurveFitRegion auto_fit_region = VolSurfaceEnums.VolCurveFitRegion.ATM;
|
||||
|
||||
[ProtoBuf.ProtoMember(90)]
|
||||
public VolSurfaceAutoFitSettings vs_auto_fit_settings { get; set; }
|
||||
}
|
||||
|
||||
[ProtoBuf.ProtoContract(Name = "VolSurfaceAutoFitSettings")]
|
||||
public class VolSurfaceAutoFitSettings {
|
||||
// each of these settings can be enabled independently. if they are enabled
|
||||
// then any of them being true will result in an autmatic fit
|
||||
[ProtoBuf.ProtoContract(Name = "TimeBasedSettings")]
|
||||
public class TimeBasedSettings {
|
||||
[ProtoBuf.ProtoMember(10)]
|
||||
public uint? period_seconds { get; set; }
|
||||
}
|
||||
|
||||
[ProtoBuf.ProtoContract(Name = "DriverMoveBasedSettings")]
|
||||
public class DriverMoveBasedSettings {
|
||||
[ProtoBuf.ProtoMember(10)]
|
||||
public double? points_moved { get; set; }
|
||||
}
|
||||
|
||||
[ProtoBuf.ProtoContract(Name = "ATMImpliedVolBasedSettings")]
|
||||
public class ATMImpliedVolBasedSettings {
|
||||
[ProtoBuf.ProtoMember(20)]
|
||||
public double? points_moved { get; set; }
|
||||
// we can do price terms moved as well
|
||||
}
|
||||
[ProtoBuf.ProtoMember(5)]
|
||||
public VolSurfaceEnums.VolCurveFitRegion auto_fit_region;
|
||||
[ProtoBuf.ProtoMember(10)]
|
||||
public TimeBasedSettings time_based_settings = null;
|
||||
[ProtoBuf.ProtoMember(20)]
|
||||
public DriverMoveBasedSettings driver_move_based_settings = null;
|
||||
[ProtoBuf.ProtoMember(30)]
|
||||
public ATMImpliedVolBasedSettings atm_implied_vol_based_settings = null;
|
||||
}
|
||||
}
|
||||
@@ -475,6 +475,7 @@ namespace mbts.analytics {
|
||||
public static ResultMessage save_volsurface(
|
||||
VolSurfaceInput vs_input, AnalyticsService service, string user = "") {
|
||||
vs_input.saver_login = user;
|
||||
vs_input.surface_settings.core_settings.vs_manager = user;
|
||||
// convert to VolSurfaceEntry
|
||||
var to_save = new VolSurfaceEntry();
|
||||
var serialized_vs = ProtobufSerializationHelper.serialize(vs_input);
|
||||
@@ -595,7 +596,7 @@ namespace mbts.analytics {
|
||||
_greek_getter(g)(t, is_call);
|
||||
|
||||
public static IDictionary<double, IEnumerable<Theos>> hash_strikes(IEnumerable<Theos> theos) =>
|
||||
theos.Map(t => t.strike);
|
||||
theos.Map(t => t.strike);
|
||||
|
||||
static Func<Theos, bool, double> _greek_getter(VolSurfaceGreeks g) =>
|
||||
g switch {
|
||||
|
||||
@@ -88,8 +88,8 @@ namespace mbts.analytics {
|
||||
|
||||
public void set_driver_price(
|
||||
IDictionary<VolSurfaceExpiration, double> driver_price_map) {
|
||||
Log.Gen.info($"VolSurfaceInterpGreeksProducer.set_driver_price " +
|
||||
$"vs_id: {_vs_id} exp_count: {driver_price_map.Count}");
|
||||
// Log.Gen.info($"VolSurfaceInterpGreeksProducer.set_driver_price " +
|
||||
// $"vs_id: {_vs_id} exp_count: {driver_price_map.Count}");
|
||||
_driver_price_map = new Dictionary<VolSurfaceExpiration, double>(driver_price_map);
|
||||
_compute_and_fire(InputType.DriverPrice);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace bts {
|
||||
}
|
||||
|
||||
private void _on_server_sec_map(IReadOnlyDictionary<uint, SecurityMD> sec_map) {
|
||||
_log_options(sec_map);
|
||||
//_log_options(sec_map);
|
||||
bts.Log.Gen.info(String.Format("MergedMDDaemon._on_server_sec_map sz: {0}", sec_map.Count()));
|
||||
_server_sec_map = new Dictionary<uint, SecurityMD>(sec_map);
|
||||
_merge_and_post();
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace mbts.spark {
|
||||
r => new ReportImmutable?(r),
|
||||
r => r?.Id ?? throw new ArgumentNullException(nameof(r)));
|
||||
_window_factories = new() {
|
||||
new VolSurfaceWindowFactory(this, bus),
|
||||
new VolSurfaceWindowFactory(this, bus, user.Value),
|
||||
new AnalyticsExpirationParametersWindowFactory(this, bus),
|
||||
new SlideReportWindowFactory(this, bus, reports_demuxer.subscribe),
|
||||
new ComboReportWindowFactory(this, bus, reports_demuxer.subscribe),
|
||||
|
||||
@@ -793,70 +793,106 @@
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="4"
|
||||
DataContext="{Binding auto_fit_vm}"
|
||||
Header="Auto Fit"
|
||||
Margin="0,5,0,0"
|
||||
Padding="5"
|
||||
IsEnabled="False">
|
||||
Padding="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox
|
||||
Grid.ColumnSpan="2" Content="Enabled" IsChecked="{Binding enable_auto_fit}" />
|
||||
|
||||
<TextBlock Grid.Row="1" Text="Region" Margin="16,5,0,0">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger
|
||||
Binding="{Binding enable_auto_fit}"
|
||||
Value="False">
|
||||
<Setter
|
||||
Property="Foreground"
|
||||
Value="Gray" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
|
||||
<TextBlock Grid.Row="0" Text="Fit Region" />
|
||||
<ComboBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="8,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
ItemsSource="{Binding fit_regions}"
|
||||
SelectedItem="{Binding fit_region}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={x:Static shell:VolSurfaceSettingsEditor.AutoFitRegionDisplayTextConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Margin="0,5,0,0"
|
||||
Text="Every" />
|
||||
<c:TickUpDownNullableUInt32
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="12,0,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
ItemsSource="{Binding auto_fit_region_choices}"
|
||||
SelectedValue="{Binding auto_fit_region}"
|
||||
IsEnabled="{Binding enable_auto_fit}" />
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Minimum="30"
|
||||
Margin="8,0,0,0"
|
||||
Width="60"
|
||||
Value="{Binding period_secs}"
|
||||
IsEnabled="{Binding is_auto_fit_enabled}" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="3,5,0,0"
|
||||
Text="secs" />
|
||||
|
||||
<TextBlock Grid.Row="2" Text="Fit Time" Margin="16,5,0,0">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding enable_auto_fit}" Value="False">
|
||||
<Setter Property="Foreground" Value="Gray" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
|
||||
<c:TextBoxDouble
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Margin="0,5,0,0"
|
||||
Text="When Driver moves" />
|
||||
<c:TickUpDownNullableDouble
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
c:TextBoxEx.Suffix="ms"
|
||||
ToolTipService.ShowOnDisabled="True"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Margin="8,0,0,0"
|
||||
Width="60"
|
||||
Margin="12,5,0,0"
|
||||
IsEnabled="{Binding enable_auto_fit}"
|
||||
Value="{Binding auto_fit_time_ms}"
|
||||
Template="{StaticResource SuffixTemplate}" />
|
||||
Value="{Binding driver_points_moved}"
|
||||
Increment="0.01"
|
||||
TickDisplaySettings="{Binding driver_points_display}"
|
||||
IsEnabled="False"
|
||||
ToolTip="Not yet supported (coming soon)" />
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="3,5,0,0"
|
||||
Text="%" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Margin="0,5,0,0"
|
||||
Text="When ATM moves" />
|
||||
<c:TickUpDownNullableDouble
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
ToolTipService.ShowOnDisabled="True"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="8,0,0,0"
|
||||
Width="60"
|
||||
Value="{Binding atm_points_moved}"
|
||||
Increment="0.01"
|
||||
TickDisplaySettings="{Binding atm_points_display}"
|
||||
IsEnabled="False"
|
||||
ToolTip="Not yet supported (coming soon)" />
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="3,5,0,0"
|
||||
Text="%" />
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
#nullable enable
|
||||
namespace mbts.ui.shell {
|
||||
using mbts.analytics;
|
||||
using mbts.ui.converters;
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
partial class VolSurfaceSettingsEditor : Window {
|
||||
public VolSurfaceSettingsEditor() =>
|
||||
InitializeComponent();
|
||||
|
||||
public static IValueConverter AutoFitRegionDisplayTextConverter =>
|
||||
ValueConverter.create<VolSurfaceEnums.VolCurveFitRegion, string>(fr =>
|
||||
fr switch {
|
||||
VolSurfaceEnums.VolCurveFitRegion.None => "Disabled",
|
||||
_ => fr.ToString()
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -262,7 +262,7 @@
|
||||
IsDragAdornerEnabled="False"
|
||||
ContextMenuOpening="_on_context_menu_opening">
|
||||
<c:DIYGrid.ContextMenu>
|
||||
<ContextMenu>
|
||||
<ContextMenu IsOpen="{Binding is_open}">
|
||||
<MenuItem
|
||||
Header="Populate Empty Expirations"
|
||||
Command="{Binding populate_empty_exps_cmd}" />
|
||||
@@ -413,6 +413,11 @@
|
||||
</MenuItem.ItemContainerStyle>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Import CSV..." Command="{Binding import_csv_cmd}" />
|
||||
<MenuItem Command="{Binding acquire_ownership_cmd}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding vs_manager, StringFormat='Acquire ownership from \'{0}\''}" />
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</c:DIYGrid.ContextMenu>
|
||||
<c:DIYGrid.RowStyle>
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
}
|
||||
var mouse_pos = Mouse.GetPosition(this);
|
||||
if (!this.ChildAtPoint<VolSurfaceRowView>(mouse_pos, out var row)) {
|
||||
cm.IsOpen = false;
|
||||
cm.SetCurrentValue(ContextMenu.IsOpenProperty, false);
|
||||
return;
|
||||
}
|
||||
var cgs = g.GetColumnGeometry().ToList();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace mbts.spark {
|
||||
using bts;
|
||||
using bts.api;
|
||||
using bts.spark;
|
||||
|
||||
@@ -14,14 +15,20 @@
|
||||
public const string WINDOW_TYPE = "VolSurface";
|
||||
|
||||
readonly VolSurfaceWindowSettings _startup_data;
|
||||
readonly UserTuple _user;
|
||||
|
||||
VolSurfaceVM _vm;
|
||||
VolSurfaceView _view;
|
||||
|
||||
public VolSurfaceWindow(
|
||||
VolSurfaceWindowFactory factory, IBus bus, string vs_name, VolSurfaceWindowSettings startup_data) :
|
||||
base(vs_name, bus, factory, Icons.vol_surface) {
|
||||
VolSurfaceWindowFactory factory,
|
||||
IBus bus,
|
||||
string vs_name,
|
||||
VolSurfaceWindowSettings startup_data,
|
||||
UserTuple user
|
||||
) : base(vs_name, bus, factory, Icons.vol_surface) {
|
||||
_startup_data = startup_data ?? throw new ArgumentNullException(nameof(startup_data));
|
||||
_user = user;
|
||||
this.vs_name = vs_name;
|
||||
_dispose = Disposable.Create(() => Disposable.dispose(ref _vm));
|
||||
}
|
||||
@@ -37,7 +44,7 @@
|
||||
public override UIElement Content => _view;
|
||||
|
||||
public void thread_init() {
|
||||
_vm = new VolSurfaceVM(new VolSurfaceDisplayModel(vs_id, _bus, true), vs_id, _bus, _startup_data);
|
||||
_vm = new VolSurfaceVM(new (vs_id, _bus, true), vs_id, _bus, _startup_data, _user);
|
||||
_view = new VolSurfaceView {
|
||||
DataContext = _vm
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace mbts.spark {
|
||||
using bts;
|
||||
using bts.api;
|
||||
using bts.shell;
|
||||
|
||||
@@ -10,10 +11,12 @@ namespace mbts.spark {
|
||||
|
||||
class VolSurfaceWindowFactory : ShellWindowFactory<VolSurfaceWindowSettings> {
|
||||
readonly IBus _bus;
|
||||
readonly UserTuple _user;
|
||||
|
||||
public VolSurfaceWindowFactory(IShellModule module, IBus bus)
|
||||
public VolSurfaceWindowFactory(IShellModule module, IBus bus, UserTuple user)
|
||||
: base(module, "VolSurface") {
|
||||
_bus = bus;
|
||||
_user = user;
|
||||
_dispose = bus.subscribe(SparkTags.ShowVolSurface).OnDispatcher().Subscribe(
|
||||
async state => _bus.post(SparkTags.ShowWindow, await _create(state)));
|
||||
}
|
||||
@@ -22,7 +25,7 @@ namespace mbts.spark {
|
||||
_create(state);
|
||||
|
||||
async Task<IShellWindow> _create(VolSurfaceWindowSettings state) =>
|
||||
new VolSurfaceWindow(this, _bus, await _lookup_vs_name(state.id), state);
|
||||
new VolSurfaceWindow(this, _bus, await _lookup_vs_name(state.id), state, _user);
|
||||
|
||||
async Task<string> _lookup_vs_name(int vs_id) {
|
||||
var (vol_surfaces, success) = await _bus.subscribe(SparkTags.VolSurfaceListTag).FirstAsyncTask(TimeSpan.FromSeconds(2));
|
||||
|
||||
@@ -58,5 +58,10 @@ namespace BCG {
|
||||
public static UInt32 get_ask_size(BBOPacket md) {
|
||||
return md != null ? md._ask_size : (UInt32)0;
|
||||
}
|
||||
public static Tuple<double, UInt32> get_md(BBOPacket md, bool is_bid) {
|
||||
double price = is_bid ? BBOPacket.get_bid_price(md) : BBOPacket.get_ask_price(md);
|
||||
UInt32 sz = is_bid ? BBOPacket.get_bid_size(md) : BBOPacket.get_ask_size(md);
|
||||
return Tuple.Create(price, sz);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,6 +123,15 @@ namespace BCG {
|
||||
|
||||
#endregion
|
||||
|
||||
#region Orders
|
||||
[System.ComponentModel.Category("Orders / Algo")]
|
||||
[System.ComponentModel.DisplayName("Default Account")]
|
||||
public string Account { get; set; }
|
||||
[System.ComponentModel.Category("Orders / Algo")]
|
||||
[System.ComponentModel.DisplayName("Default Qty")]
|
||||
public Nullable<double> DefaultQty { get; set; }
|
||||
#endregion
|
||||
|
||||
public NMSheetSettingLayout() {
|
||||
show_settings_header = false;
|
||||
show_exp_navigator = false;
|
||||
|
||||
@@ -18,6 +18,7 @@ using mbts.spark.filters;
|
||||
using System.Collections;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading;
|
||||
using bts.api.orderman;
|
||||
|
||||
namespace BCG {
|
||||
public partial class NMSheetControl : UserControl {
|
||||
@@ -555,6 +556,17 @@ namespace BCG {
|
||||
}
|
||||
private void _launch_order_entry_window(NMSheetTheoGrid.GridCell cell,
|
||||
OrderEntryWindow window_type) {
|
||||
Func<string, bts.AccountTuple> get_account = (string default_acc) => {
|
||||
string account = _settings.setting_layout.Account;
|
||||
if (String.IsNullOrEmpty(account)) {
|
||||
account = default_acc;
|
||||
}
|
||||
Nullable<uint> id = _get_account_id(account);
|
||||
if (!id.HasValue) {
|
||||
id = 0;
|
||||
}
|
||||
return new bts.AccountTuple(id.Value, account);
|
||||
};
|
||||
uint key;
|
||||
var found = _sheet_data.get_security_key(cell.expiration,
|
||||
cell.strike, cell.call_selected, out key);
|
||||
@@ -566,7 +578,20 @@ namespace BCG {
|
||||
if (sc_data.sec_md_map.TryGetValue(key, out var smd)) {
|
||||
switch (window_type) {
|
||||
case OrderEntryWindow.Ticket:
|
||||
_threaded_bb.post(SparkTags.ShowOrderTicketFromSecurityTag, smd);
|
||||
bool is_bid = NMSheetSettingColumnOrganization.get_column_info(cell.col).is_bid;
|
||||
bts.AccountTuple acc_tup = get_account("SMALL");
|
||||
Nullable<double> qty = _settings.setting_layout.DefaultQty;
|
||||
OrderDefinition od = new OrderDefinition() {
|
||||
SecurityKey = smd.id,
|
||||
TimeInForce = TimeInForce.Gtc,
|
||||
Account = acc_tup.name,
|
||||
AccountId = acc_tup.id
|
||||
};
|
||||
BBOPacket bbo = _sheet_data.get_bbo(smd.id);
|
||||
Tuple<double, UInt32> pr_sz = BBOPacket.get_md(bbo, is_bid);
|
||||
UInt32 effective_qty = qty.HasValue ? Convert.ToUInt32(Math.Abs(qty.Value)) : pr_sz.Item2;
|
||||
_threaded_bb.post(SparkTags.ShowOrderTicketTag,
|
||||
(new OrderDefinitionImmutable(od), pr_sz.Item1, effective_qty));
|
||||
break;
|
||||
case OrderEntryWindow.Ladder:
|
||||
_threaded_bb.post(SparkTags.ShowLadderTag, smd);
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace mbts.analytics {
|
||||
timer.stop();
|
||||
Log.Ui.info($"PNLReportCalculator n_pos: {output.position_data.Count()} " +
|
||||
$"n_day_trades: {output.day_trades.Count()} time(msecs): {timer.lastIntervalTime}");
|
||||
_log_before_posting(output.position_data);
|
||||
//_log_before_posting(output.position_data);
|
||||
_bus.post(SparkTags.ReportBlackboardTags.PNL.PNLData, output);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -115,21 +115,21 @@ namespace mbts.analytics {
|
||||
}
|
||||
|
||||
private void _handle_nonvol_data(VolSurfaceNonVolData vs_nonvol_data) {
|
||||
bts.Log.Gen.info(String.Format("SlideReportCalculator._handle_nonvol_data report {0}",
|
||||
_report.ReportName));
|
||||
// bts.Log.Gen.info(String.Format("SlideReportCalculator._handle_nonvol_data report {0}",
|
||||
// _report.ReportName));
|
||||
_vs_nonvol_data = vs_nonvol_data;
|
||||
}
|
||||
|
||||
private void _handle_future_prices(
|
||||
IReadOnlyDictionary<SecurityExpiration, FutureTheoStructure> future_prices_map) {
|
||||
bts.Log.Gen.info(String.Format("SlideReportCalculator._handle_future_prices report {0}",
|
||||
_report.ReportName));
|
||||
// bts.Log.Gen.Diag(String.Format("SlideReportCalculator._handle_future_prices report {0}",
|
||||
// _report.ReportName));
|
||||
_future_prices_map = future_prices_map.ToDictionary(kv => kv.Key, kv => kv.Value.theo);
|
||||
}
|
||||
|
||||
private void _handle_trades(IEnumerable<ITradeLogRow> trades) {
|
||||
bts.Log.Gen.info(String.Format("SlideReportCalculator._handle_trades report {0}",
|
||||
_report.ReportName));
|
||||
// bts.Log.Gen.info(String.Format("SlideReportCalculator._handle_trades report {0}",
|
||||
// _report.ReportName));
|
||||
_all_trades = trades.Where(t => t.is_active);
|
||||
if (_report.CalcMode == Report.Types.ReportCalculationMode.PositionOrTheoChange) {
|
||||
_compute_dirty = true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<Authors>Blue Trading Systems</Authors>
|
||||
<Company>Blue Trading Systems</Company>
|
||||
@@ -34,7 +34,6 @@
|
||||
<PackageReference Include="System.Reactive.Interfaces" Version="5.0.0" />
|
||||
<PackageReference Include="System.Reactive.Linq" Version="5.0.0" />
|
||||
<PackageReference Include="System.Reactive.PlatformServices" Version="5.0.0" />
|
||||
<PackageReference Include="System.Runtime.Experimental" Version="6.0.2" />
|
||||
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||
<ProjectReference Include="../spark_api/spark_api.csproj" />
|
||||
<ProjectReference Include="../spark_core/spark_core.csproj" />
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace bts.core {
|
||||
// TODO: for debugging purposes, remove it later
|
||||
if (tag != mbts.spark.SparkTags.SparkTimer) {
|
||||
var tid = System.Threading.Thread.CurrentThread.ManagedThreadId;
|
||||
bts.Log.Ui.diag($"SimpleBus.post tag:{tag} tid:{tid}");
|
||||
//bts.Log.Ui.diag($"SimpleBus.post tag:{tag} tid:{tid}");
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -45,7 +45,7 @@ namespace bts.core {
|
||||
|
||||
public IObservable<T> subscribe<T>(ITag<T> tag) {
|
||||
var tid = System.Threading.Thread.CurrentThread.ManagedThreadId;
|
||||
bts.Log.Ui.info($"SimpleBus.post tag:{tag} tid:{tid}");
|
||||
//bts.Log.Ui.info($"SimpleBus.subscribe tag:{tag} tid:{tid}");
|
||||
return subject<T>(tag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace mbts.spark {
|
||||
public static ITag<int> CreateHeatmapTag { get; } = _mk_tag<int>();
|
||||
|
||||
// Publisher: VolSurfaceBlackboardManager
|
||||
// User: VoLSurfaceModule
|
||||
// User: VolSurfaceModule
|
||||
public static ITag<IDictionary<int, string>> VolSurfaceListTag { get; } =
|
||||
_mk_tag<IDictionary<int, string>>();
|
||||
|
||||
@@ -202,11 +202,17 @@ namespace mbts.spark {
|
||||
public static ITag<VolSurfaceCalculationRequest> VolSurfaceCalculationRequestTag(int vs_id) =>
|
||||
_mk_tag<VolSurfaceCalculationRequest, int>(vs_id);
|
||||
|
||||
public static ITag<VolSurfaceCalculationRequest> VolSurfaceAutoCalculationRequestTag(int vs_id) =>
|
||||
_mk_tag<VolSurfaceCalculationRequest, int>(vs_id);
|
||||
|
||||
// Publisher : SingleVolSurfaceRequestCalculator
|
||||
// Data : VolSurfaceCalculationResponse
|
||||
public static ITag<VolSurfaceCalculationResponse> VolSurfaceCalculationResponseTag(int vs_id) =>
|
||||
_mk_tag<VolSurfaceCalculationResponse, int>(vs_id);
|
||||
|
||||
public static ITag<VolSurfaceCalculationResponse> VolSurfaceAutoCalculationResponseTag(int vs_id) =>
|
||||
_mk_tag<VolSurfaceCalculationResponse, int>(vs_id);
|
||||
|
||||
// When the UI intends to save the vol surface (data or input)
|
||||
// Publisher: VolSurfaceDisplayModel
|
||||
public static ITag<VolSurfaceInput> VolSurfaceCommitTag(int vs_id) =>
|
||||
|
||||
@@ -485,6 +485,10 @@
|
||||
Width="{TemplateBinding Width}"
|
||||
MinWidth="{TemplateBinding MinWidth}"
|
||||
MaxWidth="{TemplateBinding MaxWidth}"
|
||||
TickUpCommand="{TemplateBinding TickUpCommand}"
|
||||
TickUpCommandParameter="{TemplateBinding TickUpCommandParameter}"
|
||||
TickDownCommand="{TemplateBinding TickDownCommand}"
|
||||
TickDownCommandParameter="{TemplateBinding TickDownCommandParameter}"
|
||||
>
|
||||
<TextBox
|
||||
Name="PART_TextBox"
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace mbts.ui.controls {
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Numerics;
|
||||
|
||||
static class TickUpDownHelper {
|
||||
public const string
|
||||
@@ -13,7 +14,7 @@ namespace mbts.ui.controls {
|
||||
|
||||
public static string? format<T>(
|
||||
T? new_value, string curr_text, TickDisplaySettingsImmutable? settings = null)
|
||||
where T : struct, IFloatingPoint<T> {
|
||||
where T : struct, IFloatingPointIeee754<T> {
|
||||
if (T.TryParse(curr_text, null, out var from_text)) {
|
||||
if (!from_text.Equals(new_value)) {
|
||||
return format(new_value, settings);
|
||||
@@ -25,7 +26,7 @@ namespace mbts.ui.controls {
|
||||
}
|
||||
|
||||
public static string format<T>(T? value, TickDisplaySettingsImmutable? settings = null)
|
||||
where T : struct, IFloatingPoint<T> {
|
||||
where T : struct, IFloatingPointIeee754<T> {
|
||||
if (!value.HasValue) {
|
||||
return string.Empty;
|
||||
}
|
||||
@@ -39,7 +40,7 @@ namespace mbts.ui.controls {
|
||||
string? text,
|
||||
[NotNullWhen(true)] out T? result,
|
||||
TickDisplaySettingsImmutable? settings = null
|
||||
) where T : IFloatingPoint<T> {
|
||||
) where T : IFloatingPointIeee754<T> {
|
||||
if (text is null) {
|
||||
result = default;
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#nullable enable
|
||||
namespace mbts.ui.controls {
|
||||
using bts.api.domain;
|
||||
using bts.utils;
|
||||
|
||||
using mbts.ui.extensions;
|
||||
using mbts.ui.utilities;
|
||||
@@ -11,6 +12,7 @@ namespace mbts.ui.controls {
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
@@ -227,6 +229,12 @@ namespace mbts.ui.controls {
|
||||
get => _explicit_props.value;
|
||||
set => _explicit_props.value = value;
|
||||
}
|
||||
|
||||
bool _has_valid_bounds =>
|
||||
Minimum < Maximum;
|
||||
|
||||
T _default_value =>
|
||||
_has_valid_bounds ? T.Zero.within_range(Minimum, Maximum) : T.Zero;
|
||||
|
||||
public override void OnApplyTemplate() {
|
||||
Disposable.dispose(ref _text_hooks);
|
||||
@@ -271,7 +279,7 @@ namespace mbts.ui.controls {
|
||||
var v = _value_d;
|
||||
if (!v.HasValue) {
|
||||
if (AllowNullTick) {
|
||||
SetCurrentValue(ValueProperty, T.Zero);
|
||||
SetCurrentValue(ValueProperty, _default_value);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -279,6 +287,10 @@ namespace mbts.ui.controls {
|
||||
TickUpDownHelper.nullable_tick_up(v, _increment_d, out var result_d, _maximum_d) :
|
||||
TickUpDownHelper.nullable_tick_down(v, _increment_d, out result_d, _minimum_d)) {
|
||||
var result = NumericCastOutConverter<T>.convert(result_d.assert_value());
|
||||
// Enforce min/max bounds (if bounds are valid)
|
||||
if (_has_valid_bounds) {
|
||||
result = result.within_range(Minimum, Maximum);
|
||||
}
|
||||
SetCurrentValue(ValueProperty, result);
|
||||
CoerceValue(ValueProperty);
|
||||
}
|
||||
|
||||
@@ -3,13 +3,14 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace mbts.ui.converters {
|
||||
class DictionaryLookupConverter : IMultiValueConverter {
|
||||
[ThreadStatic]
|
||||
Dictionary<Type, Lookup> _type_impls_backing;
|
||||
Dictionary<Type, Lookup> _type_impls => _type_impls_backing ?? (_type_impls_backing = new Dictionary<Type, Lookup>());
|
||||
Dictionary<Type, Lookup> _type_impls =>
|
||||
Interlocked.CompareExchange(ref _type_impls_backing, new(), null);
|
||||
|
||||
delegate bool Lookup(object source, object key, out object result);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
using Spark.Core.Disposables;
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Reactive.Linq;
|
||||
using System.Windows.Input;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using Spark.Core.Disposables;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Reactive.Linq;
|
||||
|
||||
namespace mbts.ui {
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace mbts {
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
|
||||
public static class TickExtensions {
|
||||
static string _nan_text => TickDisplaySettings.Default.nan_text;
|
||||
@@ -109,20 +110,20 @@ namespace mbts {
|
||||
public static string format_without_decimal_part(this TickFactors tick, double value) =>
|
||||
format(tick, value, double.NaN, false, _nan_text, true);
|
||||
|
||||
public static string format<T>(this TickFactors tick, T value) where T : IFloatingPoint<T> =>
|
||||
public static string format<T>(this TickFactors tick, T value) where T : IFloatingPointIeee754<T> =>
|
||||
format(tick, value, T.NaN, false, _nan_text);
|
||||
|
||||
public static string format<T>(this TickFactors tick, T value, bool show_commas)
|
||||
where T : IFloatingPoint<T> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
format(tick, value, T.NaN, show_commas, _nan_text);
|
||||
|
||||
public static string format<T>(this TickDisplaySettings settings, T value)
|
||||
where T : IFloatingPoint<T> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
format(settings.tick_factors, value, settings);
|
||||
|
||||
public static string format<T>(
|
||||
this bts.api.domain.TickDisplaySettingsImmutable settings, T value)
|
||||
where T : IFloatingPoint<T> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
settings.to_tick_display_settings().format(value);
|
||||
|
||||
public static string format<T>(this TickFactors tick, T value, TickDisplaySettings settings)
|
||||
@@ -149,7 +150,7 @@ namespace mbts {
|
||||
bool show_commas,
|
||||
string nan_text,
|
||||
bool show_decimal_part = true)
|
||||
where T : IFloatingPoint<T> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
tick.format(
|
||||
value,
|
||||
TickDisplaySettings.Default.with(
|
||||
@@ -196,7 +197,7 @@ namespace mbts {
|
||||
parse(display_settings.tick_factors, text, display_settings);
|
||||
|
||||
public static T parse<T>(this TickDisplaySettings display_settings, string text)
|
||||
where T : IFloatingPoint<T> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
parse<T>(display_settings.tick_factors, text, display_settings);
|
||||
#nullable disable
|
||||
|
||||
@@ -204,7 +205,7 @@ namespace mbts {
|
||||
parse<double>(tick, text, display_settings);
|
||||
|
||||
public static T parse<T>(this TickFactors tick, string text, TickDisplaySettings display_settings)
|
||||
where T : IFloatingPoint<T> {
|
||||
where T : IFloatingPointIeee754<T> {
|
||||
if (display_settings is null) {
|
||||
return parse(tick, text, T.NaN, _nan_text);
|
||||
}
|
||||
@@ -213,7 +214,9 @@ namespace mbts {
|
||||
return parse(tick, text, display_multiplier, nan_text);
|
||||
}
|
||||
|
||||
public static T parse<T>(this TickFactors tick, string text, T display_multiplier, string nan_text) where T : IFloatingPoint<T> =>
|
||||
public static T parse<T>(
|
||||
this TickFactors tick, string text, T display_multiplier, string nan_text)
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
tick?.is_valid() ?? false ?
|
||||
_parse(tick, text, display_multiplier, nan_text) :
|
||||
_parse_no_tick(text, display_multiplier, nan_text);
|
||||
@@ -223,37 +226,37 @@ namespace mbts {
|
||||
string text,
|
||||
T display_multiplier,
|
||||
string nan_text
|
||||
) where T : IFloatingPoint<T> =>
|
||||
) where T : IFloatingPointIeee754<T> =>
|
||||
regional_tick.is_valid() ?
|
||||
_parse(regional_tick, text, display_multiplier, nan_text) :
|
||||
_parse_no_tick(text, display_multiplier, nan_text);
|
||||
|
||||
public static T tick<T>(this TickFactors tick, T value, int count)
|
||||
where T : IFloatingPoint<T> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
count < 0 ? tick.tickdown(value, (uint)-count) : tick.tickup(value, (uint)count);
|
||||
|
||||
public static T tick<T>(this bts.api.domain.TickFactorsImmutable tick, T value, int count)
|
||||
where T : IFloatingPoint<T> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
tick.to_tick_factors().tick(value, count);
|
||||
|
||||
public static T tick<T>(
|
||||
this bts.api.domain.TickDisplaySettingsImmutable settings, T value, int count)
|
||||
where T : IFloatingPoint<T> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
settings.HasTickFactors ?
|
||||
settings.TickFactors.tick(value, count) :
|
||||
throw new ArgumentException(
|
||||
"Can't tick because 'settings.HasTickFactors' is false", nameof(settings));
|
||||
|
||||
public static T tickup<T>(this TickFactors tick, T input, uint count = 1)
|
||||
where T : IFloatingPoint<T> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
tickup(tick, input, count, TickUtils.precision_const<T>());
|
||||
|
||||
public static T tickup<T>(this TickFactors tick, T input, uint count, T precision)
|
||||
where T : IFloatingPoint<T> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
tickup<T, NumericCastOutConverter<T>>(tick, input, count, precision);
|
||||
|
||||
public static T tickup<T, TFromUInt32>(this TickFactors tick, T input, uint count, T precision)
|
||||
where T : IFloatingPoint<T>
|
||||
where T : IFloatingPointIeee754<T>
|
||||
where TFromUInt32 : IConverter<uint, T> {
|
||||
if (!precision.is_real_positive()) {
|
||||
throw new ArgumentException("Must be a real positive number.", nameof(precision));
|
||||
@@ -262,7 +265,7 @@ namespace mbts {
|
||||
return input;
|
||||
}
|
||||
var tuf = tick.tick_unit_frac<T>();
|
||||
var ieeer = T.IEEERemainder(input, tuf);
|
||||
var ieeer = T.Ieee754Remainder(input, tuf);
|
||||
input -= ieeer;
|
||||
if (ieeer < -precision) {
|
||||
count--;
|
||||
@@ -271,15 +274,18 @@ namespace mbts {
|
||||
return _round_tick(tuf, result);
|
||||
}
|
||||
|
||||
public static T tickup<T>(this RegionalTickFactors regional_tick, T input) where T : IFloatingPoint<T> =>
|
||||
public static T tickup<T>(
|
||||
this RegionalTickFactors regional_tick, T input) where T : IFloatingPointIeee754<T> =>
|
||||
regional_tick.tickup(input, 1);
|
||||
|
||||
public static T tickup<T>(this RegionalTickFactors regional_tick, T input, uint count) where T : IFloatingPoint<T> =>
|
||||
public static T tickup<T>(
|
||||
this RegionalTickFactors regional_tick, T input, uint count)
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
regional_tick.tickup(input, count, TickUtils.precision_const<T>());
|
||||
|
||||
public static T tickup<T>(
|
||||
this RegionalTickFactors regional_tick, T input, uint count, T precision)
|
||||
where T : IFloatingPoint<T> {
|
||||
where T : IFloatingPointIeee754<T> {
|
||||
if (!precision.is_real_positive()) {
|
||||
throw new ArgumentException("Must be a real positive number.", nameof(precision));
|
||||
}
|
||||
@@ -292,7 +298,7 @@ namespace mbts {
|
||||
T ltie = regional_tick.low_tick_inclusive_end.as_type<double, T>();
|
||||
if (input < ltie) {
|
||||
tuf = regional_tick.low_tick.tick_unit_frac<T>();
|
||||
var ieeer = T.IEEERemainder(input, tuf);
|
||||
var ieeer = T.Ieee754Remainder(input, tuf);
|
||||
input -= ieeer;
|
||||
if (ieeer < -precision) count--;
|
||||
val = input + tuf * count.as_type<uint, T>();
|
||||
@@ -303,7 +309,7 @@ namespace mbts {
|
||||
}
|
||||
} else {
|
||||
tuf = regional_tick.high_tick.tick_unit_frac<T>();
|
||||
var ieeer = T.IEEERemainder(input, tuf);
|
||||
var ieeer = T.Ieee754Remainder(input, tuf);
|
||||
input -= ieeer;
|
||||
if (ieeer < -precision) count--;
|
||||
val = input + tuf * count.as_type<uint, T>();
|
||||
@@ -312,21 +318,21 @@ namespace mbts {
|
||||
}
|
||||
|
||||
public static T tickdown<T>(this TickFactors tick, T input, uint count = 1)
|
||||
where T : IFloatingPoint<T> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
tickdown(tick, input, count, TickUtils.precision_const<T>());
|
||||
|
||||
public static T tickdown<T>(this TickFactors tick, T input, uint count, T precision)
|
||||
where T : IFloatingPoint<T> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
tickdown<T, NumericCastOutConverter<T>>(tick, input, count, precision);
|
||||
|
||||
public static T tickdown<T, TFromUInt32>(this TickFactors tick, T input, uint count, T precision)
|
||||
where T : IFloatingPoint<T>
|
||||
where T : IFloatingPointIeee754<T>
|
||||
where TFromUInt32 : IConverter<uint, T> {
|
||||
if (!input.is_real()) {
|
||||
return input;
|
||||
}
|
||||
var tuf = tick.tick_unit_frac<T>();
|
||||
var ieeer = T.IEEERemainder(input, tuf);
|
||||
var ieeer = T.Ieee754Remainder(input, tuf);
|
||||
input -= ieeer;
|
||||
if (ieeer > precision) {
|
||||
count--;
|
||||
@@ -336,21 +342,22 @@ namespace mbts {
|
||||
}
|
||||
|
||||
public static T tickdown<T>(this RegionalTickFactors regional_tick, T input)
|
||||
where T : IFloatingPoint<T>, IComparisonOperators<T, double> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
regional_tick.tickdown(input, 1);
|
||||
|
||||
public static T tickdown<T>(this RegionalTickFactors regional_tick, T input, uint count)
|
||||
where T : IFloatingPoint<T>, IComparisonOperators<T, double> =>
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
tickdown(regional_tick, input, count, TickUtils.precision_const<T>());
|
||||
|
||||
public static T tickdown<T>(
|
||||
this RegionalTickFactors regional_tick, T input, uint count, T precision) where T : IFloatingPoint<T> =>
|
||||
this RegionalTickFactors regional_tick, T input, uint count, T precision)
|
||||
where T : IFloatingPointIeee754<T> =>
|
||||
tickdown<T, NumericCastOutConverter<T>, NumericCastOutConverter<T>, NumericCastInConverter<T>>(
|
||||
regional_tick, input, count, precision);
|
||||
|
||||
public static T tickdown<T, TFromUInt32, TFromDouble, TToUInt16>(
|
||||
this RegionalTickFactors regional_tick, T input, uint count, T precision)
|
||||
where T : IFloatingPoint<T>
|
||||
where T : IFloatingPointIeee754<T>
|
||||
where TFromDouble : IConverter<double, T>
|
||||
where TFromUInt32 : IConverter<uint, T>
|
||||
where TToUInt16 : IConverter<T, uint> {
|
||||
@@ -365,7 +372,7 @@ namespace mbts {
|
||||
T low_tick_inclusive_end = TFromDouble.convert(regional_tick.low_tick_inclusive_end);
|
||||
if (input > low_tick_inclusive_end) {
|
||||
tuf = regional_tick.high_tick.tick_unit_frac<T>();
|
||||
var ieeer = T.IEEERemainder(input, tuf);
|
||||
var ieeer = T.Ieee754Remainder(input, tuf);
|
||||
input -= ieeer;
|
||||
if (ieeer > precision) count--;
|
||||
val = input - tuf * TFromDouble.convert(count);
|
||||
@@ -377,7 +384,7 @@ namespace mbts {
|
||||
}
|
||||
} else {
|
||||
tuf = regional_tick.low_tick.tick_unit_frac<T>();
|
||||
var ieeer = T.IEEERemainder(input, tuf);
|
||||
var ieeer = T.Ieee754Remainder(input, tuf);
|
||||
input -= ieeer;
|
||||
if (ieeer > precision) count--;
|
||||
val = input - tuf * TFromDouble.convert(count);
|
||||
@@ -483,7 +490,7 @@ namespace mbts {
|
||||
return display_digits(tick.tick_base);
|
||||
}
|
||||
|
||||
public static int display_digits<T>(T tick_base) where T : IFloatingPoint<T> {
|
||||
public static int display_digits<T>(T tick_base) where T : IFloatingPoint<T>, ILogarithmicFunctions<T> {
|
||||
var log_tick_base = T.Log10(tick_base);
|
||||
var floor = T.Floor(log_tick_base);
|
||||
var dec = log_tick_base - floor;
|
||||
@@ -500,14 +507,14 @@ namespace mbts {
|
||||
}
|
||||
|
||||
static string _format_no_tick<T>(T value, T display_multiplier, bool show_commas)
|
||||
where T : IFloatingPoint<T> {
|
||||
where T : INumberBase<T> {
|
||||
if (!display_multiplier.is_nan()) {
|
||||
value *= display_multiplier;
|
||||
}
|
||||
return value.ToString(show_commas ? "#,0" : "0", null);
|
||||
}
|
||||
|
||||
static T _parse_no_tick<T>(string text, T display_multiplier, string nan_text) where T : IFloatingPoint<T> {
|
||||
static T _parse_no_tick<T>(string text, T display_multiplier, string nan_text) where T : IFloatingPointIeee754<T> {
|
||||
if (text == nan_text) {
|
||||
return T.NaN;
|
||||
}
|
||||
@@ -515,7 +522,7 @@ namespace mbts {
|
||||
result.safe_divide(display_multiplier) : T.NaN;
|
||||
}
|
||||
|
||||
static T _get_integer_part<T>(string integer_text) where T : IFloatingPoint<T> {
|
||||
static T _get_integer_part<T>(string integer_text) where T : IFloatingPointIeee754<T> {
|
||||
if (integer_text.is_null_or_white_space()) {
|
||||
return T.Zero;
|
||||
}
|
||||
@@ -524,7 +531,7 @@ namespace mbts {
|
||||
result : T.NaN;
|
||||
}
|
||||
|
||||
static T _get_numerator_part<T>(string numerator_text, T tick_base) where T : IFloatingPoint<T> {
|
||||
static T _get_numerator_part<T>(string numerator_text, T tick_base) where T : IFloatingPointIeee754<T> {
|
||||
if (string.IsNullOrEmpty(numerator_text)) {
|
||||
return T.Zero;
|
||||
}
|
||||
@@ -554,7 +561,7 @@ namespace mbts {
|
||||
|
||||
static T _parse<T>(
|
||||
RegionalTickFactors regional_tick, string text, T display_multiplier, string nan_text)
|
||||
where T : IFloatingPoint<T> {
|
||||
where T : IFloatingPointIeee754<T> {
|
||||
T result = _parse(regional_tick.low_tick, text, display_multiplier, nan_text);
|
||||
|
||||
T ltie = regional_tick.low_tick_inclusive_end.as_type<double, T>()
|
||||
@@ -566,7 +573,7 @@ namespace mbts {
|
||||
}
|
||||
|
||||
static T _parse<T>(TickFactors tick, string text, T display_multiplier, string nan_text)
|
||||
where T : IFloatingPoint<T> {
|
||||
where T : IFloatingPointIeee754<T> {
|
||||
if (text.is_null_or_white_space() || text == nan_text) {
|
||||
return T.NaN;
|
||||
}
|
||||
@@ -584,7 +591,7 @@ namespace mbts {
|
||||
}
|
||||
|
||||
static T _parse<T>(TickFactors tick, T integer_part, string numerator_part_text)
|
||||
where T : IFloatingPoint<T> {
|
||||
where T : IFloatingPointIeee754<T> {
|
||||
T tick_base = tick.tick_base.as_type<double, T>();
|
||||
T numerator_part = _get_numerator_part(numerator_part_text, tick_base);
|
||||
return integer_part + numerator_part / tick_base;
|
||||
@@ -657,7 +664,7 @@ namespace mbts {
|
||||
}
|
||||
}
|
||||
|
||||
static T _round_tick<T>(T tick_unit_frac, T input) where T : IFloatingPoint<T> =>
|
||||
input - T.IEEERemainder(input, tick_unit_frac);
|
||||
static T _round_tick<T>(T tick_unit_frac, T input) where T : IFloatingPointIeee754<T> =>
|
||||
input - T.Ieee754Remainder(input, tick_unit_frac);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using Spark.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace mbts.spark {
|
||||
static class TickUtils {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Authors>Blue Trading Systems</Authors>
|
||||
<Company>Blue Trading Systems</Company>
|
||||
<Description />
|
||||
@@ -11,6 +11,7 @@
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<WarningsAsErrors />
|
||||
<NoWarn>8981</NoWarn>
|
||||
<Version>$(major).$(minor).$(patch)</Version>
|
||||
<Version Condition="'$(version)'=='..'">0.0.0</Version>
|
||||
</PropertyGroup>
|
||||
@@ -20,7 +21,6 @@
|
||||
<PackageReference Include="Google.Protobuf" Version="3.21.4" />
|
||||
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
|
||||
<PackageReference Include="System.Reactive" Version="5.0.0" />
|
||||
<PackageReference Include="System.Runtime.Experimental" Version="6.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>x64</Platforms>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
|
||||
@@ -61,9 +61,6 @@ namespace System.Collections.Generic {
|
||||
public static IDictionary<TKey, TValue> as_idictionary<TKey, TValue>(this Dictionary<TKey, TValue> dictionary) =>
|
||||
dictionary;
|
||||
|
||||
public static IReadOnlyDictionary<TKey, TValue> AsReadOnly<TKey, TValue>(this IDictionary<TKey, TValue> dictionary) =>
|
||||
new ReadOnlyDictionary<TKey, TValue>(dictionary);
|
||||
|
||||
public static void Difference<TKey, TValue>(this IDictionary<TKey, TValue> left,
|
||||
IDictionary<TKey, TValue> right,
|
||||
out IEnumerable<KeyValuePair<TKey, TValue>> exclusive_left,
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace System.Collections.Generic {
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Reactive.Linq;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace bts.reactive {
|
||||
namespace Spark.Core.Reactive {
|
||||
using System;
|
||||
|
||||
public static class ObserverExtensions {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace bts.reactive {
|
||||
namespace Spark.Core.Reactive {
|
||||
using System;
|
||||
using System.Reactive;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace bts.reactive {
|
||||
throw new ArgumentNullException(nameof(selector));
|
||||
}
|
||||
|
||||
return new AnonymousObserver<TOuter>(outer_val => observer.OnNext(selector(outer_val)), observer.OnError, observer.OnCompleted);
|
||||
return new SelectorObserver<TOuter, TInner>(observer, selector);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#nullable enable
|
||||
|
||||
namespace Spark.Core.Reactive {
|
||||
using System;
|
||||
|
||||
public static class SelectorObserver {
|
||||
public static SelectorObserverBuilder<T> builder<T>(IObserver<T> observer) =>
|
||||
new(observer);
|
||||
}
|
||||
|
||||
public class SelectorObserver<T, TResult> : IObserver<T> {
|
||||
readonly IObserver<TResult> _observer;
|
||||
readonly Func<T, TResult> _selector;
|
||||
|
||||
public SelectorObserver(IObserver<TResult> observer, Func<T, TResult> selector) {
|
||||
_observer = observer;
|
||||
_selector = selector;
|
||||
}
|
||||
|
||||
public void OnCompleted() =>
|
||||
_observer.OnCompleted();
|
||||
|
||||
public void OnError(Exception error) =>
|
||||
_observer.OnError(error);
|
||||
|
||||
public void OnNext(T value) =>
|
||||
_observer.OnNext(_selector(value));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#nullable enable
|
||||
|
||||
namespace Spark.Core.Reactive {
|
||||
using System;
|
||||
|
||||
public class SelectorObserverBuilder<TResult> {
|
||||
readonly IObserver<TResult> _observer;
|
||||
|
||||
public SelectorObserverBuilder(IObserver<TResult> observer) =>
|
||||
_observer = observer;
|
||||
|
||||
public SelectorObserver<T, TResult> wrap<T>(Func<T, TResult> selector) =>
|
||||
new(_observer, selector);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Platforms>x64</Platforms>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
@@ -15,7 +15,6 @@
|
||||
<PackageReference Include="Google.Protobuf" Version="3.21.4" />
|
||||
<PackageReference Include="System.Reactive" Version="5.0.0" />
|
||||
<PackageReference Include="protobuf-net" Version="3.1.17" />
|
||||
<PackageReference Include="System.Runtime.Experimental" Version="6.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace mbts.utils {
|
||||
static class ExceptionAssert {
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace bts.utils {
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
public static class MathUtils {
|
||||
public const double EPSILON = 1E-12;
|
||||
@@ -14,7 +15,7 @@ namespace bts.utils {
|
||||
public static readonly IComparer<double> epsilon_comparer = new ErrorMarginComparer<double>(EPSILON);
|
||||
|
||||
public static T abs_diff<T>(T x, T y)
|
||||
where T : ISubtractionOperators<T, T, T>, IComparisonOperators<T, T> =>
|
||||
where T : ISubtractionOperators<T, T, T>, IComparisonOperators<T, T, bool> =>
|
||||
x > y ? (x - y) : (y - x);
|
||||
|
||||
public static IComparer<double> error_margin_comparer(double error_margin) =>
|
||||
@@ -36,14 +37,14 @@ namespace bts.utils {
|
||||
epsilon_equals(x, y, NormalNumericOps<T>.epsilon);
|
||||
|
||||
public static bool epsilon_equals<T>(T x, T y, T epsilon)
|
||||
where T : ISubtractionOperators<T, T, T>, IComparisonOperators<T, T> =>
|
||||
where T : ISubtractionOperators<T, T, T>, IComparisonOperators<T, T, bool> =>
|
||||
abs_diff(x, y) < epsilon;
|
||||
|
||||
public static bool marginal_equals(double x, double y) =>
|
||||
marginal_equals(x, y, EPSILON);
|
||||
|
||||
public static bool marginal_equals<T>(T x, T y, T margin)
|
||||
where T : ISubtractionOperators<T, T, T>, IComparisonOperators<T, T> =>
|
||||
where T : ISubtractionOperators<T, T, T>, IComparisonOperators<T, T, bool> =>
|
||||
(x > y ? (x - y) : (y - x)) < margin;
|
||||
|
||||
public static bool is_nan<T>(T value) where T : INumber<T> =>
|
||||
@@ -132,7 +133,7 @@ namespace bts.utils {
|
||||
public static T nan_diff<T>(T a, T b) where T : IFloatingPoint<T> =>
|
||||
T.IsNaN(a) ? -b : T.IsNaN(b) ? a : a - b;
|
||||
|
||||
public static bool is_within_range<T>(T value, T min, T max) where T : IComparisonOperators<T, T> =>
|
||||
public static bool is_within_range<T>(T value, T min, T max) where T : IComparisonOperators<T, T, bool> =>
|
||||
value >= min && value <= max;
|
||||
|
||||
public static T weighted_average<T>(T x, T x_weight, T y, T y_weight) where T : IFloatingPoint<T> {
|
||||
@@ -145,7 +146,7 @@ namespace bts.utils {
|
||||
return x + (y - x) * (x_weight / (x_weight + y_weight));
|
||||
}
|
||||
|
||||
public static T within_range<T>(T value, T min, T max) where T : IComparisonOperators<T, T> {
|
||||
public static T within_range<T>(T value, T min, T max) where T : IComparisonOperators<T, T, bool> {
|
||||
if (value < min) {
|
||||
return min;
|
||||
}
|
||||
@@ -156,7 +157,7 @@ namespace bts.utils {
|
||||
}
|
||||
|
||||
public static T within_range<T>(
|
||||
T value, T? min = null, T? max = null) where T : struct, IComparisonOperators<T, T> {
|
||||
T value, T? min = null, T? max = null) where T : struct, IComparisonOperators<T, T, bool> {
|
||||
if (min.HasValue && value < min.Value) {
|
||||
return min.Value;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ namespace Spark.Core {
|
||||
using bts;
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
public class NumericCastConverter :
|
||||
IConverter<int, int>,
|
||||
@@ -213,7 +214,7 @@ namespace Spark.Core {
|
||||
IConverter<T, double>,
|
||||
IConverter<T, float>,
|
||||
IConverter<T, decimal>
|
||||
where T : INumber<T> {
|
||||
where T : INumberBase<T> {
|
||||
|
||||
static readonly Func<T, short> _to_int16;
|
||||
static readonly Func<T, ushort> _to_uint16;
|
||||
@@ -342,7 +343,9 @@ namespace Spark.Core {
|
||||
static decimal IConverter<T, decimal>.convert(T value) => _to_decimal(value);
|
||||
}
|
||||
|
||||
public class NumericCastConverter<TIn, TOut> : IConverter<TIn, TOut> where TIn : INumber<TIn> where TOut : INumber<TOut> {
|
||||
public class NumericCastConverter<TIn, TOut> : IConverter<TIn, TOut>
|
||||
where TIn : INumberBase<TIn>
|
||||
where TOut : INumberBase<TOut> {
|
||||
static readonly Func<TIn, TOut> _convert;
|
||||
|
||||
static NumericCastConverter() {
|
||||
|
||||
@@ -3,44 +3,45 @@ namespace bts.utils {
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
public static class NumericExtensions {
|
||||
public static TOut as_type<TOut>(this short value) where TOut : INumber<TOut> =>
|
||||
public static TOut as_type<TOut>(this short value) where TOut : INumberBase<TOut> =>
|
||||
as_type<short, TOut>(value);
|
||||
|
||||
public static TOut as_type<TOut>(this ushort value) where TOut : INumber<TOut> =>
|
||||
public static TOut as_type<TOut>(this ushort value) where TOut : INumberBase<TOut> =>
|
||||
as_type<ushort, TOut>(value);
|
||||
|
||||
public static TOut as_type<TOut>(this int value) where TOut : INumber<TOut> =>
|
||||
public static TOut as_type<TOut>(this int value) where TOut : INumberBase<TOut> =>
|
||||
as_type<int, TOut>(value);
|
||||
|
||||
public static TOut as_type<TOut>(this uint value) where TOut : INumber<TOut> =>
|
||||
public static TOut as_type<TOut>(this uint value) where TOut : INumberBase<TOut> =>
|
||||
as_type<uint, TOut>(value);
|
||||
|
||||
public static TOut as_type<TOut>(this long value) where TOut : INumber<TOut> =>
|
||||
public static TOut as_type<TOut>(this long value) where TOut : INumberBase<TOut> =>
|
||||
as_type<long, TOut>(value);
|
||||
|
||||
public static TOut as_type<TOut>(this ulong value) where TOut : INumber<TOut> =>
|
||||
public static TOut as_type<TOut>(this ulong value) where TOut : INumberBase<TOut> =>
|
||||
as_type<ulong, TOut>(value);
|
||||
|
||||
public static TOut as_type<TOut>(this float value) where TOut : INumber<TOut> =>
|
||||
public static TOut as_type<TOut>(this float value) where TOut : INumberBase<TOut> =>
|
||||
as_type<float, TOut>(value);
|
||||
|
||||
public static TOut as_type<TOut>(this double value) where TOut : INumber<TOut> =>
|
||||
public static TOut as_type<TOut>(this double value) where TOut : INumberBase<TOut> =>
|
||||
as_type<double, TOut>(value);
|
||||
|
||||
public static TOut as_type<TIn, TOut>(this TIn value)
|
||||
where TIn : INumber<TIn>
|
||||
where TOut : INumber<TOut> =>
|
||||
where TIn : INumberBase<TIn>
|
||||
where TOut : INumberBase<TOut> =>
|
||||
NumericCastConverter<TIn, TOut>.convert(value);
|
||||
|
||||
public static T abs<T>(this T value) where T : INumber<T> =>
|
||||
public static T abs<T>(this T value) where T : INumberBase<T> =>
|
||||
T.Abs(value);
|
||||
|
||||
public static bool is_nan<T>(this T value) where T : IFloatingPoint<T> =>
|
||||
public static bool is_nan<T>(this T value) where T : INumberBase<T> =>
|
||||
T.IsNaN(value);
|
||||
|
||||
public static T if_nan<T>(this T d, T if_nan) where T : IFloatingPoint<T> =>
|
||||
public static T if_nan<T>(this T d, T if_nan) where T : INumberBase<T> =>
|
||||
d.is_nan() ? if_nan : d;
|
||||
|
||||
public static bool is_int<T>(this T value) where T : IFloatingPoint<T> =>
|
||||
@@ -71,15 +72,15 @@ namespace bts.utils {
|
||||
MathUtils.marginal_equals(x, y, margin);
|
||||
|
||||
public static bool is_within_range<T>(
|
||||
this T value, T min, T max) where T : IComparisonOperators<T, T> =>
|
||||
this T value, T min, T max) where T : IComparisonOperators<T, T, bool> =>
|
||||
MathUtils.is_within_range(value, min, max);
|
||||
|
||||
public static T within_range<T>(
|
||||
this T value, T min, T max) where T : IComparisonOperators<T, T> =>
|
||||
this T value, T min, T max) where T : IComparisonOperators<T, T, bool> =>
|
||||
MathUtils.within_range(value, min, max);
|
||||
|
||||
public static T within_range<T>(
|
||||
this T value, T? min = null, T? max = null) where T : struct, IComparisonOperators<T, T> =>
|
||||
this T value, T? min = null, T? max = null) where T : struct, IComparisonOperators<T, T, bool> =>
|
||||
MathUtils.within_range(value, min, max);
|
||||
|
||||
public static bool is_real<T>(this T value) where T : IFloatingPoint<T> =>
|
||||
@@ -118,7 +119,7 @@ namespace bts.utils {
|
||||
/// If only <paramref name="b"/> is real, returns <paramref name="b"/>.
|
||||
/// If neither term is real, returns NaN.
|
||||
/// </remarks>
|
||||
public static T add_real<T>(this T a, T b) where T : IFloatingPoint<T> =>
|
||||
public static T add_real<T>(this T a, T b) where T : IFloatingPointIeee754<T> =>
|
||||
new[] { a, b }.sum_real(true);
|
||||
|
||||
/// <summary>
|
||||
@@ -129,7 +130,7 @@ namespace bts.utils {
|
||||
/// If only <paramref name="b"/> is real, returns -<paramref name="b"/>
|
||||
/// If neither term is real, returns NaN.
|
||||
/// </remarks>
|
||||
public static T subtract_real<T>(this T a, T b) where T : IFloatingPoint<T> =>
|
||||
public static T subtract_real<T>(this T a, T b) where T : IFloatingPointIeee754<T> =>
|
||||
new[] { a, -b }.sum_real(true);
|
||||
|
||||
/// <summary>
|
||||
@@ -187,7 +188,7 @@ namespace bts.utils {
|
||||
/// contains no real numbers
|
||||
/// </param>
|
||||
public static T sum_real<T>(this IEnumerable<T> values, bool nan_if_none = false)
|
||||
where T : IFloatingPoint<T> {
|
||||
where T : IFloatingPointIeee754<T> {
|
||||
return nan_if_none ? nan_if_none_impl() : normal_impl();
|
||||
|
||||
T normal_impl() {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<GeneratePackageOnBuild Condition="$(Configuration) == 'Release' or $(Configuration) == 'Release'">true</GeneratePackageOnBuild>
|
||||
<PackageOutputPath>$(OutputPath)\net6.0</PackageOutputPath>
|
||||
<PackageOutputPath>$(OutputPath)\net7.0</PackageOutputPath>
|
||||
<IncludeSource>true</IncludeSource>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
|
||||
@@ -40,19 +40,19 @@
|
||||
<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences" Condition=" '$(SparkRoot)' != '' ">
|
||||
<ItemGroup>
|
||||
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
|
||||
<BuildOutputInPackage Include="$(OutputPath)..\net6.0\libspark.dll" />
|
||||
<BuildOutputInPackage Include="$(OutputPath)..\net7.0\libspark.dll" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!-- deployed sdk build net6.0 -->
|
||||
<ItemGroup Condition=" '$(SparkRoot)' == '' and '$(TargetFramework)' == 'net6.0'">
|
||||
<!-- deployed sdk build net7.0 -->
|
||||
<ItemGroup Condition=" '$(SparkRoot)' == '' and '$(TargetFramework)' == 'net7.0'">
|
||||
<Reference Include="spark_api">
|
||||
<HintPath>..\..\lib\net6.0\spark_api.dll</HintPath>
|
||||
<HintPath>..\..\lib\net7.0\spark_api.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="copy_lib_deployed" AfterTargets="PostBuildEvent" Condition=" '$(SparkRoot)' == '' ">
|
||||
<Copy SourceFiles="..\..\lib\net6.0\libspark.dll" DestinationFolder="$(OutputPath)\" SkipUnchangedFiles="true" />
|
||||
<Copy SourceFiles="..\..\lib\net7.0\libspark.dll" DestinationFolder="$(OutputPath)\" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Platforms>x64</Platforms>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>x64</Platforms>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net6.0</TargetFrameworks>
|
||||
<TargetFrameworks>net7.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;ubuntu.16.04-x64</RuntimeIdentifiers>
|
||||
<Authors>Blue Trading Systems</Authors>
|
||||
<Company>Blue Trading Systems</Company>
|
||||
|
||||
@@ -161,7 +161,7 @@ def to_type_model(field, msg):
|
||||
elif field.type == types.TYPE_DOUBLE: return TypeModel("double", islist, "double?", jstype='number')
|
||||
elif field.type == types.TYPE_FLOAT: return TypeModel("float", islist, "float?", jstype='number', fstype='float32')
|
||||
elif field.type == types.TYPE_STRING: return TypeModel("string", islist, cpptype="std::string")
|
||||
elif field.type == types.TYPE_BYTES: return TypeModel("ByteString", islist, cpptype="std::string", jstype='Uint8Array', fstype='Fable.Import.JS.Uint8Array')
|
||||
elif field.type == types.TYPE_BYTES: return TypeModel("ByteString", islist, cpptype="std::string", jstype='Uint8Array', fstype='Fable.Core.JS.Uint8Array')
|
||||
elif field.type == types.TYPE_BOOL: return TypeModel("bool", islist, "bool?", jstype='boolean', natural_key=True)
|
||||
elif field.type == types.TYPE_ENUM:
|
||||
nested_enums = [x.name for x in msg.enum_type]
|
||||
|
||||
Generated
+2409
-1369
File diff suppressed because it is too large.
Load diff
@@ -1,23 +1,23 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"protobufjs": "^6.11.3",
|
||||
"tslib": "^2.4.0",
|
||||
"protobufjs": "^7.2.2",
|
||||
"tslib": "^2.5.0",
|
||||
"watch": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "^28.1.1",
|
||||
"ts-jest": "^28.0.4",
|
||||
"jest": "^29.4.3",
|
||||
"protobufjs-cli": "^1.1.1",
|
||||
"ts-jest": "^29.0.5",
|
||||
"ts2fable": "^0.7.1",
|
||||
"tsutils": "^3.21.0",
|
||||
"typescript": "^4.7.3",
|
||||
"ws": "^8.7.0"
|
||||
"typescript": "^4.9.5",
|
||||
"ws": "^8.12.1"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.release.json",
|
||||
"watch": "tsc -w -p tsconfig.release.json",
|
||||
"protogen": "pbjs -t json-module -w commonjs -o %build%/proto.js ../../lib/api/*.proto ../../lib/api/services/*.proto ../../lib/domain_model/*.proto ../../lib/sparkproto/*.proto ../../lib/md/protos/*.proto",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"fable": "ts2fable %build%/ServiceContext.d.ts %build%/ServiceContext.fs && ts2fable %build%/HelloService.d.ts %build%/HelloService.fs"
|
||||
"test:watch": "jest --watch"
|
||||
}
|
||||
}
|
||||
Generated
+2833
-3529
File diff suppressed because it is too large.
Load diff
+18
-21
@@ -8,37 +8,34 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/plugin-transform-runtime": "^7.18.2",
|
||||
"@babel/preset-env": "^7.18.2",
|
||||
"@babel/runtime": "^7.18.3",
|
||||
"babel-loader": "^8.2.5",
|
||||
"fable-loader": "^2.1.9",
|
||||
"@babel/plugin-transform-runtime": "^7.21.0",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/runtime": "^7.21.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"fable-utils": "^1.2.0",
|
||||
"node-sass": "^7.0.1",
|
||||
"protobufjs": "^6.11.3",
|
||||
"react": "^18.1.0",
|
||||
"react-dom": "^18.1.0",
|
||||
"node-sass": "^8.0.0",
|
||||
"protobufjs": "^7.2.2",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"remotedev": "^0.2.9",
|
||||
"ts2fable": "^0.7.1",
|
||||
"webpack": "^5.73.0"
|
||||
"webpack": "^5.75.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.18.2",
|
||||
"@babel/core": "^7.21.0",
|
||||
"@fortawesome/fontawesome-free": "^5.15.4",
|
||||
"bulma": "^0.9.4",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"core-js": "^3.22.8",
|
||||
"css-loader": "^6.7.1",
|
||||
"fable-compiler": "^2.13.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"core-js": "^3.28.0",
|
||||
"css-loader": "^6.7.3",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"mini-css-extract-plugin": "^2.6.0",
|
||||
"mini-css-extract-plugin": "^2.7.2",
|
||||
"npx": "^10.2.2",
|
||||
"sass": "^1.52.3",
|
||||
"sass-loader": "^13.0.0",
|
||||
"sass": "^1.58.3",
|
||||
"sass-loader": "^13.2.0",
|
||||
"style-loader": "^3.3.1",
|
||||
"tslib": "^2.4.0",
|
||||
"webpack-cli": "^4.10.0",
|
||||
"webpack-dev-server": "^4.9.2"
|
||||
"tslib": "^2.5.0",
|
||||
"webpack-cli": "^5.0.1",
|
||||
"webpack-dev-server": "^4.11.1"
|
||||
}
|
||||
}
|
||||
@@ -170,8 +170,8 @@ let marginSub model dispatch =
|
||||
|
||||
let selectSub (tab:Tab option) model =
|
||||
match tab, model.tab with
|
||||
| Some PositionManagementTab, _ | None, PositionManagementTab -> Cmd.ofSub (positionSub model)
|
||||
| Some MarginTab, _ | None, MarginTab -> Cmd.ofMsg GetMarginData //Cmd.ofSub (marginSub model)
|
||||
| Some PositionManagementTab, _ | None, PositionManagementTab -> Cmd.ofEffect (positionSub model)
|
||||
| Some MarginTab, _ | None, MarginTab -> Cmd.ofMsg GetMarginData //Cmd.ofEffect (marginSub model)
|
||||
| _ ->
|
||||
match model.unsub with
|
||||
| Some (unsub) -> unsub.Dispose()
|
||||
|
||||
@@ -1225,7 +1225,7 @@ let accountSelectionGrid (accountList:BTSAccount list) (currentAccount:BTSAccoun
|
||||
onClick = None
|
||||
}
|
||||
]
|
||||
div[] [
|
||||
div [] [
|
||||
TableControl.createSelectorTable (Some headerRow) rws
|
||||
]
|
||||
|
||||
@@ -1265,7 +1265,7 @@ let menuItem account selectedAccount model dispatch =
|
||||
]
|
||||
]
|
||||
]
|
||||
else span[][])
|
||||
else span [] [])
|
||||
]
|
||||
|
||||
let NavRoot (accounts:BTSAccount[]) selectedAccount model dispatch =
|
||||
@@ -1312,7 +1312,7 @@ let root (model:Model) dispatch =
|
||||
| "" -> span [] []
|
||||
| _ -> Modal.showConfirm (fst model.ConfirmModal) (fun () -> (snd model.ConfirmModal) |> dispatch) (fun _ -> OpenConfirmModal ("", Msg.SelectTab model.tab ) |> dispatch)
|
||||
match model.adminData with
|
||||
| None -> div[][str "Loading account list..."]
|
||||
| None -> div [] [str "Loading account list..."]
|
||||
| Some data ->
|
||||
div
|
||||
[ Class "columns is-fullheight"
|
||||
|
||||
@@ -7,10 +7,6 @@ open Types
|
||||
open App.State
|
||||
open App.Types
|
||||
open Global
|
||||
open Fable.Core.JsInterop
|
||||
open Types
|
||||
open App.State
|
||||
open Global
|
||||
|
||||
importAll "../sass/main.scss"
|
||||
|
||||
|
||||
@@ -146,8 +146,8 @@ let buttonColumn action header icon misc =
|
||||
rowIdx = 0;
|
||||
misc = misc;
|
||||
}
|
||||
[ Fable.React.Props.HTMLAttr.Name header
|
||||
Fable.React.Props.HTMLAttr.Style [ Fable.React.Props.CSSProp.Width 60 ]
|
||||
[ HTMLAttr.Name header
|
||||
Style [ Fable.React.Props.CSSProp.Width 60 ]
|
||||
]
|
||||
|
||||
// [ Name header
|
||||
|
||||
@@ -6,7 +6,6 @@ open System
|
||||
open System.Runtime.InteropServices
|
||||
open Fable.Core
|
||||
open Fable.Core.JsInterop
|
||||
open System.Xml
|
||||
open bts.api.admin
|
||||
open Global
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ let generalTabView (model:Model) (dispatch:Msg->Unit) (readonly: bool)=
|
||||
Fields.text "Company" model.scratchUser.company [Disabled readonly] (Company >> UpdateField >> dispatch)
|
||||
Fields.checkbox "Can Login?" "Unchecking this stops the user from logging into Spark" model.scratchUser.isActive [Disabled can_login_disabled] (IsActive >> UpdateField >> dispatch)
|
||||
Fields.checkbox "Can Create?" "Checking this allows the user to create other users and accounts" model.scratchUser.canCreate [Disabled (readonly || not can_create)] (CanCreate >> UpdateField >> dispatch)
|
||||
(if (State.isNewUser model.scratchUser) then modal else span[][])
|
||||
(if (State.isNewUser model.scratchUser) then modal else span [] [])
|
||||
]
|
||||
|
||||
let accountNameLookup (accountsList:BTSAccount list) (id:string) =
|
||||
@@ -334,7 +334,7 @@ let tabContent (model:Model) (dispatch:Msg->Unit) display_md display_risk =
|
||||
| Tab.MarketData, true -> MarketDataTabView model dispatch (not display_md)
|
||||
| Tab.OrderRouting, true -> orderRoutingTabView model dispatch (not display_risk) )
|
||||
|
||||
(if (State.userIsSelected model.scratchUser State.defaultScratchUser) then userControls model dispatch else span[][])
|
||||
(if (State.userIsSelected model.scratchUser State.defaultScratchUser) then userControls model dispatch else span [] [])
|
||||
]
|
||||
|
||||
let usersMenu (usersList:BTSUser list) (currentUser:BTSUser) (dispatch:Msg->Unit) =
|
||||
@@ -395,7 +395,7 @@ let userSelectionGrid (usersList:BTSUser list) (currentUser:BTSUser) (dispatch:M
|
||||
onClick = None
|
||||
}
|
||||
]
|
||||
div[][
|
||||
div [] [
|
||||
TableControl.createSelectorTable (Some headerRow) rws
|
||||
]
|
||||
|
||||
@@ -444,7 +444,7 @@ let menuItem (user:BTSUser) (selectedUser:BTSUser) model dispatch =
|
||||
]
|
||||
]
|
||||
else
|
||||
span[][])
|
||||
span [] [])
|
||||
]
|
||||
|
||||
let NavRoot (usersList:BTSUser list) (currentUser:BTSUser) model (dispatch:Msg->Unit) =
|
||||
@@ -496,7 +496,7 @@ let root (model:Model) (dispatch:Msg->Unit) =
|
||||
| "" -> span [] []
|
||||
| _ -> Modal.showConfirm (fst model.ConfirmModal) (fun () -> (snd model.ConfirmModal) |> dispatch) (fun _ -> OpenConfirmModal ("", Msg.SwitchTab model.currentTab ) |> dispatch)
|
||||
(match model.adminData with
|
||||
| None -> div[][str "Loading user list..."]
|
||||
| None -> div [] [str "Loading user list..."]
|
||||
| Some data ->
|
||||
div
|
||||
[ Class "columns is-fullheight"
|
||||
|
||||
@@ -0,0 +1,486 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v7.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v7.0": {
|
||||
"ui/1.0.0": {
|
||||
"dependencies": {
|
||||
"Elmish": "4.0.1",
|
||||
"Elmish.Navigation": "1.0.0",
|
||||
"Fable.Core": "4.0.0-theta-007",
|
||||
"Fable.Elmish": "4.0.1",
|
||||
"Fable.Elmish.Browser": "4.0.1",
|
||||
"Fable.Elmish.Debugger": "4.0.0",
|
||||
"Fable.Elmish.HMR": "7.0.0",
|
||||
"Fable.Elmish.React": "4.0.0",
|
||||
"Fable.Elmish.UrlParser": "1.0.1",
|
||||
"Fable.Promise": "3.2.0",
|
||||
"Fable.React": "9.2.0",
|
||||
"System.Runtime": "4.3.1"
|
||||
},
|
||||
"runtime": {
|
||||
"ui.dll": {}
|
||||
}
|
||||
},
|
||||
"Elmish/4.0.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Elmish.dll": {
|
||||
"assemblyVersion": "4.0.1.0",
|
||||
"fileVersion": "4.0.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Elmish.Navigation/1.0.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Elmish": "4.0.1"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Elmish.Navigation.dll": {
|
||||
"assemblyVersion": "1.0.0.0",
|
||||
"fileVersion": "1.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Browser.Blob/1.2.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Core": "4.0.0-theta-007"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Browser.Blob.dll": {
|
||||
"assemblyVersion": "1.2.0.0",
|
||||
"fileVersion": "1.2.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Browser.Dom/2.10.1": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Browser.Blob": "1.2.0",
|
||||
"Fable.Browser.Event": "1.5.0",
|
||||
"Fable.Browser.WebStorage": "1.1.0",
|
||||
"Fable.Core": "4.0.0-theta-007"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Browser.Dom.dll": {
|
||||
"assemblyVersion": "2.10.1.0",
|
||||
"fileVersion": "2.10.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Browser.Event/1.5.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Browser.Gamepad": "1.1.0",
|
||||
"Fable.Core": "4.0.0-theta-007"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Browser.Event.dll": {
|
||||
"assemblyVersion": "1.5.0.0",
|
||||
"fileVersion": "1.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Browser.Gamepad/1.1.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Core": "4.0.0-theta-007"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Browser.Gamepad.dll": {
|
||||
"assemblyVersion": "1.1.0.0",
|
||||
"fileVersion": "1.1.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Browser.WebStorage/1.1.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Browser.Event": "1.5.0",
|
||||
"Fable.Core": "4.0.0-theta-007"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Browser.WebStorage.dll": {
|
||||
"assemblyVersion": "1.1.0.0",
|
||||
"fileVersion": "1.1.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Core/4.0.0-theta-007": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Fable.Core.dll": {
|
||||
"assemblyVersion": "4.0.0.0",
|
||||
"fileVersion": "4.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Elmish/4.0.1": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Core": "4.0.0-theta-007"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Fable.Elmish.dll": {
|
||||
"assemblyVersion": "4.0.1.0",
|
||||
"fileVersion": "4.0.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Elmish.Browser/4.0.1": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Browser.Dom": "2.10.1",
|
||||
"Fable.Elmish": "4.0.1",
|
||||
"Fable.Elmish.UrlParser": "1.0.1"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Fable.Elmish.Browser.dll": {
|
||||
"assemblyVersion": "4.0.1.0",
|
||||
"fileVersion": "4.0.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Elmish.Debugger/4.0.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Elmish": "4.0.1",
|
||||
"Thoth.Json": "6.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Fable.Elmish.Debugger.dll": {
|
||||
"assemblyVersion": "4.0.0.0",
|
||||
"fileVersion": "4.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Elmish.HMR/7.0.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Core": "4.0.0-theta-007",
|
||||
"Fable.Elmish.React": "4.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Fable.Elmish.HMR.dll": {
|
||||
"assemblyVersion": "7.0.0.0",
|
||||
"fileVersion": "7.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Elmish.React/4.0.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Elmish": "4.0.1",
|
||||
"Fable.ReactDom.Types": "18.2.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Fable.Elmish.React.dll": {
|
||||
"assemblyVersion": "4.0.0.0",
|
||||
"fileVersion": "4.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Elmish.UrlParser/1.0.1": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Fable.Elmish.UrlParser.dll": {
|
||||
"assemblyVersion": "1.0.1.0",
|
||||
"fileVersion": "1.0.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.Promise/3.2.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Core": "4.0.0-theta-007"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Fable.Promise.dll": {
|
||||
"assemblyVersion": "3.2.0.0",
|
||||
"fileVersion": "3.2.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.React/9.2.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.React.Types": "18.3.0",
|
||||
"Fable.ReactDom.Types": "18.2.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Fable.React.dll": {
|
||||
"assemblyVersion": "9.2.0.0",
|
||||
"fileVersion": "9.2.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.React.Types/18.3.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Browser.Dom": "2.10.1",
|
||||
"Fable.Core": "4.0.0-theta-007"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Fable.React.Types.dll": {
|
||||
"assemblyVersion": "18.3.0.0",
|
||||
"fileVersion": "18.3.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Fable.ReactDom.Types/18.2.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.React.Types": "18.3.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Fable.ReactDom.Types.dll": {
|
||||
"assemblyVersion": "18.2.0.0",
|
||||
"fileVersion": "18.2.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"FSharp.Core/6.0.7": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/FSharp.Core.dll": {
|
||||
"assemblyVersion": "6.0.0.0",
|
||||
"fileVersion": "6.0.722.51308"
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"lib/netstandard2.1/cs/FSharp.Core.resources.dll": {
|
||||
"locale": "cs"
|
||||
},
|
||||
"lib/netstandard2.1/de/FSharp.Core.resources.dll": {
|
||||
"locale": "de"
|
||||
},
|
||||
"lib/netstandard2.1/es/FSharp.Core.resources.dll": {
|
||||
"locale": "es"
|
||||
},
|
||||
"lib/netstandard2.1/fr/FSharp.Core.resources.dll": {
|
||||
"locale": "fr"
|
||||
},
|
||||
"lib/netstandard2.1/it/FSharp.Core.resources.dll": {
|
||||
"locale": "it"
|
||||
},
|
||||
"lib/netstandard2.1/ja/FSharp.Core.resources.dll": {
|
||||
"locale": "ja"
|
||||
},
|
||||
"lib/netstandard2.1/ko/FSharp.Core.resources.dll": {
|
||||
"locale": "ko"
|
||||
},
|
||||
"lib/netstandard2.1/pl/FSharp.Core.resources.dll": {
|
||||
"locale": "pl"
|
||||
},
|
||||
"lib/netstandard2.1/pt-BR/FSharp.Core.resources.dll": {
|
||||
"locale": "pt-BR"
|
||||
},
|
||||
"lib/netstandard2.1/ru/FSharp.Core.resources.dll": {
|
||||
"locale": "ru"
|
||||
},
|
||||
"lib/netstandard2.1/tr/FSharp.Core.resources.dll": {
|
||||
"locale": "tr"
|
||||
},
|
||||
"lib/netstandard2.1/zh-Hans/FSharp.Core.resources.dll": {
|
||||
"locale": "zh-Hans"
|
||||
},
|
||||
"lib/netstandard2.1/zh-Hant/FSharp.Core.resources.dll": {
|
||||
"locale": "zh-Hant"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.NETCore.Platforms/1.1.1": {},
|
||||
"Microsoft.NETCore.Targets/1.1.3": {},
|
||||
"System.Runtime/4.3.1": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.1",
|
||||
"Microsoft.NETCore.Targets": "1.1.3"
|
||||
}
|
||||
},
|
||||
"Thoth.Json/6.0.0": {
|
||||
"dependencies": {
|
||||
"FSharp.Core": "6.0.7",
|
||||
"Fable.Core": "4.0.0-theta-007"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Thoth.Json.dll": {
|
||||
"assemblyVersion": "6.0.0.0",
|
||||
"fileVersion": "6.0.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"ui/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Elmish/4.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-6AI++9Ula33yMUG9F83iVrZClurQn5cgriwK7aX9FvlhJFXgRB6IYybD+wx26NNhdPOKQIvfBYZYWwRWWWqJmA==",
|
||||
"path": "elmish/4.0.1",
|
||||
"hashPath": "elmish.4.0.1.nupkg.sha512"
|
||||
},
|
||||
"Elmish.Navigation/1.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-0+CYaZzb988Oi02KeXPTUf0HTi1NXgFXTZ5/OROU22GKAohZe519QK3Be+jkbT0hvQq5EEiJJjPfp3FAgpqDaA==",
|
||||
"path": "elmish.navigation/1.0.0",
|
||||
"hashPath": "elmish.navigation.1.0.0.nupkg.sha512"
|
||||
},
|
||||
"Fable.Browser.Blob/1.2.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-bM4zbtIeycTFFCH7o4WuN28W70dTxNTMZiMvR70XUTYrBnbz7GpS5XxzUy5caDB4l7s2l7wiuVDhh52t7NXxDg==",
|
||||
"path": "fable.browser.blob/1.2.0",
|
||||
"hashPath": "fable.browser.blob.1.2.0.nupkg.sha512"
|
||||
},
|
||||
"Fable.Browser.Dom/2.10.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-G1Ul9D3suwBPUxEw0hwclZzDxDk/hLkwAZytgAoxHmv4uGth9Zpi9Fz4gm6C8v6W87qvhcM8lrCpg1awPeATyg==",
|
||||
"path": "fable.browser.dom/2.10.1",
|
||||
"hashPath": "fable.browser.dom.2.10.1.nupkg.sha512"
|
||||
},
|
||||
"Fable.Browser.Event/1.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-Bx2AOOASIG1Eq1Pe8869H8baMePte6STmKGccGuOYMT2p6nWVS8G6ZBZb5encQ0tAL2/0vhA4KJOl4bYwUaQqg==",
|
||||
"path": "fable.browser.event/1.5.0",
|
||||
"hashPath": "fable.browser.event.1.5.0.nupkg.sha512"
|
||||
},
|
||||
"Fable.Browser.Gamepad/1.1.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-8m/Ae/mrH2Hb2ue435rTPEeVb2FhfWsRJJLpCxMvk+5EUOO2+IIjIkLq4thUfRL98uQVt9V5cQd14h2aBf2XJA==",
|
||||
"path": "fable.browser.gamepad/1.1.0",
|
||||
"hashPath": "fable.browser.gamepad.1.1.0.nupkg.sha512"
|
||||
},
|
||||
"Fable.Browser.WebStorage/1.1.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-tGktTk6QHIOeX7JtG5ISem1p9Rc1iYkgcbpIEzHS2YuvpOa9YomUKABU0Lraz4GMjAGxhhNvAXLRry2w89HdVQ==",
|
||||
"path": "fable.browser.webstorage/1.1.0",
|
||||
"hashPath": "fable.browser.webstorage.1.1.0.nupkg.sha512"
|
||||
},
|
||||
"Fable.Core/4.0.0-theta-007": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-9nDQRQfhz6/NjoXLBMqixCjRYvx8jgHAuGjJow4W0vHoFWNauPhTex+psQsw9FRRuQF2AhIwuhHoh9Tb8JoCfw==",
|
||||
"path": "fable.core/4.0.0-theta-007",
|
||||
"hashPath": "fable.core.4.0.0-theta-007.nupkg.sha512"
|
||||
},
|
||||
"Fable.Elmish/4.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-BtsXTur95XkWmZaXwIoqfUk8puWpiwgJK8YMTg62C/FYxMl8Z6WM4yuGAjQ6rVpKWw5Ha47VfmOL6k/znK3msw==",
|
||||
"path": "fable.elmish/4.0.1",
|
||||
"hashPath": "fable.elmish.4.0.1.nupkg.sha512"
|
||||
},
|
||||
"Fable.Elmish.Browser/4.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-XqTMh3TzkyuWmKXOoNAHRDjxcnCAiDkUMIZZX6tkxoHPhtruxnOG5zniOm7K/RZD+NGbreKi82pPswcvmjw6/w==",
|
||||
"path": "fable.elmish.browser/4.0.1",
|
||||
"hashPath": "fable.elmish.browser.4.0.1.nupkg.sha512"
|
||||
},
|
||||
"Fable.Elmish.Debugger/4.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-a1gABGh8L6kkzGDeVJP6VJtcimfSi/l3Xaa1lzuMlnzb3oXgtfmzXfx1DV/dtDVujIujueCOsA+JmiBh/2HB7A==",
|
||||
"path": "fable.elmish.debugger/4.0.0",
|
||||
"hashPath": "fable.elmish.debugger.4.0.0.nupkg.sha512"
|
||||
},
|
||||
"Fable.Elmish.HMR/7.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-4A3u0H3wdmF00UBFJGJK6jlRxzEgkYOegDj2bgVzYTD1L17+0mCy9+QqAYJMuOGtA2klrKAHcU43tYdm0o2Fnw==",
|
||||
"path": "fable.elmish.hmr/7.0.0",
|
||||
"hashPath": "fable.elmish.hmr.7.0.0.nupkg.sha512"
|
||||
},
|
||||
"Fable.Elmish.React/4.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-cMuWet7DhxgN2G1caYLwjLvoMkH1u75U36cUyL07yxNt/dmGp8GD/+RTtL9wpkfeThfeJHHouCkR708mJcMRpA==",
|
||||
"path": "fable.elmish.react/4.0.0",
|
||||
"hashPath": "fable.elmish.react.4.0.0.nupkg.sha512"
|
||||
},
|
||||
"Fable.Elmish.UrlParser/1.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-Jpw1TPR3YsEeLHF0HMoeHKMYzTgjH+gslq8kNa3/d68GIK09eDpASNzA1gu9YLJkRYy5iUXvvvYtHUOKh+mzEw==",
|
||||
"path": "fable.elmish.urlparser/1.0.1",
|
||||
"hashPath": "fable.elmish.urlparser.1.0.1.nupkg.sha512"
|
||||
},
|
||||
"Fable.Promise/3.2.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-4A+Iiembrny2h3AE2BIbchfuLmWHNhpkOTvbTtFXHtGzHVMqEVFRXrAfdy83wX2wK5Og3fqRo1y8t/Bqkd7j6g==",
|
||||
"path": "fable.promise/3.2.0",
|
||||
"hashPath": "fable.promise.3.2.0.nupkg.sha512"
|
||||
},
|
||||
"Fable.React/9.2.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ZMRkZpBy+6ytUHPk0WjRh15kigncmSGLOAbtf12VaSy48mtgqIW4lC/23X/FEvz8tUGwHvBUen2GzUU1G/L+RQ==",
|
||||
"path": "fable.react/9.2.0",
|
||||
"hashPath": "fable.react.9.2.0.nupkg.sha512"
|
||||
},
|
||||
"Fable.React.Types/18.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-/b8WZ3Bdfhqy9r60ZK9JGZaGNjIMb0ogsrvWIg3k7KfCEvJs5X6+7hCybVkyjVoxwzn9wLyYGRbh5wmuHQT/Vg==",
|
||||
"path": "fable.react.types/18.3.0",
|
||||
"hashPath": "fable.react.types.18.3.0.nupkg.sha512"
|
||||
},
|
||||
"Fable.ReactDom.Types/18.2.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-2WoBjsLiSgrvR68OJXko0iVaqeMbkPM5Bx813A1WlxOSCJ50M9fwnlwG/MUEZtiOIhQmku/YTJY5a8E8r1+j2Q==",
|
||||
"path": "fable.reactdom.types/18.2.0",
|
||||
"hashPath": "fable.reactdom.types.18.2.0.nupkg.sha512"
|
||||
},
|
||||
"FSharp.Core/6.0.7": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-e6wGrq5smV3Yk2fBE/Y0nBG5oFyF59k5Je0a0QDydUpg6liyaafGjD3xvutciKepCP2knspZ/sWViC/F1OyyQQ==",
|
||||
"path": "fsharp.core/6.0.7",
|
||||
"hashPath": "fsharp.core.6.0.7.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.NETCore.Platforms/1.1.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-TMBuzAHpTenGbGgk0SMTwyEkyijY/Eae4ZGsFNYJvAr/LDn1ku3Etp3FPxChmDp5HHF3kzJuoaa08N0xjqAJfQ==",
|
||||
"path": "microsoft.netcore.platforms/1.1.1",
|
||||
"hashPath": "microsoft.netcore.platforms.1.1.1.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.NETCore.Targets/1.1.3": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-3Wrmi0kJDzClwAC+iBdUBpEKmEle8FQNsCs77fkiOIw/9oYA07bL1EZNX0kQ2OMN3xpwvl0vAtOCYY3ndDNlhQ==",
|
||||
"path": "microsoft.netcore.targets/1.1.3",
|
||||
"hashPath": "microsoft.netcore.targets.1.1.3.nupkg.sha512"
|
||||
},
|
||||
"System.Runtime/4.3.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-abhfv1dTK6NXOmu4bgHIONxHyEqFjW8HwXPmpY9gmll+ix9UNo4XDcmzJn6oLooftxNssVHdJC1pGT9jkSynQg==",
|
||||
"path": "system.runtime/4.3.1",
|
||||
"hashPath": "system.runtime.4.3.1.nupkg.sha512"
|
||||
},
|
||||
"Thoth.Json/6.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-fJ9nhZezOyRIsaluEIj5ytCSCbnsvA7ZCa1kY7KkWPqyHtc+SDvjthz5edoFxOAHH44iSmxl6zakapjMSRJbbw==",
|
||||
"path": "thoth.json/6.0.0",
|
||||
"hashPath": "thoth.json.6.0.0.nupkg.sha512"
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
-10
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Version>1.0.0</Version>
|
||||
<AssemblyVersion>1.0.0</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
@@ -17,6 +17,10 @@
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<!-- Global to the app -->
|
||||
<Compile Include="Lens.fs" />
|
||||
<Compile Include="Cmd.fs" />
|
||||
|
||||
<Compile Include="$(API)/ServiceContext.fs" />
|
||||
<Compile Include="$(API)/DynamicService.fs" />
|
||||
<Compile Include="Imports.fs" />
|
||||
@@ -37,9 +41,7 @@
|
||||
<Compile Include="$(API)/fable/co2.fable.fs" />
|
||||
<Compile Include="$(API)/fable/MarketDataRelay.fable.fs" />
|
||||
<!-- Global to the app -->
|
||||
<Compile Include="Lens.fs" />
|
||||
<Compile Include="Global.fs" />
|
||||
<Compile Include="Cmd.fs" />
|
||||
<Compile Include="Controls/nbsp.fs" />
|
||||
<Compile Include="Controls/Button.fs" />
|
||||
<Compile Include="Controls/ReactGrid.fs" />
|
||||
@@ -68,13 +70,17 @@
|
||||
<Compile Include="App.fs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Elmish" Version="4.0.1" />
|
||||
<PackageReference Include="Elmish.Navigation" Version="1.0.0" />
|
||||
<PackageReference Include="Fable.Core" Version="4.0.0-snake-island-alpha-005" />
|
||||
<PackageReference Include="Fable.Elmish" Version="4.0.0-beta-3" />
|
||||
<PackageReference Include="Fable.Elmish.React" Version="4.0.0-beta-2" />
|
||||
<PackageReference Include="Fable.Elmish.UrlParser" Version="1.0.0-beta-1" />
|
||||
<PackageReference Include="Fable.Elmish.Debugger" Version="4.0.0-beta-1" />
|
||||
<PackageReference Include="Fable.Elmish.HMR" Version="6.0.0-beta-002" />
|
||||
<PackageReference Include="Fable.Fetch" Version="2.4.0" />
|
||||
<PackageReference Include="Fable.Core" Version="4.0.0-theta-007" />
|
||||
<PackageReference Include="Fable.Elmish" Version="4.0.1" />
|
||||
<PackageReference Include="Fable.Elmish.Browser" Version="4.0.1" />
|
||||
<PackageReference Include="Fable.Elmish.React" Version="4.0.0" />
|
||||
<PackageReference Include="Fable.Elmish.UrlParser" Version="1.0.1" />
|
||||
<PackageReference Include="Fable.Elmish.Debugger" Version="4.0.0" />
|
||||
<PackageReference Include="Fable.Elmish.HMR" Version="7.0.0" />
|
||||
<PackageReference Include="Fable.Promise" Version="3.2.0" />
|
||||
<PackageReference Include="Fable.React" Version="9.2.0" />
|
||||
<PackageReference Include="System.Runtime" Version="4.3.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -33,7 +33,7 @@ module.exports = env => {
|
||||
ignored: "./**/*"
|
||||
},
|
||||
devtool: isProduction ? undefined : "source-map",
|
||||
entry: resolve('src/ui.fsproj'),
|
||||
entry: resolve(`${output_path}/App.js`),
|
||||
output: {
|
||||
filename: 'bundle.js',
|
||||
path: output_path,
|
||||
@@ -58,16 +58,6 @@ module.exports = env => {
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.fs(x|proj)?$/,
|
||||
use: {
|
||||
loader: "fable-loader",
|
||||
options: {
|
||||
babel: babelOptions,
|
||||
define: isProduction ? [] : ["DEBUG"]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2015
|
||||
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "ui", "web/ui/src/ui.fsproj", "{E5DEFC96-37CF-4844-9C9E-CFA0A9A8AED3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E5DEFC96-37CF-4844-9C9E-CFA0A9A8AED3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E5DEFC96-37CF-4844-9C9E-CFA0A9A8AED3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E5DEFC96-37CF-4844-9C9E-CFA0A9A8AED3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E5DEFC96-37CF-4844-9C9E-CFA0A9A8AED3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -2,44 +2,44 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<BuildRoot>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)))</BuildRoot>
|
||||
<Net60OutputPath>$(BuildRoot)\$(Configuration)\bin\net6.0\</Net60OutputPath>
|
||||
<Net60WinOutputPath>$(BuildRoot)\$(Configuration)\bin\net6.0-windows\</Net60WinOutputPath>
|
||||
<Net70OutputPath>$(BuildRoot)\$(Configuration)\bin\net7.0\</Net70OutputPath>
|
||||
<Net70WinOutputPath>$(BuildRoot)\$(Configuration)\bin\net7.0-windows\</Net70WinOutputPath>
|
||||
<ErrorReport>None</ErrorReport>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target
|
||||
Name="CopyToNet60"
|
||||
Name="CopyToNet70"
|
||||
AfterTargets="Link">
|
||||
<Copy
|
||||
SourceFiles="$(OutDir)libspark.dll"
|
||||
Condition="Exists('$(OutDir)libspark.dll')"
|
||||
DestinationFolder="$(Net60OutputPath)"
|
||||
DestinationFolder="$(Net70OutputPath)"
|
||||
Retries="512"
|
||||
RetryDelayMilliseconds="250"
|
||||
SkipUnchangedFiles="true" />
|
||||
<Copy
|
||||
SourceFiles="$(OutDir)libspark.pdb"
|
||||
Condition="Exists('$(OutDir)libspark.pdb')"
|
||||
DestinationFolder="$(Net60OutputPath)"
|
||||
DestinationFolder="$(Net70OutputPath)"
|
||||
Retries="512"
|
||||
RetryDelayMilliseconds="250"
|
||||
SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
|
||||
<Target
|
||||
Name="CopyToNet60Win"
|
||||
Name="CopyToNet70Win"
|
||||
AfterTargets="Link">
|
||||
<Copy
|
||||
SourceFiles="$(OutDir)libspark.dll"
|
||||
Condition="Exists('$(OutDir)libspark.dll')"
|
||||
DestinationFolder="$(Net60WinOutputPath)"
|
||||
DestinationFolder="$(Net70WinOutputPath)"
|
||||
Retries="512"
|
||||
RetryDelayMilliseconds="250"
|
||||
SkipUnchangedFiles="true" />
|
||||
<Copy
|
||||
SourceFiles="$(OutDir)libspark.pdb"
|
||||
Condition="Exists('$(OutDir)libspark.pdb')"
|
||||
DestinationFolder="$(Net60WinOutputPath)"
|
||||
DestinationFolder="$(Net70WinOutputPath)"
|
||||
Retries="512"
|
||||
RetryDelayMilliseconds="250"
|
||||
SkipUnchangedFiles="true" />
|
||||
|
||||
@@ -307,10 +307,11 @@ def build(
|
||||
|
||||
bins = SparkPaths.client_bins(build_dir, configuration=configuration)
|
||||
for t in publish_tgts:
|
||||
build_cmd_steps.append(f'cd {Path(t.path).parent}')
|
||||
build_cmd_steps.append('dotnet publish -c Release -r win-x64 --sc')
|
||||
build_cmd_steps.append(f'cmake --build {build_dir} --config {configuration}')
|
||||
build_cmd_steps.append(f'dotnet publish -c Release -r win-x64 --sc {t.path}')
|
||||
libspark_path=build_dir.joinpath("src", "lib", configuration, "libspark.dll")
|
||||
build_cmd_steps.append(
|
||||
f'copy {bins.joinpath("libspark.dll")} {bins.joinpath("publish")}')
|
||||
f'copy {libspark_path} {bins.joinpath("win-x64", "publish")}')
|
||||
|
||||
build_cmd = ' && '.join(build_cmd_steps)
|
||||
proc_results.append(subprocess.run(build_cmd))
|
||||
|
||||
@@ -154,6 +154,14 @@ def _fable_webpack(src_path, ui_out_path):
|
||||
copytree(str(src_path.joinpath('ui', 'public')), str(ui_out_path))
|
||||
os.chdir(src_path.joinpath('ui', 'src'))
|
||||
_wrapped_run('dotnet restore')
|
||||
_wrapped_run('dotnet tool restore')
|
||||
# Note: We used to convert fs -> js via webpack, using the node pkgs
|
||||
# fable-compiler & fable-loader. However, as of 02/24/2023, they are
|
||||
# incompatible w/ net7.0. Fortunately the dotnet tool 'fable' IS
|
||||
# compatible w/ net7.0.
|
||||
_wrapped_run(f'dotnet fable -o {ui_out_path}')
|
||||
# Run webpack via 'npm run build'
|
||||
# (the build cmd is defined in package.json)
|
||||
_wrapped_run('npm run build')
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class SparkPaths:
|
||||
|
||||
@staticmethod
|
||||
def client_bins(build_root=_default_build(), configuration='Release'):
|
||||
return build_root.joinpath(configuration, 'bin', 'net6.0-windows', 'win-x64')
|
||||
return build_root.joinpath(configuration, 'bin', 'net7.0-windows')
|
||||
|
||||
@staticmethod
|
||||
def client_sln():
|
||||
|
||||
@@ -38,7 +38,7 @@ def _main():
|
||||
output_dir = args.output_dir or SparkPaths.default_build()
|
||||
output_dir = Path(output_dir)
|
||||
build(
|
||||
configuration='release',
|
||||
configuration='Release',
|
||||
restore=True,
|
||||
build_dir=output_dir,
|
||||
targets=['publish'],
|
||||
|
||||
Reference in new issue
Block a user