Skip to content

Commit

Permalink
Groups
Browse files Browse the repository at this point in the history
  • Loading branch information
artemiusgreat committed Dec 10, 2024
1 parent 3ef79e4 commit 03a3baa
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="Distribution" Version="2.2.1" />
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageReference Include="SkiaSharp" Version="3.0.0-preview.2.1" />
<PackageReference Include="SkiaSharp" Version="3.116.1" />
<PackageReference Include="System.Interactive" Version="6.0.1" />
<PackageReference Include="System.ServiceModel.Primitives" Version="8.1.0" />
</ItemGroup>
Expand Down
18 changes: 11 additions & 7 deletions Core/Models/Points/PointModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,28 @@ public virtual long GetIndex()
/// <returns></returns>
public virtual PointModel Update(PointModel o)
{
var price = (Last ?? Bid ?? Ask ?? o?.Last ?? o?.Bid ?? o?.Ask).Value;
var currentPrice = Last;
var previousPrice = o?.Last;
var price = (currentPrice ?? previousPrice).Value;

Ask ??= o?.Ask ?? price;
Bid ??= o?.Bid ?? price;
AskSize += o?.AskSize ?? 0.0;
BidSize += o?.BidSize ?? 0.0;
Time = Time.Round(Instrument.TimeFrame) ?? o?.Time;
Bar ??= new BarModel();
Bar.Close = Last = price;
Bar.Open = Bar.Open ?? o?.Bar?.Open ?? price;
Bar.Low = Math.Min(Bar?.Low ?? price, o?.Bar?.Low ?? price);
Bar.High = Math.Max(Bar?.High ?? price, o?.Bar?.High ?? price);
Bar.Low = Math.Min(Bar?.Low ?? price, o?.Bar?.Low ?? previousPrice ?? price);
Bar.High = Math.Max(Bar?.High ?? price, o?.Bar?.High ?? previousPrice ?? price);
Time = Time.Round(Instrument.TimeFrame) ?? o?.Time;

Console.WriteLine(
"### PREVIOUS ### : " +
o?.Ask + " / " + o?.Bid + " : " + o?.Bar?.Open + " / " + o?.Bar?.High + " / " + o?.Bar?.Low + " / " + o?.Bar?.Close);

Console.WriteLine(
Instrument.Name + " : " +
Time + " : " +
Ask + " / " + Bid + " / " + AskSize + " / " + BidSize + " : " +
Bar.Open + " / " + Bar.High + " / " + Bar.Low + " / " + Bar.Close);
Ask + " / " + Bid + " : " + Bar.Open + " / " + Bar.High + " / " + Bar.Low + " / " + Bar.Close);

return this;
}
Expand Down
2 changes: 1 addition & 1 deletion Derivative/Derivative.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="alglib.net" Version="3.19.0" />
<PackageReference Include="CalcEngine.Core" Version="1.0.0" />
<PackageReference Include="Canvas.Views.Web" Version="4.5.5" />
<PackageReference Include="Canvas.Views.Web" Version="4.5.6" />
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="Meta.Numerics" Version="4.1.4" />
<PackageReference Include="MudBlazor" Version="7.15.0" />
Expand Down
2 changes: 1 addition & 1 deletion Gateway/Alpaca/Libs/Alpaca.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Alpaca.Markets" Version="7.1.3" />
<PackageReference Include="Alpaca.Markets" Version="7.1.4" />
<PackageReference Include="Distribution.Stream" Version="1.2.4" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Gateway/Coinbase/Libs/Coinbase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="Distribution.Stream" Version="1.2.4" />
<PackageReference Include="jose-jwt" Version="5.1.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.2.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 8 additions & 6 deletions Gateway/InteractiveBrokers/Libs/Adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics.Metrics;
using System.Linq;
using System.Threading.Tasks;
using Terminal.Core.Domains;
Expand Down Expand Up @@ -439,9 +440,9 @@ public override async Task<ResponseModel<IAccount>> GetAccount(Hashtable criteri
.Where(o => Account.Instruments.ContainsKey(o.Name) is false)
.ForEach(o => Account.Instruments[o.Name] = o.Transaction.Instrument);

foreach (var instrument in Account.Instruments)
foreach (var instrument in Account.Instruments.Values)
{
_contracts[instrument.Key] = (await GetContract(instrument.Value, 10)).Data;
_contracts[instrument.Name] = (await GetContract(instrument, 10)).Data ?? ExternalMap.GetContract(instrument);
}

response.Data = Account;
Expand Down Expand Up @@ -559,11 +560,12 @@ void subscribe(TickPriceMessage message)
{
case FieldCodeEnum.BidSize: point.BidSize = message.Data ?? point.BidSize; break;
case FieldCodeEnum.AskSize: point.AskSize = message.Data ?? point.AskSize; break;
case FieldCodeEnum.BidPrice: point.Last = point.Bid = message.Data ?? point.Bid; break;
case FieldCodeEnum.AskPrice: point.Last = point.Ask = message.Data ?? point.Ask; break;
case FieldCodeEnum.BidPrice: point.Bid = message.Data ?? point.Bid; break;
case FieldCodeEnum.AskPrice: point.Ask = message.Data ?? point.Ask; break;
case FieldCodeEnum.LastPrice: point.Last = message.Data ?? point.Last; break;
}

if (point.Bid is null || point.Ask is null || point.BidSize is null || point.AskSize is null)
if (point.Bid is null || point.Ask is null || point.Last is null)
{
return;
}
Expand Down Expand Up @@ -665,7 +667,7 @@ protected virtual Task<ResponseModel<EReader>> CreateReader()
reader.Start();
response.Data = reader;

//while (_client.NextOrderId <= 0) ;
while (_client.NextOrderId <= 0) ;

return Task.FromResult(response);
}
Expand Down
2 changes: 1 addition & 1 deletion Gateway/Schwab/Libs/Adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ protected virtual void OnPoint(IDictionary<string, PointModel> pointMap, IEnumer
point.AskSize = InternalMap.GetValue($"{data.Get(map.Get("Ask Size"))}", point.AskSize);
point.Last = InternalMap.GetValue($"{data.Get(map.Get("Last Price"))}", point.Last);

if (point.Bid is null || point.Ask is null || point.BidSize is null || point.AskSize is null)
if (point.Bid is null || point.Ask is null || point.Last is null)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Gateway/Simulation/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down
2 changes: 1 addition & 1 deletion Terminal/Terminal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Canvas.Views.Web" Version="4.5.5" />
<PackageReference Include="Canvas.Views.Web" Version="4.5.6" />
<PackageReference Include="Estimator" Version="1.0.6" />
<PackageReference Include="MudBlazor" Version="7.15.0" />
</ItemGroup>
Expand Down

0 comments on commit 03a3baa

Please sign in to comment.