Skip to content

Commit

Permalink
Description
Browse files Browse the repository at this point in the history
  • Loading branch information
artemiusgreat committed Oct 24, 2024
1 parent 7c8bc57 commit b20942d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 15 deletions.
Binary file modified Screens/Preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Terminal/Components/DealsComponent.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public virtual void UpdateItems(IEnumerable<OrderModel> items)
/// <summary>
/// Clear records
/// </summary>
public virtual void Clear() => Items.Clear();
public virtual void Clear() => UpdateItems([]);

/// <summary>
/// Map
Expand Down
17 changes: 10 additions & 7 deletions Terminal/Components/OptionPageComponent.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,13 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Security.Principal;
using System.Threading.Tasks;
using Terminal.Core.Domains;
using Terminal.Core.Enums;
using Terminal.Core.Extensions;
using Terminal.Core.Indicators;
using Terminal.Core.Models;
using Terminal.Core.Services;
using Terminal.Models;
using static MudBlazor.Colors;
using Ib = InteractiveBrokers;
using Sc = Schwab;
using Scm = Schwab.Messages;
Expand Down Expand Up @@ -73,6 +67,14 @@ public virtual async Task OnLoad(Func<PointModel, Task> action, IList<Shape> gro
.OfType<PointModel>()
.ForEach(async o => await action(o)));
};

View.OnDisconnect = () =>
{
FramesView.Clear();
PremiumsView.Clear();
PositionsView.Clear();
StrikesView.Clear();
};
}

/// <summary>
Expand Down Expand Up @@ -298,10 +300,11 @@ protected void ShowEstimates(PointModel point)

sums[o] = sums.TryGetValue(o, out var s) ? s + sum : sum;

shape.X = step;
shape.Groups = new Dictionary<string, IShape>();
shape.Groups["0"] = new Shape();
shape.Groups["0"].Groups = new Dictionary<string, IShape>();
shape.Groups["0"].Groups["Estimate"] = new LineShape { Name = "Estimate", X = step, Y = sums[o] };
shape.Groups["0"].Groups["Estimate"] = new LineShape { Name = "Estimate", Y = sums[o] };

return shape as IShape;

Expand Down
2 changes: 1 addition & 1 deletion Terminal/Components/OrdersComponent.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public virtual void UpdateItems(IEnumerable<OrderModel> items)
/// <summary>
/// Clear records
/// </summary>
public virtual void Clear() => Items.Clear();
public virtual void Clear() => UpdateItems([]);

/// <summary>
/// Map
Expand Down
21 changes: 16 additions & 5 deletions Terminal/Components/PageComponent.razor.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Distribution.Models;
using Distribution.Services;
using Microsoft.AspNetCore.Components;
using System;
Expand Down Expand Up @@ -35,6 +36,7 @@ public partial class PageComponent
public virtual StatementsComponent StatementsView { get; set; }
public virtual Action OnPreConnect { get; set; } = () => { };
public virtual Action OnPostConnect { get; set; } = () => { };
public virtual Action OnDisconnect { get; set; } = () => { };
public virtual IDictionary<string, IGateway> Adapters { get; set; } = new Dictionary<string, IGateway>();

public virtual async Task Connect()
Expand Down Expand Up @@ -62,16 +64,25 @@ public virtual async Task Disconnect()
{
try
{
var options = new OptionModel { IsRemovable = false };

await Task.WhenAll(Adapters.Values.Select(o => o.Disconnect()));

ChartsView.Clear();
ReportsView.Clear();
DealsView.Clear();
OrdersView.Clear();
PositionsView.Clear();
InstanceService<ScheduleService>.Instance.Send(() =>
{
ChartsView.Clear();
ReportsView.Clear();
DealsView.Clear();
OrdersView.Clear();
PositionsView.Clear();

OnDisconnect();

}, options);

IsConnection = false;
IsSubscription = false;

}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion Terminal/Components/PositionsComponent.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public virtual void UpdateItems(IEnumerable<OrderModel> items)
/// <summary>
/// Clear records
/// </summary>
public virtual void Clear() => Items.Clear();
public virtual void Clear() => UpdateItems([]);

/// <summary>
/// Map
Expand Down

0 comments on commit b20942d

Please sign in to comment.