diff --git a/Client/Client.csproj b/Client/Client.csproj index 1ea3ce1d3..9e2ce05a4 100644 --- a/Client/Client.csproj +++ b/Client/Client.csproj @@ -9,7 +9,7 @@ - + diff --git a/Core/Domains/Gateway.cs b/Core/Domains/Gateway.cs index 00371b88c..fded633cb 100644 --- a/Core/Domains/Gateway.cs +++ b/Core/Domains/Gateway.cs @@ -18,6 +18,11 @@ public interface IGateway : IDisposable /// IAccount Account { get; set; } + /// + /// Tape + /// + Action> OrderStream { get; set; } + /// /// Connect /// @@ -42,7 +47,7 @@ public interface IGateway : IDisposable /// Get quotes history /// /// - Task>> GetPoints(PointMessageModel message); + Task>> GetPoint(PointMessageModel message); /// /// Get option chains @@ -73,11 +78,17 @@ public abstract class Gateway : IGateway /// public virtual IAccount Account { get; set; } + /// + /// Tape + /// + public virtual Action> OrderStream { get; set; } + /// /// Constructor /// public Gateway() { + OrderStream = o => { }; } /// @@ -107,7 +118,7 @@ public Gateway() /// Get quotes history /// /// - public abstract Task>> GetPoints(PointMessageModel message); + public abstract Task>> GetPoint(PointMessageModel message); /// /// Get option chains diff --git a/Core/Models/Instruments/OptionMessageModel.cs b/Core/Models/Instruments/OptionMessageModel.cs index 08b7ac8c7..9113947a5 100644 --- a/Core/Models/Instruments/OptionMessageModel.cs +++ b/Core/Models/Instruments/OptionMessageModel.cs @@ -9,6 +9,16 @@ public class OptionMessageModel /// public virtual string Name { get; set; } + /// + /// Min strike + /// + public virtual double? MinPrice { get; set; } + + /// + /// Max strike + /// + public virtual double? MaxPrice { get; set; } + /// /// End date /// diff --git a/Core/Models/Instruments/OptionModel.cs b/Core/Models/Instruments/OptionModel.cs index 50f67eabd..5edfbd3a1 100644 --- a/Core/Models/Instruments/OptionModel.cs +++ b/Core/Models/Instruments/OptionModel.cs @@ -11,11 +11,6 @@ public class OptionModel : ICloneable /// public virtual string Name { get; set; } - /// - /// The name of the underlying instrument - /// - public virtual string BaseName { get; set; } - /// /// Strike price /// diff --git a/Core/Models/Points/PointMessageModel.cs b/Core/Models/Points/PointMessageModel.cs index 7e21c2b73..c8699c760 100644 --- a/Core/Models/Points/PointMessageModel.cs +++ b/Core/Models/Points/PointMessageModel.cs @@ -1,15 +1,11 @@ using System; +using System.Collections.Generic; using Terminal.Core.Enums; namespace Terminal.Core.Models { public class PointMessageModel { - /// - /// Symbol - /// - public virtual string Name { get; set; } - /// /// End date /// @@ -24,5 +20,10 @@ public class PointMessageModel /// Resolution /// public virtual ResolutionEnum? Resolution { get; set; } + + /// + /// Symbol + /// + public virtual IList Names { get; set; } } } diff --git a/Core/Models/Transactions/OrderModel.cs b/Core/Models/Transactions/OrderModel.cs index cea2fde80..95af0bdfe 100644 --- a/Core/Models/Transactions/OrderModel.cs +++ b/Core/Models/Transactions/OrderModel.cs @@ -17,15 +17,25 @@ public class OrderModel : ICloneable public virtual double? Price { get; set; } /// - /// Side + /// Asset type /// - public virtual OrderSideEnum? Side { get; set; } + public virtual string AssetType { get; set; } + + /// + /// Custom order type + /// + public virtual string Combination { get; set; } /// /// Type /// public virtual OrderTypeEnum? Type { get; set; } + /// + /// Side + /// + public virtual OrderSideEnum? Side { get; set; } + /// /// Time in force /// diff --git a/Core/Validators/OptionValidator.cs b/Core/Validators/OptionValidator.cs index e6d3fb403..93db9a46a 100644 --- a/Core/Validators/OptionValidator.cs +++ b/Core/Validators/OptionValidator.cs @@ -11,7 +11,6 @@ public class OptionValidator : AbstractValidator public OptionValidator() { RuleFor(o => o.Name).NotEmpty(); - RuleFor(o => o.BaseName).NotEmpty(); RuleFor(o => o.Side).NotEmpty(); RuleFor(o => o.Strike).NotEmpty(); RuleFor(o => o.Leverage).NotEmpty(); diff --git a/Gateways/Alpaca/Libs/Adapter.cs b/Gateways/Alpaca/Libs/Adapter.cs index 8af24ceeb..c2b5da21c 100644 --- a/Gateways/Alpaca/Libs/Adapter.cs +++ b/Gateways/Alpaca/Libs/Adapter.cs @@ -1,4 +1,5 @@ -using Alpaca.Markets; +using Alpaca.Mappers; +using Alpaca.Messages; using Distribution.Services; using Distribution.Stream; using Distribution.Stream.Extensions; @@ -14,10 +15,9 @@ using System.Threading; using System.Threading.Tasks; using Terminal.Core.Domains; -using Terminal.Core.Enums; using Terminal.Core.Extensions; using Terminal.Core.Models; -using Terminal.Core.Services; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace Alpaca { @@ -80,30 +80,39 @@ public Adapter() /// public override async Task> Connect() { - var ws = new ClientWebSocket(); - var scheduler = new ScheduleService(); + var errors = new List(); - await Disconnect(); + try + { + var ws = new ClientWebSocket(); + var scheduler = new ScheduleService(); - _sender = new Service(); - _streamer = await GetConnection(ws, scheduler); + await Disconnect(); - await SendStream(_streamer, new AuthenticationMessage - { - Action = "auth", - SecretKey = ConsumerSecret, - KeyId = ConsumerKey - }); + _sender = new Service(); + _streamer = await GetConnection(ws, scheduler); - await GetAccountData(); + await SendStream(_streamer, new AuthenticationMessage + { + Action = "auth", + SecretKey = ConsumerSecret, + KeyId = ConsumerKey + }); - _connections.Add(_sender); - _connections.Add(_streamer); - _connections.Add(scheduler); + await GetAccountData(); - Account.Instruments.ForEach(async o => await Subscribe(o.Key)); + _connections.Add(_sender); + _connections.Add(_streamer); + _connections.Add(scheduler); - return null; + Account.Instruments.ForEach(async o => await Subscribe(o.Key)); + } + catch (Exception e) + { + errors.Add(new ErrorModel { ErrorMessage = $"{e}" }); + } + + return errors; } /// @@ -111,15 +120,24 @@ public override async Task> Connect() /// public override async Task> Subscribe(string name) { - await Unsubscribe(name); - await SendStream(_streamer, new SubscriptionUpdateMessage + var errors = new List(); + + try { - Action = "subscribe", - Trades = [name], - Quotes = [name] - }); + await Unsubscribe(name); + await SendStream(_streamer, new SubscriptionUpdateMessage + { + Action = "subscribe", + Trades = [name], + Quotes = [name] + }); + } + catch (Exception e) + { + errors.Add(new ErrorModel { ErrorMessage = $"{e}" }); + } - return null; + return errors; } /// @@ -130,7 +148,7 @@ public override Task> Disconnect() _connections?.ForEach(o => o?.Dispose()); _connections?.Clear(); - return Task.FromResult>(null); + return Task.FromResult>([]); } /// @@ -138,26 +156,66 @@ public override Task> Disconnect() /// public override async Task> Unsubscribe(string name) { - await SendStream(_streamer, new SubscriptionUpdateMessage + var errors = new List(); + + try { - Action = "unsubscribe", - Trades = [name], - Quotes = [name] - }); + await SendStream(_streamer, new SubscriptionUpdateMessage + { + Action = "unsubscribe", + Trades = [name], + Quotes = [name] + }); - _subscriptions?.ForEach(o => o.Dispose()); - _subscriptions?.Clear(); + _subscriptions?.ForEach(o => o.Dispose()); + _subscriptions?.Clear(); + } + catch (Exception e) + { + errors.Add(new ErrorModel { ErrorMessage = $"{e}" }); + } - return null; + return errors; } /// /// Get option chains /// /// - public override Task>> GetOptions(OptionMessageModel message) + public override async Task>> GetOptions(OptionMessageModel message) { - throw new NotImplementedException(); + var response = new ResponseItemModel>(); + + try + { + var props = new Hashtable + { + ["limit"] = 1000, + ["underlying_symbol"] = message.Name, + ["expiration_date_gte"] = message.MinDate, + ["expiration_date_lte"] = message.MaxDate + }; + + var optionResponse = await SendData> + ($"/v1beta1/options/snapshots/{message.Name}?{props.ToQuery()}"); + + response.Data = optionResponse + .Data + .Snapshots + .Select(option => InternalMap.GetOption(option.Value)) + .ToList(); + } + catch (Exception e) + { + response.Errors = [new ErrorModel { ErrorMessage = $"{e}" }]; + } + + return response; } /// @@ -165,14 +223,37 @@ public override Task>> GetOptions(OptionMes /// /// /// - public override Task>> GetPoints(PointMessageModel message) + public override async Task>> GetPoint(PointMessageModel message) { - var response = new ResponseItemModel> + var response = new ResponseItemModel>(); + + try { - Data = Account.Instruments[message.Name].Points - }; + var props = new Hashtable + { + ["symbols"] = string.Join(",", message.Names), + ["feed"] = "iex" + }; + + var pointResponse = await SendData + >($"/v2/stocks/quotes/latest?{props.ToQuery()}"); + + response.Data = message + .Names + .Select(name => InternalMap.GetPoint(pointResponse.Data.Quotes[name])) + .ToDictionary(o => o.Instrument.Name); + } + catch (Exception e) + { + response.Errors = [new ErrorModel { ErrorMessage = $"{e}" }]; + } - return Task.FromResult(response); + return response; } /// @@ -213,26 +294,19 @@ public override async Task> DeleteOrders(params Ord /// Sync open balance, order, and positions /// /// - protected async Task GetAccountData() + protected virtual async Task GetAccountData() { var account = await SendData("/v2/account"); var positions = await SendData("/v2/positions"); var orders = await SendData("/v2/orders"); - try - { - Account.Balance = account.Data.Equity; - Account.Descriptor = account.Data.AccountNumber; - Account.ActiveOrders = orders.Data.Select(GetInternalOrder).ToDictionary(o => o.Transaction.Id, o => o); - Account.ActivePositions = positions.Data.Select(GetInternalPosition).ToDictionary(o => o.Order.Transaction.Id, o => o); + Account.Balance = account.Data.Equity; + Account.Descriptor = account.Data.AccountNumber; + Account.ActiveOrders = orders.Data.Select(InternalMap.GetOrder).ToDictionary(o => o.Transaction.Id, o => o); + Account.ActivePositions = positions.Data.Select(InternalMap.GetPosition).ToDictionary(o => o.Order.Transaction.Id, o => o); - Account.ActiveOrders.ForEach(async o => await Subscribe(o.Value.Transaction.Instrument.Name)); - Account.ActivePositions.ForEach(async o => await Subscribe(o.Value.Order.Transaction.Instrument.Name)); - } - catch (Exception e) - { - InstanceService.Instance.OnMessage($"{e}"); - } + Account.ActiveOrders.ForEach(async o => await Subscribe(o.Value.Transaction.Instrument.Name)); + Account.ActivePositions.ForEach(async o => await Subscribe(o.Value.Order.Transaction.Instrument.Name)); } /// @@ -242,7 +316,7 @@ protected async Task GetAccountData() /// /// /// - protected Task SendStream(ClientWebSocket ws, object data, CancellationTokenSource cancellation = null) + protected virtual Task SendStream(ClientWebSocket ws, object data, CancellationTokenSource cancellation = null) { var content = JsonSerializer.Serialize(data, _sender.Options); var message = Encoding.ASCII.GetBytes(content); @@ -260,7 +334,7 @@ protected Task SendStream(ClientWebSocket ws, object data, CancellationTokenSour /// /// /// - protected async Task GetConnection(ClientWebSocket ws, ScheduleService scheduler) + protected virtual async Task GetConnection(ClientWebSocket ws, ScheduleService scheduler) { var source = new UriBuilder(StreamUri); var cancellation = new CancellationTokenSource(); @@ -298,52 +372,60 @@ await ws.ReceiveAsync(data, cancellation.Token).ContinueWith(async o => /// Process quote from the stream /// /// - protected void ProcessPoint(string content) + protected virtual void ProcessPoint(string content) { - try - { - var streamPoint = JsonSerializer - .Deserialize(content, _sender.Options) - .FirstOrDefault(); - - var instrument = Account.Instruments.Get(streamPoint.Symbol) ?? new Instrument(); - var point = new PointModel(); - - point.Ask = streamPoint.AskPrice; - point.Bid = streamPoint.BidPrice; - point.AskSize = streamPoint.AskSize ?? 0; - point.BidSize = streamPoint.BidSize ?? 0; - point.Last = streamPoint.BidPrice ?? streamPoint.AskPrice; - point.Time = streamPoint.TimestampUtc ?? DateTime.Now; - point.TimeFrame = instrument.TimeFrame; - point.Instrument = instrument; - - instrument.Name = streamPoint.Symbol; - instrument.Points.Add(point); - instrument.PointGroups.Add(point); - } - catch (Exception e) - { - InstanceService.Instance.OnMessage(e.Message); - } + var streamPoint = JsonSerializer + .Deserialize(content, _sender.Options) + .FirstOrDefault(); + + var instrument = Account.Instruments.Get(streamPoint.Symbol) ?? new Instrument(); + var point = new PointModel + { + Ask = streamPoint.AskPrice, + Bid = streamPoint.BidPrice, + AskSize = streamPoint.AskSize ?? 0, + BidSize = streamPoint.BidSize ?? 0, + Last = streamPoint.BidPrice ?? streamPoint.AskPrice, + Time = streamPoint.TimestampUtc ?? DateTime.Now, + TimeFrame = instrument.TimeFrame, + Instrument = instrument + }; + + instrument.Name = streamPoint.Symbol; + instrument.Points.Add(point); + instrument.PointGroups.Add(point); } /// /// Process quote from the stream /// /// - protected void ProcessTrade(string content) + protected virtual void ProcessTrade(string content) { - try + var orderMessage = JsonSerializer + .Deserialize(content, _sender.Options) + .FirstOrDefault(); + + var action = new TransactionModel { - var order = JsonSerializer - .Deserialize(content, _sender.Options) - .FirstOrDefault(); - } - catch (Exception e) + Id = orderMessage.TradeId, + Time = orderMessage.TimestampUtc, + Price = orderMessage.Price, + Volume = orderMessage.Size, + Instrument = new Instrument { Name = orderMessage.Symbol } + }; + + var order = new OrderModel { - InstanceService.Instance.OnMessage(e.Message); - } + Side = InternalMap.GetOrderSide(orderMessage.TakerSide) + }; + + var message = new StateModel + { + Next = order + }; + + OrderStream(message); } /// @@ -354,20 +436,14 @@ protected void ProcessTrade(string content) /// /// /// - protected async Task> SendData( + protected virtual async Task> SendData( string source, HttpMethod verb = null, - Hashtable query = null, object content = null) { - query ??= []; verb ??= HttpMethod.Get; - var uri = new UriBuilder(DataUri) - { - Path = source - }; - + var uri = new UriBuilder(DataUri + source); var message = new HttpRequestMessage { Method = verb @@ -375,7 +451,6 @@ protected void ProcessTrade(string content) switch (true) { - case true when Equals(verb, HttpMethod.Get): uri.Query = query.ToQuery(); break; case true when Equals(verb, HttpMethod.Put): case true when Equals(verb, HttpMethod.Post): case true when Equals(verb, HttpMethod.Patch): message.Content = new StringContent(JsonSerializer.Serialize(content)); break; @@ -393,30 +468,27 @@ protected void ProcessTrade(string content) /// /// /// - protected async Task> CreateOrder(OrderModel order) + protected virtual async Task> CreateOrder(OrderModel order) { var inResponse = new ResponseItemModel(); try { - var exOrder = GetExternalOrder(order); - var exResponse = await SendData("/v2/orders", HttpMethod.Post, null, exOrder); + var exOrder = ExternalMap.GetOrder(order); + var exResponse = await SendData("/v2/orders", HttpMethod.Post, exOrder); inResponse.Data = order; inResponse.Data.Transaction.Id = $"{exResponse.Data.OrderId}"; - inResponse.Data.Transaction.Status = GetInternalStatus(exResponse.Data.OrderStatus); + inResponse.Data.Transaction.Status = InternalMap.GetStatus(exResponse.Data.OrderStatus); - if (exResponse.Status < 400) + if ((int)exResponse.Message.StatusCode < 400) { Account.ActiveOrders.Add(order.Transaction.Id, order); } } catch (Exception e) { - inResponse.Errors.Add(new ErrorModel - { - ErrorMessage = e.Message - }); + inResponse.Errors.Add(new ErrorModel { ErrorMessage = $"{e}" }); } return inResponse; @@ -427,7 +499,7 @@ protected async Task> CreateOrder(OrderModel order /// /// /// - protected async Task> DeleteOrder(OrderModel order) + protected virtual async Task> DeleteOrder(OrderModel order) { var inResponse = new ResponseItemModel(); @@ -437,292 +509,19 @@ protected async Task> DeleteOrder(OrderModel order inResponse.Data = order; inResponse.Data.Transaction.Id = $"{exResponse.Data.OrderId}"; - inResponse.Data.Transaction.Status = GetInternalStatus(exResponse.Data.OrderStatus); + inResponse.Data.Transaction.Status = InternalMap.GetStatus(exResponse.Data.OrderStatus); - if (exResponse.Status < 400) + if ((int)exResponse.Message.StatusCode < 400) { Account.ActiveOrders.Remove(order.Transaction.Id); } } catch (Exception e) { - inResponse.Errors.Add(new ErrorModel - { - ErrorMessage = e.Message - }); + inResponse.Errors.Add(new ErrorModel { ErrorMessage = $"{e}" }); } return inResponse; } - - /// - /// Convert remote order from brokerage to local record - /// - /// - /// - protected OrderCreationMessage GetExternalOrder(OrderModel order) - { - var action = order.Transaction; - var message = new OrderCreationMessage - { - Quantity = action.Volume, - Symbol = action.Instrument.Name, - TimeInForce = GetExternalTimeSpan(order.TimeSpan.Value), - OrderType = "market" - }; - - switch (order.Side) - { - case OrderSideEnum.Buy: message.OrderSide = "buy"; break; - case OrderSideEnum.Sell: message.OrderSide = "sell"; break; - } - - switch (order.Type) - { - case OrderTypeEnum.Stop: message.StopPrice = order.Price; break; - case OrderTypeEnum.Limit: message.LimitPrice = order.Price; break; - case OrderTypeEnum.StopLimit: message.StopPrice = order.ActivationPrice; message.LimitPrice = order.Price; break; - } - - if (order.Orders.Any()) - { - message.OrderClass = "bracket"; - - switch (order.Side) - { - case OrderSideEnum.Buy: - message.StopLoss = GetExternalBracket(order, 1); - message.TakeProfit = GetExternalBracket(order, -1); - break; - - case OrderSideEnum.Sell: - message.StopLoss = GetExternalBracket(order, -1); - message.TakeProfit = GetExternalBracket(order, 1); - break; - } - } - - return null; - } - - /// - /// Convert local time in force to remote - /// - /// - /// - protected string GetExternalTimeSpan(OrderTimeSpanEnum span) - { - switch (span) - { - case OrderTimeSpanEnum.Day: return "day"; - case OrderTimeSpanEnum.Fok: return "fok"; - case OrderTimeSpanEnum.Gtc: return "gtc"; - case OrderTimeSpanEnum.Ioc: return "ioc"; - case OrderTimeSpanEnum.Am: return "opg"; - case OrderTimeSpanEnum.Pm: return "cls"; - } - - return null; - } - - /// - /// Convert child orders to brackets - /// - /// - /// - /// - protected OrderAdvancedAttributesMessage GetExternalBracket(OrderModel order, double direction) - { - var nextOrder = order - .Orders - .FirstOrDefault(o => (o.Price - order.Price) * direction > 0); - - if (nextOrder is not null) - { - return new OrderAdvancedAttributesMessage { StopPrice = nextOrder.Price }; - } - - return null; - } - - /// - /// Convert remote order to local - /// - /// - /// - protected OrderModel GetInternalOrder(OrderMessage order) - { - var instrument = new Instrument - { - Name = order.Symbol - }; - - var action = new TransactionModel - { - Id = $"{order.OrderId}", - Descriptor = order.ClientOrderId, - Instrument = instrument, - CurrentVolume = order.FilledQuantity, - Volume = order.Quantity, - Time = order.CreatedAtUtc, - Status = GetInternalStatus(order.OrderStatus) - }; - - var inOrder = new OrderModel - { - Transaction = action, - Type = OrderTypeEnum.Market, - Side = GetInternalOrderSide(order.OrderSide), - TimeSpan = GetInternalTimeSpan(order.TimeInForce) - }; - - switch (order.OrderType) - { - case "stop": - inOrder.Type = OrderTypeEnum.Stop; - inOrder.Price = order.StopPrice; - break; - - case "limit": - inOrder.Type = OrderTypeEnum.Limit; - inOrder.Price = order.LimitPrice; - break; - - case "stop_limit": - inOrder.Type = OrderTypeEnum.StopLimit; - inOrder.Price = order.StopPrice; - inOrder.ActivationPrice = order.LimitPrice; - break; - } - - return inOrder; - } - - /// - /// Convert remote position to local - /// - /// - /// - protected PositionModel GetInternalPosition(PositionMessage position) - { - var instrument = new Instrument - { - Name = position.Symbol - }; - - var action = new TransactionModel - { - Id = $"{position.AssetId}", - Descriptor = position.Symbol, - Instrument = instrument, - Price = position.AverageEntryPrice, - CurrentVolume = position.AvailableQuantity, - Volume = position.Quantity - }; - - var order = new OrderModel - { - Transaction = action, - Type = OrderTypeEnum.Market, - Side = GetInternalPositionSide(position.Side) - }; - - var gainLossPoints = position.AverageEntryPrice - position.AssetCurrentPrice; - var gainLoss = position.CostBasis - position.MarketValue; - - return new PositionModel - { - GainLossPointsMax = gainLossPoints, - GainLossPointsMin = gainLossPoints, - GainLossPoints = gainLossPoints, - GainLossMax = gainLoss, - GainLossMin = gainLoss, - GainLoss = gainLoss, - Order = order, - Orders = [order] - }; - } - - /// - /// Convert remote order status to local - /// - /// - /// - protected OrderStatusEnum GetInternalStatus(string status) - { - switch (status) - { - case "fill": - case "filled": return OrderStatusEnum.Filled; - case "partial_fill": - case "partially_filled": return OrderStatusEnum.Partitioned; - case "stopped": - case "expired": - case "rejected": - case "canceled": - case "done_for_day": return OrderStatusEnum.Canceled; - case "new": - case "held": - case "accepted": - case "suspended": - case "pending_new": - case "pending_cancel": - case "pending_replace": return OrderStatusEnum.Pending; - } - - return OrderStatusEnum.None; - } - - /// - /// Convert remote order side to local - /// - /// - /// - protected OrderSideEnum GetInternalOrderSide(string side) - { - switch (side) - { - case "buy": return OrderSideEnum.Buy; - case "sell": return OrderSideEnum.Sell; - } - - return OrderSideEnum.None; - } - - /// - /// Convert remote position side to local - /// - /// - /// - protected OrderSideEnum GetInternalPositionSide(string side) - { - switch (side) - { - case "long": return OrderSideEnum.Buy; - case "short": return OrderSideEnum.Sell; - } - - return OrderSideEnum.None; - } - - /// - /// Convert remote time in force to local - /// - /// - /// - protected OrderTimeSpanEnum GetInternalTimeSpan(string span) - { - switch (span) - { - case "day": return OrderTimeSpanEnum.Day; - case "fok": return OrderTimeSpanEnum.Fok; - case "gtc": return OrderTimeSpanEnum.Gtc; - case "ioc": return OrderTimeSpanEnum.Ioc; - case "opg": return OrderTimeSpanEnum.Am; - case "cls": return OrderTimeSpanEnum.Pm; - } - - return OrderTimeSpanEnum.None; - } } } diff --git a/Gateways/Alpaca/Libs/Alpaca.csproj b/Gateways/Alpaca/Libs/Alpaca.csproj index e981b8fee..57febf853 100644 --- a/Gateways/Alpaca/Libs/Alpaca.csproj +++ b/Gateways/Alpaca/Libs/Alpaca.csproj @@ -7,7 +7,7 @@ - + diff --git a/Gateways/Alpaca/Libs/Maps/ExternalMap.cs b/Gateways/Alpaca/Libs/Maps/ExternalMap.cs new file mode 100644 index 000000000..9be444553 --- /dev/null +++ b/Gateways/Alpaca/Libs/Maps/ExternalMap.cs @@ -0,0 +1,100 @@ +using Alpaca.Messages; +using System.Linq; +using Terminal.Core.Enums; +using Terminal.Core.Models; + +namespace Alpaca.Mappers +{ + public class ExternalMap + { + /// + /// Convert remote order from brokerage to local record + /// + /// + /// + public static OrderCreationMessage GetOrder(OrderModel order) + { + var action = order.Transaction; + var message = new OrderCreationMessage + { + Quantity = action.Volume, + Symbol = action.Instrument.Name, + TimeInForce = GetTimeSpan(order.TimeSpan.Value), + OrderType = "market" + }; + + switch (order.Side) + { + case OrderSideEnum.Buy: message.OrderSide = "buy"; break; + case OrderSideEnum.Sell: message.OrderSide = "sell"; break; + } + + switch (order.Type) + { + case OrderTypeEnum.Stop: message.StopPrice = order.Price; break; + case OrderTypeEnum.Limit: message.LimitPrice = order.Price; break; + case OrderTypeEnum.StopLimit: message.StopPrice = order.ActivationPrice; message.LimitPrice = order.Price; break; + } + + if (order.Orders.Any()) + { + message.OrderClass = "bracket"; + + switch (order.Side) + { + case OrderSideEnum.Buy: + message.StopLoss = GetBracket(order, 1); + message.TakeProfit = GetBracket(order, -1); + break; + + case OrderSideEnum.Sell: + message.StopLoss = GetBracket(order, -1); + message.TakeProfit = GetBracket(order, 1); + break; + } + } + + return null; + } + + /// + /// Convert local time in force to remote + /// + /// + /// + public static string GetTimeSpan(OrderTimeSpanEnum span) + { + switch (span) + { + case OrderTimeSpanEnum.Day: return "day"; + case OrderTimeSpanEnum.Fok: return "fok"; + case OrderTimeSpanEnum.Gtc: return "gtc"; + case OrderTimeSpanEnum.Ioc: return "ioc"; + case OrderTimeSpanEnum.Am: return "opg"; + case OrderTimeSpanEnum.Pm: return "cls"; + } + + return null; + } + + /// + /// Convert child orders to brackets + /// + /// + /// + /// + public static OrderAdvancedAttributesMessage GetBracket(OrderModel order, double direction) + { + var nextOrder = order + .Orders + .FirstOrDefault(o => (o.Price - order.Price) * direction > 0); + + if (nextOrder is not null) + { + return new OrderAdvancedAttributesMessage { StopPrice = nextOrder.Price }; + } + + return null; + } + } +} diff --git a/Gateways/Alpaca/Libs/Maps/InternalMap.cs b/Gateways/Alpaca/Libs/Maps/InternalMap.cs new file mode 100644 index 000000000..d403764ba --- /dev/null +++ b/Gateways/Alpaca/Libs/Maps/InternalMap.cs @@ -0,0 +1,237 @@ +using Alpaca.Messages; +using System; +using Terminal.Core.Domains; +using Terminal.Core.Enums; +using Terminal.Core.Models; + +namespace Alpaca.Mappers +{ + public class InternalMap + { + /// + /// Get internal option + /// + /// + /// + public static OptionModel GetOption(OptionSnapshotMessage optionMessage) + { + var point = new PointModel + { + Ask = optionMessage.Quote.AskPrice, + Bid = optionMessage.Quote.BidPrice, + AskSize = optionMessage.Quote.AskSize, + BidSize = optionMessage.Quote.BidSize, + Last = optionMessage.Quote.AskPrice ?? optionMessage.Quote.BidPrice + }; + + var option = new OptionModel + { + Point = point, + ExpirationDate = optionMessage.Quote.TimestampUtc + }; + + return option; + } + + /// + /// Get internal point + /// + /// + /// + public static PointModel GetPoint(HistoricalQuoteMessage pointMessage) + { + var point = new PointModel + { + Ask = pointMessage.AskPrice, + Bid = pointMessage.BidPrice, + AskSize = pointMessage.AskSize, + BidSize = pointMessage.BidSize, + Time = pointMessage.TimestampUtc ?? DateTime.UtcNow, + Last = pointMessage.BidPrice ?? pointMessage.AskPrice, + Instrument = new Instrument { Name = pointMessage.Symbol } + }; + + return point; + } + + /// + /// Convert remote order to local + /// + /// + /// + public static OrderModel GetOrder(OrderMessage order) + { + var instrument = new Instrument + { + Name = order.Symbol + }; + + var action = new TransactionModel + { + Id = $"{order.OrderId}", + Descriptor = order.ClientOrderId, + Instrument = instrument, + CurrentVolume = order.FilledQuantity, + Volume = order.Quantity, + Time = order.CreatedAtUtc, + Status = GetStatus(order.OrderStatus) + }; + + var inOrder = new OrderModel + { + Transaction = action, + Type = OrderTypeEnum.Market, + Side = GetOrderSide(order.OrderSide), + TimeSpan = GetTimeSpan(order.TimeInForce) + }; + + switch (order.OrderType) + { + case "stop": + inOrder.Type = OrderTypeEnum.Stop; + inOrder.Price = order.StopPrice; + break; + + case "limit": + inOrder.Type = OrderTypeEnum.Limit; + inOrder.Price = order.LimitPrice; + break; + + case "stop_limit": + inOrder.Type = OrderTypeEnum.StopLimit; + inOrder.Price = order.StopPrice; + inOrder.ActivationPrice = order.LimitPrice; + break; + } + + return inOrder; + } + + /// + /// Convert remote position to local + /// + /// + /// + public static PositionModel GetPosition(PositionMessage position) + { + var instrument = new Instrument + { + Name = position.Symbol + }; + + var action = new TransactionModel + { + Id = $"{position.AssetId}", + Descriptor = position.Symbol, + Instrument = instrument, + Price = position.AverageEntryPrice, + CurrentVolume = position.AvailableQuantity, + Volume = position.Quantity + }; + + var order = new OrderModel + { + Transaction = action, + Type = OrderTypeEnum.Market, + Side = GetPositionSide(position.Side) + }; + + var gainLossPoints = position.AverageEntryPrice - position.AssetCurrentPrice; + var gainLoss = position.CostBasis - position.MarketValue; + + return new PositionModel + { + GainLossPointsMax = gainLossPoints, + GainLossPointsMin = gainLossPoints, + GainLossPoints = gainLossPoints, + GainLossMax = gainLoss, + GainLossMin = gainLoss, + GainLoss = gainLoss, + Order = order, + Orders = [order] + }; + } + + /// + /// Convert remote order status to local + /// + /// + /// + public static OrderStatusEnum GetStatus(string status) + { + switch (status) + { + case "fill": + case "filled": return OrderStatusEnum.Filled; + case "partial_fill": + case "partially_filled": return OrderStatusEnum.Partitioned; + case "stopped": + case "expired": + case "rejected": + case "canceled": + case "done_for_day": return OrderStatusEnum.Canceled; + case "new": + case "held": + case "accepted": + case "suspended": + case "pending_new": + case "pending_cancel": + case "pending_replace": return OrderStatusEnum.Pending; + } + + return OrderStatusEnum.None; + } + + /// + /// Convert remote order side to local + /// + /// + /// + public static OrderSideEnum GetOrderSide(string side) + { + switch (side) + { + case "buy": return OrderSideEnum.Buy; + case "sell": return OrderSideEnum.Sell; + } + + return OrderSideEnum.None; + } + + /// + /// Convert remote position side to local + /// + /// + /// + public static OrderSideEnum GetPositionSide(string side) + { + switch (side) + { + case "long": return OrderSideEnum.Buy; + case "short": return OrderSideEnum.Sell; + } + + return OrderSideEnum.None; + } + + /// + /// Convert remote time in force to local + /// + /// + /// + public static OrderTimeSpanEnum GetTimeSpan(string span) + { + switch (span) + { + case "day": return OrderTimeSpanEnum.Day; + case "fok": return OrderTimeSpanEnum.Fok; + case "gtc": return OrderTimeSpanEnum.Gtc; + case "ioc": return OrderTimeSpanEnum.Ioc; + case "opg": return OrderTimeSpanEnum.Am; + case "cls": return OrderTimeSpanEnum.Pm; + } + + return OrderTimeSpanEnum.None; + } + } +} diff --git a/Gateways/Alpaca/Libs/Messages/AccountActivityMessage.cs b/Gateways/Alpaca/Libs/Messages/AccountActivityMessage.cs index 9b284c91a..e53e238a9 100644 --- a/Gateways/Alpaca/Libs/Messages/AccountActivityMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/AccountActivityMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class AccountActivityMessage { diff --git a/Gateways/Alpaca/Libs/Messages/AccountConfigurationMessage.cs b/Gateways/Alpaca/Libs/Messages/AccountConfigurationMessage.cs index 95c7c3578..00639dfe5 100644 --- a/Gateways/Alpaca/Libs/Messages/AccountConfigurationMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/AccountConfigurationMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class AccountConfigurationMessage { diff --git a/Gateways/Alpaca/Libs/Messages/AccountMessage.cs b/Gateways/Alpaca/Libs/Messages/AccountMessage.cs index 40b050906..f17c72156 100644 --- a/Gateways/Alpaca/Libs/Messages/AccountMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/AccountMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class AccountMessage { diff --git a/Gateways/Alpaca/Libs/Messages/ActiveStockMessage.cs b/Gateways/Alpaca/Libs/Messages/ActiveStockMessage.cs index 9fa877dea..1401e8d1c 100644 --- a/Gateways/Alpaca/Libs/Messages/ActiveStockMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/ActiveStockMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class ActiveStockMessage { diff --git a/Gateways/Alpaca/Libs/Messages/ActiveStocksMessage.cs b/Gateways/Alpaca/Libs/Messages/ActiveStocksMessage.cs index 57ce40eb4..a1a3f7047 100644 --- a/Gateways/Alpaca/Libs/Messages/ActiveStocksMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/ActiveStocksMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class ActiveStocksMessage { diff --git a/Gateways/Alpaca/Libs/Messages/AnnouncementMessage.cs b/Gateways/Alpaca/Libs/Messages/AnnouncementMessage.cs index 949dda0c2..67f4407ef 100644 --- a/Gateways/Alpaca/Libs/Messages/AnnouncementMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/AnnouncementMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class AnnouncementMessage { diff --git a/Gateways/Alpaca/Libs/Messages/AssetMessage.cs b/Gateways/Alpaca/Libs/Messages/AssetMessage.cs index a78742796..24630828f 100644 --- a/Gateways/Alpaca/Libs/Messages/AssetMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/AssetMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class AssetMessage { diff --git a/Gateways/Alpaca/Libs/Messages/AuctionEntryMessage.cs b/Gateways/Alpaca/Libs/Messages/AuctionEntryMessage.cs index 8ecfcaee2..e3072a054 100644 --- a/Gateways/Alpaca/Libs/Messages/AuctionEntryMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/AuctionEntryMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class AuctionEntryMessage { diff --git a/Gateways/Alpaca/Libs/Messages/AuctionMessage.cs b/Gateways/Alpaca/Libs/Messages/AuctionMessage.cs index 2b661cdce..a7955e979 100644 --- a/Gateways/Alpaca/Libs/Messages/AuctionMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/AuctionMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class AuctionMessage { diff --git a/Gateways/Alpaca/Libs/Messages/AuctionsPageMessage.cs b/Gateways/Alpaca/Libs/Messages/AuctionsPageMessage.cs index b54ccb648..320dc2421 100644 --- a/Gateways/Alpaca/Libs/Messages/AuctionsPageMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/AuctionsPageMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class AuctionsPageMessage { diff --git a/Gateways/Alpaca/Libs/Messages/AuthRequestMessage.cs b/Gateways/Alpaca/Libs/Messages/AuthRequestMessage.cs index 2496dc6c3..b876cf201 100644 --- a/Gateways/Alpaca/Libs/Messages/AuthRequestMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/AuthRequestMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class AuthRequestMessage { diff --git a/Gateways/Alpaca/Libs/Messages/AuthResponseMessage.cs b/Gateways/Alpaca/Libs/Messages/AuthResponseMessage.cs index df02dabf4..d25d9f451 100644 --- a/Gateways/Alpaca/Libs/Messages/AuthResponseMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/AuthResponseMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class AuthResponseMessage { diff --git a/Gateways/Alpaca/Libs/Messages/AuthenticationMessage.cs b/Gateways/Alpaca/Libs/Messages/AuthenticationMessage.cs index 6eb072208..185ea34fb 100644 --- a/Gateways/Alpaca/Libs/Messages/AuthenticationMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/AuthenticationMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class AuthenticationMessage { diff --git a/Gateways/Alpaca/Libs/Messages/BarsPageMessage.cs b/Gateways/Alpaca/Libs/Messages/BarsPageMessage.cs index 9ecd00d77..da685514f 100644 --- a/Gateways/Alpaca/Libs/Messages/BarsPageMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/BarsPageMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class BarsPageMessage { diff --git a/Gateways/Alpaca/Libs/Messages/CalendarMessage.cs b/Gateways/Alpaca/Libs/Messages/CalendarMessage.cs index fbdfefedd..6efa49dc8 100644 --- a/Gateways/Alpaca/Libs/Messages/CalendarMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/CalendarMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class CalendarMessage { diff --git a/Gateways/Alpaca/Libs/Messages/ClockMessage.cs b/Gateways/Alpaca/Libs/Messages/ClockMessage.cs index 5c2c18971..71966f8cb 100644 --- a/Gateways/Alpaca/Libs/Messages/ClockMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/ClockMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class ClockMessage { diff --git a/Gateways/Alpaca/Libs/Messages/ConnectionSuccessMessage.cs b/Gateways/Alpaca/Libs/Messages/ConnectionSuccessMessage.cs index d9f69b520..3221569a1 100644 --- a/Gateways/Alpaca/Libs/Messages/ConnectionSuccessMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/ConnectionSuccessMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class ConnectionSuccessMessage { diff --git a/Gateways/Alpaca/Libs/Messages/CorrectionMessage.cs b/Gateways/Alpaca/Libs/Messages/CorrectionMessage.cs index 0a393fc1d..de538ce23 100644 --- a/Gateways/Alpaca/Libs/Messages/CorrectionMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/CorrectionMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class CorrectionMessage { diff --git a/Gateways/Alpaca/Libs/Messages/CryptoSnapshotMessage.cs b/Gateways/Alpaca/Libs/Messages/CryptoSnapshotMessage.cs index de6807db8..bc036e06c 100644 --- a/Gateways/Alpaca/Libs/Messages/CryptoSnapshotMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/CryptoSnapshotMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class CryptoSnapshotMessage { diff --git a/Gateways/Alpaca/Libs/Messages/ErrorMessage.cs b/Gateways/Alpaca/Libs/Messages/ErrorMessage.cs index 8a671c67b..b229de1f8 100644 --- a/Gateways/Alpaca/Libs/Messages/ErrorMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/ErrorMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class ErrorMessage { diff --git a/Gateways/Alpaca/Libs/Messages/HistoricalBarMessage.cs b/Gateways/Alpaca/Libs/Messages/HistoricalBarMessage.cs index 929a7abe3..1e2cc8173 100644 --- a/Gateways/Alpaca/Libs/Messages/HistoricalBarMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/HistoricalBarMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class HistoricalBarMessage { diff --git a/Gateways/Alpaca/Libs/Messages/HistoricalCryptoQuoteMessage.cs b/Gateways/Alpaca/Libs/Messages/HistoricalCryptoQuoteMessage.cs index b0ecee88e..6a0c7394a 100644 --- a/Gateways/Alpaca/Libs/Messages/HistoricalCryptoQuoteMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/HistoricalCryptoQuoteMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class HistoricalCryptoQuoteMessage { diff --git a/Gateways/Alpaca/Libs/Messages/HistoricalOrderBookMessage.cs b/Gateways/Alpaca/Libs/Messages/HistoricalOrderBookMessage.cs index fbff547b3..59fc05025 100644 --- a/Gateways/Alpaca/Libs/Messages/HistoricalOrderBookMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/HistoricalOrderBookMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class HistoricalOrderBookMessage { diff --git a/Gateways/Alpaca/Libs/Messages/HistoricalQuoteMessage.cs b/Gateways/Alpaca/Libs/Messages/HistoricalQuoteMessage.cs index 7d312a2d0..678a9b5bb 100644 --- a/Gateways/Alpaca/Libs/Messages/HistoricalQuoteMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/HistoricalQuoteMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class HistoricalQuoteMessage { diff --git a/Gateways/Alpaca/Libs/Messages/HistoricalTradeMessage.cs b/Gateways/Alpaca/Libs/Messages/HistoricalTradeMessage.cs index c15e03759..4beb0ad78 100644 --- a/Gateways/Alpaca/Libs/Messages/HistoricalTradeMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/HistoricalTradeMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class HistoricalTradeMessage { @@ -19,7 +19,7 @@ public class HistoricalTradeMessage public double? Size { get; set; } [JsonPropertyName("i")] - public double? TradeId { get; set; } + public string TradeId { get; set; } [JsonPropertyName("z")] public string Tape { get; set; } diff --git a/Gateways/Alpaca/Libs/Messages/JsonAccount.cs b/Gateways/Alpaca/Libs/Messages/JsonAccount.cs deleted file mode 100644 index 74e1db33b..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonAccount.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonAccount -{ - [JsonPropertyName("id")] - public string AccountId { get; set; } - - [JsonPropertyName("account_number")] - public string AccountNumber { get; set; } - - [JsonPropertyName("status")] - public string Status { get; set; } - - [JsonPropertyName("crypto_status")] - public string CryptoStatus { get; set; } - - [JsonPropertyName("currency")] - public string Currency { get; set; } - - [JsonPropertyName("cash")] - public double? TradableCash { get; set; } - - [JsonPropertyName("pattern_day_trader")] - public bool IsDayPatternTrader { get; set; } - - [JsonPropertyName("trading_blocked")] - public bool IsTradingBlocked { get; set; } - - [JsonPropertyName("transfers_blocked")] - public bool IsTransfersBlocked { get; set; } - - [JsonPropertyName("account_blocked")] - public bool IsAccountBlocked { get; set; } - - [JsonPropertyName("trade_suspended_by_user")] - public bool TradeSuspendedByUser { get; set; } - - [JsonPropertyName("shorting_enabled")] - public bool ShortingEnabled { get; set; } - - [JsonPropertyName("multiplier")] - public double? Multiplier { get; set; } - - [JsonPropertyName("buying_power")] - public double? BuyingPower { get; set; } - - [JsonPropertyName("daytrading_buying_power")] - public double? DayTradingBuyingPower { get; set; } - - [JsonPropertyName("non_maginable_buying_power")] - public double? NonMarginableBuyingPower { get; set; } - - [JsonPropertyName("regt_buying_power")] - public double? RegulationBuyingPower { get; set; } - - [JsonPropertyName("long_market_value")] - public double? LongMarketValue { get; set; } - - [JsonPropertyName("short_market_value")] - public double? ShortMarketValue { get; set; } - - [JsonPropertyName("equity")] - public double? Equity { get; set; } - - [JsonPropertyName("last_equity")] - public double? LastEquity { get; set; } - - [JsonPropertyName("initial_margin")] - public double? InitialMargin { get; set; } - - [JsonPropertyName("maintenance_margin")] - public double? MaintenanceMargin { get; set; } - - [JsonPropertyName("last_maintenance_margin")] - public double? LastMaintenanceMargin { get; set; } - - [JsonPropertyName("daytrade_count")] - public double? DayTradeCount { get; set; } - - [JsonPropertyName("sma")] - public double? Sma { get; set; } - - [JsonPropertyName("created_at")] - public DateTime? CreatedAtUtc { get; set; } - - [JsonPropertyName("accrued_fees")] - public double? AccruedFees { get; set; } - - [JsonPropertyName("pending_transfer_in")] - public double? PendingTransferIn { get; set; } - - [JsonPropertyName("pending_transfer_out")] - public double? PendingTransferOut { get; set; } - - [JsonPropertyName("options_trading_level")] - public string OptionsTradingLevel { get; set; } - - [JsonPropertyName("options_approved_level")] - public string OptionsApprovedLevel { get; set; } - - [JsonPropertyName("options_buying_power")] - public double? OptionsBuyingPower { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonAccountActivity.cs b/Gateways/Alpaca/Libs/Messages/JsonAccountActivity.cs deleted file mode 100644 index c46fa6cae..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonAccountActivity.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonAccountActivity -{ - [JsonPropertyName("activity_type")] - public string ActivityType { get; set; } - - [JsonPropertyName("id")] - public string ActivityId { get; set; } - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonIgnore] - public DateOnly? ActivityDate { get; set; } - - [JsonPropertyName("net_amount")] - public double? NetAmount { get; set; } - - [JsonPropertyName("per_share_amount")] - public double? PerShareAmount { get; set; } - - [JsonPropertyName("qty")] - public double? Quantity { get; set; } - - [JsonPropertyName("cum_qty")] - public double? CumulativeQuantity { get; set; } - - [JsonPropertyName("leaves_qty")] - public double? LeavesQuantity { get; set; } - - [JsonPropertyName("price")] - public double? Price { get; set; } - - [JsonPropertyName("side")] - public string Side { get; set; } - - [JsonPropertyName("type")] - public string Type { get; set; } - - [JsonPropertyName("date")] - public DateTime? ActivityDateTime { get; set; } - - [JsonIgnore] - public DateTime? ActivityDateTimeUtc { get; set; } - - [JsonPropertyName("transaction_time")] - public DateTime? TransactionTimeUtc { get; set; } - - [JsonIgnore] - public string ActivityGuid { get; set; } - - [JsonPropertyName("order_id")] - public string OrderId { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonAccountConfiguration.cs b/Gateways/Alpaca/Libs/Messages/JsonAccountConfiguration.cs deleted file mode 100644 index 7d93f1928..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonAccountConfiguration.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonAccountConfiguration -{ - [JsonPropertyName("dtbp_check")] - public string DayTradeMarginCallProtection { get; set; } - - [JsonPropertyName("trade_confirm_email")] - public string TradeConfirmEmail { get; set; } - - [JsonPropertyName("suspend_trade")] - public bool IsSuspendTrade { get; set; } - - [JsonPropertyName("no_shorting")] - public bool IsNoShorting { get; set; } - - [JsonPropertyName("ptp_no_exception_entry")] - public bool IsPtpNoExceptionEntry { get; set; } - - [JsonPropertyName("max_options_trading_level")] - public string MaxOptionsTradingLevel { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonActiveStock.cs b/Gateways/Alpaca/Libs/Messages/JsonActiveStock.cs deleted file mode 100644 index b754401bc..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonActiveStock.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonActiveStock -{ - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonPropertyName("volume")] - public double? Volume { get; set; } - - [JsonPropertyName("trade_count")] - public double? TradeCount { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonActiveStocks.cs b/Gateways/Alpaca/Libs/Messages/JsonActiveStocks.cs deleted file mode 100644 index 86491fbe2..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonActiveStocks.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonActiveStocks -{ - [JsonPropertyName("most_actives")] - public List MostActives { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonAnnouncement.cs b/Gateways/Alpaca/Libs/Messages/JsonAnnouncement.cs deleted file mode 100644 index d050f6556..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonAnnouncement.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonAnnouncement -{ - [JsonPropertyName("id")] - public string Id { get; set; } - - [JsonPropertyName("corporate_action_id")] - public string CorporateActionId { get; set; } - - [JsonPropertyName("ca_type")] - public string Type { get; set; } - - [JsonPropertyName("ca_sub_type")] - public string SubType { get; set; } - - [JsonPropertyName("initiating_symbol")] - public string InitiatingSymbol { get; set; } - - [JsonPropertyName("initiating_original_cusip")] - public string InitiatingCusip { get; set; } - - [JsonPropertyName("target_symbol")] - public string TargetSymbol { get; set; } - - [JsonPropertyName("target_original_cusip")] - public string TargetCusip { get; set; } - - [JsonPropertyName("declaration_date")] - public DateOnly? DeclarationDate { get; set; } - - [JsonPropertyName("ex_date")] - public DateOnly? ExecutionDate { get; set; } - - [JsonPropertyName("record_date")] - public DateOnly? RecordDate { get; set; } - - [JsonPropertyName("payable_date")] - public DateOnly? PayableDate { get; set; } - - [JsonPropertyName("cash")] - public double? Cash { get; set; } - - [JsonPropertyName("old_rate")] - public double? OldRate { get; set; } - - [JsonPropertyName("new_rate")] - public double? NewRate { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonAsset.cs b/Gateways/Alpaca/Libs/Messages/JsonAsset.cs deleted file mode 100644 index 63895dc02..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonAsset.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonAsset -{ - [JsonPropertyName("id")] - public string AssetId { get; set; } - - [JsonPropertyName("class")] - public string Class { get; set; } - - [JsonPropertyName("exchange")] - public string Exchange { get; set; } - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonPropertyName("name")] - public string Name { get; set; } - - [JsonPropertyName("status")] - public string Status { get; set; } - - [JsonPropertyName("tradable")] - public bool IsTradable { get; set; } - - [JsonPropertyName("marginable")] - public bool Marginable { get; set; } - - [JsonPropertyName("shortable")] - public bool Shortable { get; set; } - - [JsonPropertyName("easy_to_borrow")] - public bool EasyToBorrow { get; set; } - - [JsonPropertyName("fractionable")] - public bool Fractionable { get; set; } - - [JsonPropertyName("min_order_size")] - public double? MinOrderSize { get; set; } - - [JsonPropertyName("min_trade_increment")] - public double? MinTradeIncrement { get; set; } - - [JsonPropertyName("price_increment")] - public double? PriceIncrement { get; set; } - - [JsonPropertyName("maintenance_margin_requirement")] - public double? MaintenanceMarginRequirement { get; set; } - - [JsonPropertyName("attributes")] - public List AttributesList { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonAuction.cs b/Gateways/Alpaca/Libs/Messages/JsonAuction.cs deleted file mode 100644 index d863426b8..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonAuction.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonAuction -{ - [JsonPropertyName("d")] - internal DateTime? DateTime { get; set; } - - [JsonPropertyName("o")] - internal List OpeningsList { get; set; } = []; - - [JsonPropertyName("c")] - internal List ClosingsList { get; set; } = []; - - [JsonIgnore] - public string Symbol { get; set; } - - [JsonIgnore] - public List Openings { get; set; } = []; - - [JsonIgnore] - public List Closings { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonAuctionEntry.cs b/Gateways/Alpaca/Libs/Messages/JsonAuctionEntry.cs deleted file mode 100644 index 08d514fa2..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonAuctionEntry.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonAuctionEntry -{ - [JsonPropertyName("t")] - public DateTime? TimestampUtc { get; set; } - - [JsonPropertyName("p")] - public double? Price { get; set; } - - [JsonPropertyName("s")] - public double? Size { get; set; } - - [JsonPropertyName("x")] - public string Exchange { get; set; } - - [JsonPropertyName("c")] - public string Condition { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonAuctionsPage.cs b/Gateways/Alpaca/Libs/Messages/JsonAuctionsPage.cs deleted file mode 100644 index 5d01b8f31..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonAuctionsPage.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonAuctionsPage -{ - [JsonPropertyName("auctions")] - public List ItemsList { get; set; } = []; - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonPropertyName("next_page_token")] - public string NextPageToken { get; set; } - - [JsonIgnore] - public List Items { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonAuthRequest.cs b/Gateways/Alpaca/Libs/Messages/JsonAuthRequest.cs deleted file mode 100644 index d080500af..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonAuthRequest.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonAuthRequest -{ - public class JsonData - { - [JsonPropertyName("key_id")] - public string KeyId { get; set; } - - [JsonPropertyName("secret_key")] - public string SecretKey { get; set; } - - [JsonPropertyName("oauth_token")] - public string OAuthToken { get; set; } - } - - [JsonPropertyName("action")] - public string Action { get; set; } - - [JsonPropertyName("data")] - public JsonData Data { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonAuthResponse.cs b/Gateways/Alpaca/Libs/Messages/JsonAuthResponse.cs deleted file mode 100644 index a73aca2ef..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonAuthResponse.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonAuthResponse -{ - [JsonPropertyName("status")] - public string Status { get; set; } - - [JsonPropertyName("message")] - public string Message { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonAuthentication.cs b/Gateways/Alpaca/Libs/Messages/JsonAuthentication.cs deleted file mode 100644 index b3d939f68..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonAuthentication.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonAuthentication -{ - [JsonPropertyName("action")] - public string Action { get; set; } - - [JsonPropertyName("key")] - public string KeyId { get; set; } - - [JsonPropertyName("secret")] - public string SecretKey { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonBarsPage.cs b/Gateways/Alpaca/Libs/Messages/JsonBarsPage.cs deleted file mode 100644 index 29e2f862f..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonBarsPage.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonBarsPage -{ - [JsonPropertyName("bars")] - public List ItemsList { get; set; } = []; - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonPropertyName("next_page_token")] - public string NextPageToken { get; set; } - - [JsonIgnore] - public List Items { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonCalendar.cs b/Gateways/Alpaca/Libs/Messages/JsonCalendar.cs deleted file mode 100644 index 368111e9d..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonCalendar.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonCalendar -{ - [JsonPropertyName("date")] - public DateOnly? TradingDate { get; set; } - - [JsonPropertyName("open")] - public TimeOnly? TradingOpen { get; set; } - - [JsonPropertyName("close")] - public TimeOnly? TradingClose { get; set; } - - [JsonPropertyName("session_open")] - public TimeOnly? SessionOpen { get; set; } - - [JsonPropertyName("session_close")] - public TimeOnly? SessionClose { get; set; } - - [JsonIgnore] - public string Trading { get; private set; } - - [JsonIgnore] - public string Session { get; private set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonClock.cs b/Gateways/Alpaca/Libs/Messages/JsonClock.cs deleted file mode 100644 index a345db994..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonClock.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonClock -{ - [JsonPropertyName("timestamp")] - public DateTime? TimestampUtc { get; set; } - - [JsonPropertyName("is_open")] - public bool IsOpen { get; set; } - - [JsonPropertyName("next_open")] - public DateTime? NextOpenUtc { get; set; } - - [JsonPropertyName("next_close")] - public DateTime? NextCloseUtc { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonConnectionSuccess.cs b/Gateways/Alpaca/Libs/Messages/JsonConnectionSuccess.cs deleted file mode 100644 index ed7e79f5a..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonConnectionSuccess.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonConnectionSuccess -{ - [JsonPropertyName("msg")] - public string Status { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonCorrection.cs b/Gateways/Alpaca/Libs/Messages/JsonCorrection.cs deleted file mode 100644 index 3da7a1673..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonCorrection.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonCorrection -{ - [JsonPropertyName("x")] - public string Exchange { get; set; } - - [JsonPropertyName("z")] - public string Tape { get; set; } - - [JsonPropertyName("u")] - public string Update { get; set; } - - [JsonPropertyName("oi")] - public double? TradeId { get; set; } - - [JsonPropertyName("op")] - public double? Price { get; set; } - - [JsonPropertyName("os")] - public double? Size { get; set; } - - [JsonPropertyName("oc")] - public List ConditionsList { get; set; } = []; - - [JsonPropertyName("ci")] - public double? CorrectedTradeId { get; set; } - - [JsonPropertyName("cp")] - public double? CorrectedPrice { get; set; } - - [JsonPropertyName("cs")] - public double? CorrectedSize { get; set; } - - [JsonPropertyName("tks")] - public string TakerSide { get; set; } - - [JsonIgnore] - public JsonRealTimeTrade CorrectedTrade { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonCryptoSnapshot.cs b/Gateways/Alpaca/Libs/Messages/JsonCryptoSnapshot.cs deleted file mode 100644 index 0362c66e5..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonCryptoSnapshot.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonCryptoSnapshot -{ - [JsonPropertyName("latestQuote")] - public JsonHistoricalCryptoQuote JsonQuote { get; set; } - - [JsonPropertyName("latestTrade")] - public JsonHistoricalTrade JsonTrade { get; set; } - - [JsonPropertyName("minuteBar")] - public JsonHistoricalBar JsonMinuteBar { get; set; } - - [JsonPropertyName("dailyBar")] - public JsonHistoricalBar JsonCurrentDailyBar { get; set; } - - [JsonPropertyName("prevDailyBar")] - public JsonHistoricalBar JsonPreviousDailyBar { get; set; } - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonError.cs b/Gateways/Alpaca/Libs/Messages/JsonError.cs deleted file mode 100644 index 333d1cac2..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonError.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonError -{ - [JsonPropertyName("code")] - public int? Code { get; set; } - - [JsonPropertyName("message")] - public string Message { get; set; } - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonPropertyName("open_orders")] - public int? OpenOrdersCount { get; set; } - - [JsonPropertyName("day_trading_buying_power")] - public double? DayTradingBuyingPower { get; set; } - - [JsonPropertyName("max_dtbp_used")] - public double? MaxDayTradingBuyingPowerUsed { get; set; } - - [JsonPropertyName("max_dtbp_used_so_far")] - public double? MaxDayTradingBuyingPowerUsedSoFar { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonHistoricalBar.cs b/Gateways/Alpaca/Libs/Messages/JsonHistoricalBar.cs deleted file mode 100644 index 43b1c6b0a..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonHistoricalBar.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonHistoricalBar -{ - [JsonIgnore] - public string Symbol { get; set; } - - [JsonPropertyName("o")] - public double? Open { get; set; } - - [JsonPropertyName("c")] - public double? Close { get; set; } - - [JsonPropertyName("l")] - public double? Low { get; set; } - - [JsonPropertyName("h")] - public double? High { get; set; } - - [JsonPropertyName("v")] - public double? Volume { get; set; } - - [JsonPropertyName("t")] - public DateTime? TimeUtc { get; set; } - - [JsonPropertyName("vw")] - public double? Vwap { get; set; } - - [JsonPropertyName("n")] - public int TradeCount { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonHistoricalCryptoQuote.cs b/Gateways/Alpaca/Libs/Messages/JsonHistoricalCryptoQuote.cs deleted file mode 100644 index b8e361eda..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonHistoricalCryptoQuote.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonHistoricalCryptoQuote -{ - [JsonPropertyName("t")] - public DateTime? TimestampUtc { get; set; } - - [JsonPropertyName("x")] - public string AskExchange { get; set; } - - [JsonPropertyName("ap")] - public double? AskPrice { get; set; } - - [JsonPropertyName("as")] - public double? AskSize { get; set; } - - [JsonPropertyName("bp")] - public double? BidPrice { get; set; } - - [JsonPropertyName("bs")] - public double? BidSize { get; set; } - - [JsonIgnore] - public string Symbol { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonHistoricalOrderBook.cs b/Gateways/Alpaca/Libs/Messages/JsonHistoricalOrderBook.cs deleted file mode 100644 index fc7e07799..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonHistoricalOrderBook.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonHistoricalOrderBook -{ - [JsonPropertyName("t")] - public DateTime? TimestampUtc { get; set; } - - [JsonPropertyName("b")] - public List BidsList { get; set; } = []; - - [JsonPropertyName("a")] - public List AsksList { get; set; } = []; - - [JsonIgnore] - public string Symbol { get; set; } - - [JsonIgnore] - public List Bids { get; set; } = []; - - [JsonIgnore] - public List Asks { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonHistoricalQuote.cs b/Gateways/Alpaca/Libs/Messages/JsonHistoricalQuote.cs deleted file mode 100644 index 4090cb49b..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonHistoricalQuote.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonHistoricalQuote -{ - [JsonPropertyName("t")] - public DateTime? TimestampUtc { get; set; } - - [JsonPropertyName("ax")] - public string AskExchange { get; set; } - - [JsonPropertyName("ap")] - public double? AskPrice { get; set; } - - [JsonPropertyName("as")] - public double? AskSize { get; set; } - - [JsonPropertyName("bx")] - public string BidExchange { get; set; } - - [JsonPropertyName("bp")] - public double? BidPrice { get; set; } - - [JsonPropertyName("bs")] - public double? BidSize { get; set; } - - [JsonPropertyName("c")] - public List ConditionsList { get; set; } = []; - - [JsonPropertyName("z")] - public string Tape { get; set; } - - [JsonPropertyName("S")] - public string Symbol { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonHistoricalTrade.cs b/Gateways/Alpaca/Libs/Messages/JsonHistoricalTrade.cs deleted file mode 100644 index 2b7de3fd8..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonHistoricalTrade.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonHistoricalTrade -{ - [JsonPropertyName("t")] - public DateTime? TimestampUtc { get; set; } - - [JsonPropertyName("x")] - public string Exchange { get; set; } - - [JsonPropertyName("p")] - public double? Price { get; set; } - - [JsonPropertyName("s")] - public double? Size { get; set; } - - [JsonPropertyName("i")] - public double? TradeId { get; set; } - - [JsonPropertyName("z")] - public string Tape { get; set; } - - [JsonPropertyName("u")] - public string Update { get; set; } - - [JsonPropertyName("c")] - public List ConditionsList { get; set; } = []; - - [JsonPropertyName("tks")] - public string TakerSide { get; set; } - - [JsonIgnore] - public string Symbol { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonLatestBar.cs b/Gateways/Alpaca/Libs/Messages/JsonLatestBar.cs deleted file mode 100644 index c85c40676..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonLatestBar.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonLatestBar -{ - [JsonPropertyName("bar")] - public JsonHistoricalBar Nested { get; set; } - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonLatestBestBidOffer.cs b/Gateways/Alpaca/Libs/Messages/JsonLatestBestBidOffer.cs deleted file mode 100644 index 87110d724..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonLatestBestBidOffer.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonLatestBestBidOffer -{ - [JsonPropertyName("xbbo")] - public JsonHistoricalQuote Nested { get; set; } - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonLatestData.cs b/Gateways/Alpaca/Libs/Messages/JsonLatestData.cs deleted file mode 100644 index 04bbfe768..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonLatestData.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonLatestData -{ - [JsonPropertyName("quotes")] - public Dictionary Quotes { get; set; } = []; - - [JsonPropertyName("bars")] - public Dictionary Bars { get; set; } = []; - - [JsonPropertyName("trades")] - public Dictionary Trades { get; set; } = []; - - [JsonPropertyName("snapshots")] - public Dictionary Snapshots { get; set; } = []; - - [JsonPropertyName("orderbooks")] - public Dictionary OrderBooks { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonLatestQuote.cs b/Gateways/Alpaca/Libs/Messages/JsonLatestQuote.cs deleted file mode 100644 index bac23e056..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonLatestQuote.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonLatestQuote -{ - [JsonPropertyName("quote")] - public TQuote Nested { get; set; } - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonLatestTrade.cs b/Gateways/Alpaca/Libs/Messages/JsonLatestTrade.cs deleted file mode 100644 index b1d07f74f..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonLatestTrade.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonLatestTrade -{ - [JsonPropertyName("trade")] - public JsonHistoricalTrade Nested { get; set; } - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonLimitUpLimitDown.cs b/Gateways/Alpaca/Libs/Messages/JsonLimitUpLimitDown.cs deleted file mode 100644 index 55bf4f8c0..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonLimitUpLimitDown.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonLimitUpLimitDown -{ - [JsonPropertyName("u")] - public double? LimitUpPrice { get; set; } - - [JsonPropertyName("d")] - public double? LimitDownPrice { get; set; } - - [JsonPropertyName("i")] - public string Indicator { get; set; } - - [JsonPropertyName("z")] - public string Tape { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonListenRequest.cs b/Gateways/Alpaca/Libs/Messages/JsonListenRequest.cs deleted file mode 100644 index 7e049a500..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonListenRequest.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonListenRequest -{ - public class JsonData - { - [JsonPropertyName("streams")] - public List Streams { get; set; } = []; - } - - [JsonPropertyName("action")] - public string Action { get; set; } - - [JsonPropertyName("data")] - public JsonData Data { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonMarketMover.cs b/Gateways/Alpaca/Libs/Messages/JsonMarketMover.cs deleted file mode 100644 index 42ecf0201..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonMarketMover.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonMarketMover -{ - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonPropertyName("price")] - public double? Price { get; set; } - - [JsonPropertyName("change")] - public double? Change { get; set; } - - [JsonPropertyName("percent_change")] - public double? PercentChange { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonMarketMovers.cs b/Gateways/Alpaca/Libs/Messages/JsonMarketMovers.cs deleted file mode 100644 index 56dc6af18..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonMarketMovers.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonMarketMovers -{ - [JsonPropertyName("losers")] - public List LosersList { get; set; } = []; - - [JsonPropertyName("gainers")] - public List GainersList { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonMultiAuctionsPage.cs b/Gateways/Alpaca/Libs/Messages/JsonMultiAuctionsPage.cs deleted file mode 100644 index 5353f8107..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonMultiAuctionsPage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonMultiAuctionsPage -{ - [JsonPropertyName("auctions")] - public Dictionary> ItemsDictionary { get; set; } = []; - - [JsonPropertyName("next_page_token")] - public string NextPageToken { get; set; } - - [JsonIgnore] - public Dictionary> Items { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonMultiBarsPage.cs b/Gateways/Alpaca/Libs/Messages/JsonMultiBarsPage.cs deleted file mode 100644 index c3eca84f7..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonMultiBarsPage.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonMultiBarsPage -{ - [JsonPropertyName("bars")] - public Dictionary> ItemsDictionary { get; set; } = []; - - [JsonPropertyName("next_page_token")] - public string NextPageToken { get; set; } - - [JsonIgnore] - public Dictionary> Items { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonMultiQuotesPage.cs b/Gateways/Alpaca/Libs/Messages/JsonMultiQuotesPage.cs deleted file mode 100644 index 517740831..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonMultiQuotesPage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonMultiQuotesPage -{ - [JsonPropertyName("quotes")] - public Dictionary> ItemsDictionary { get; set; } = []; - - [JsonPropertyName("next_page_token")] - public string NextPageToken { get; set; } - - [JsonIgnore] - public Dictionary> Items { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonMultiTradesPage.cs b/Gateways/Alpaca/Libs/Messages/JsonMultiTradesPage.cs deleted file mode 100644 index ae40f9b1b..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonMultiTradesPage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonMultiTradesPage -{ - [JsonPropertyName("trades")] - public Dictionary> ItemsDictionary { get; set; } = []; - - [JsonPropertyName("next_page_token")] - public string NextPageToken { get; set; } - - [JsonIgnore] - public Dictionary> Items { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonNewOrder.cs b/Gateways/Alpaca/Libs/Messages/JsonNewOrder.cs deleted file mode 100644 index a2a7bbbe2..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonNewOrder.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonNewOrder -{ - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonPropertyName("qty")] - public double? Quantity { get; set; } - - [JsonPropertyName("notional")] - public double? Notional { get; set; } - - [JsonPropertyName("side")] - public string OrderSide { get; set; } - - [JsonPropertyName("type")] - public string OrderType { get; set; } - - [JsonPropertyName("time_in_force")] - public string TimeInForce { get; set; } - - [JsonPropertyName("limit_price")] - public double? LimitPrice { get; set; } - - [JsonPropertyName("stop_price")] - public double? StopPrice { get; set; } - - [JsonPropertyName("trail_price")] - public double? TrailOffsetInDollars { get; set; } - - [JsonPropertyName("trail_percent")] - public double? TrailOffsetInPercent { get; set; } - - [JsonPropertyName("client_order_id")] - public string ClientOrderId { get; set; } - - [JsonPropertyName("extended_hours")] - public bool? ExtendedHours { get; set; } - - [JsonPropertyName("order_class")] - public string OrderClass { get; set; } - - [JsonPropertyName("take_profit")] - public JsonNewOrderAdvancedAttributes TakeProfit { get; set; } - - [JsonPropertyName("stop_loss")] - public JsonNewOrderAdvancedAttributes StopLoss { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonNewOrderAdvancedAttributes.cs b/Gateways/Alpaca/Libs/Messages/JsonNewOrderAdvancedAttributes.cs deleted file mode 100644 index 4af82df7b..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonNewOrderAdvancedAttributes.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonNewOrderAdvancedAttributes -{ - [JsonPropertyName("limit_price")] - public double? LimitPrice { get; set; } - - [JsonPropertyName("stop_price")] - public double? StopPrice { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonNewsArticle.cs b/Gateways/Alpaca/Libs/Messages/JsonNewsArticle.cs deleted file mode 100644 index fcfd4f40e..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonNewsArticle.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonNewsArticle -{ - public class Image - { - [JsonPropertyName("size")] - public string Size { get; set; } - - [JsonPropertyName("url")] - public Uri Url { get; set; } - } - - [JsonPropertyName("id")] - public double? Id { get; set; } - - [JsonPropertyName("headline")] - public string Headline { get; set; } - - [JsonPropertyName("created_at")] - public DateTime? CreatedAtUtc { get; set; } - - [JsonPropertyName("updated_at")] - public DateTime? UpdatedAtUtc { get; set; } - - [JsonPropertyName("author")] - public string Author { get; set; } - - [JsonPropertyName("summary")] - public string Summary { get; set; } - - [JsonPropertyName("content")] - public string Content { get; set; } - - [JsonPropertyName("url")] - public Uri ArticleUrl { get; set; } - - [JsonPropertyName("source")] - public string Source { get; set; } - - [JsonPropertyName("symbols")] - public List SymbolsList { get; set; } = []; - - [JsonPropertyName("images")] - public List Images { get; set; } = []; - - [JsonIgnore] - public Uri SmallImageUrl { get; set; } - - [JsonIgnore] - public Uri LargeImageUrl { get; set; } - - [JsonIgnore] - public Uri ThumbImageUrl { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonNewsPage.cs b/Gateways/Alpaca/Libs/Messages/JsonNewsPage.cs deleted file mode 100644 index 8fc39fcb9..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonNewsPage.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonNewsPage -{ - [JsonPropertyName("news")] - public List ItemsList { get; set; } = []; - - [JsonPropertyName("next_page_token")] - public string NextPageToken { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonOptionContract.cs b/Gateways/Alpaca/Libs/Messages/JsonOptionContract.cs deleted file mode 100644 index e9f417e79..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonOptionContract.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonOptionContract -{ - [JsonPropertyName("id")] - public string ContractId { get; set; } - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonPropertyName("name")] - public string Name { get; set; } - - [JsonPropertyName("status")] - public string Status { get; set; } - - [JsonPropertyName("tradable")] - public bool IsTradable { get; set; } - - [JsonPropertyName("size")] - public double? Size { get; set; } - - [JsonPropertyName("type")] - public string OptionType { get; } - - [JsonPropertyName("strike_price")] - public double? StrikePrice { get; set; } - - [JsonPropertyName("expiration_date")] - public DateOnly? ExpirationDate { get; set; } - - [JsonPropertyName("style")] - public string OptionStyle { get; } - - [JsonPropertyName("root_symbol")] - public string RootSymbol { get; set; } - - [JsonPropertyName("underlying_symbol")] - public string UnderlyingSymbol { get; set; } - - [JsonPropertyName("underlying_asset_id")] - public string UnderlyingAssetId { get; set; } - - [JsonPropertyName("open_interest")] - public double? OpenInterest { get; set; } - - [JsonPropertyName("open_interest_date")] - public DateOnly? OpenInterestDate { get; set; } - - [JsonPropertyName("close_price")] - public double? ClosePrice { get; set; } - - [JsonPropertyName("close_price_date")] - public DateOnly? ClosePriceDate { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonOptionContractsPage.cs b/Gateways/Alpaca/Libs/Messages/JsonOptionContractsPage.cs deleted file mode 100644 index 7d64f4254..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonOptionContractsPage.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonOptionContractsPage -{ - [JsonPropertyName("option_contracts")] - public List Contracts { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonOptionQuote.cs b/Gateways/Alpaca/Libs/Messages/JsonOptionQuote.cs deleted file mode 100644 index fdcd9cc23..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonOptionQuote.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonOptionQuote -{ - [JsonPropertyName("t")] - public DateTime? TimestampUtc { get; set; } - - [JsonPropertyName("ax")] - public string AskExchange { get; set; } - - [JsonPropertyName("ap")] - public double? AskPrice { get; set; } - - [JsonPropertyName("as")] - public double? AskSize { get; set; } - - [JsonPropertyName("bx")] - public string BidExchange { get; set; } - - [JsonPropertyName("bp")] - public double? BidPrice { get; set; } - - [JsonPropertyName("bs")] - public double? BidSize { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonOptionSnapshot.cs b/Gateways/Alpaca/Libs/Messages/JsonOptionSnapshot.cs deleted file mode 100644 index 8d3a46a97..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonOptionSnapshot.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonOptionSnapshot -{ - [JsonPropertyName("latestQuote")] - public JsonOptionQuote JsonQuote { get; set; } - - [JsonPropertyName("latestTrade")] - public JsonOptionTrade JsonTrade { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonOptionTrade.cs b/Gateways/Alpaca/Libs/Messages/JsonOptionTrade.cs deleted file mode 100644 index edb398cb1..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonOptionTrade.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonOptionTrade -{ - [JsonPropertyName("t")] - public DateTime? TimestampUtc { get; set; } - - [JsonPropertyName("x")] - public string Exchange { get; set; } - - [JsonPropertyName("p")] - public double? Price { get; set; } - - [JsonPropertyName("s")] - public double? Size { get; set; } - - [JsonIgnore] - public string Symbol { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonOrder.cs b/Gateways/Alpaca/Libs/Messages/JsonOrder.cs deleted file mode 100644 index b1fe6aec8..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonOrder.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonOrder -{ - [JsonPropertyName("id")] - public string OrderId { get; set; } - - [JsonPropertyName("client_order_id")] - public string ClientOrderId { get; set; } - - [JsonPropertyName("created_at")] - - public DateTime? CreatedAtUtc { get; set; } - - [JsonPropertyName("updated_at")] - - public DateTime? UpdatedAtUtc { get; set; } - - [JsonPropertyName("submitted_at")] - - public DateTime? SubmittedAtUtc { get; set; } - - [JsonPropertyName("filled_at")] - - public DateTime? FilledAtUtc { get; set; } - - [JsonPropertyName("expired_at ")] - - public DateTime? ExpiredAtUtc { get; set; } - - [JsonPropertyName("canceled_at")] - - public DateTime? CancelledAtUtc { get; set; } - - [JsonPropertyName("failed_at")] - - public DateTime? FailedAtUtc { get; set; } - - [JsonPropertyName("replaced_at")] - - public DateTime? ReplacedAtUtc { get; set; } - - [JsonPropertyName("asset_id")] - public string AssetId { get; set; } - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } = string.Empty; - - [JsonPropertyName("asset_class")] - public string AssetClass { get; set; } - - [JsonPropertyName("notional")] - public double? Notional { get; set; } - - [JsonPropertyName("qty")] - public double? Quantity { get; set; } - - [JsonPropertyName("filled_qty")] - public double? FilledQuantity { get; set; } - - [JsonPropertyName("type")] - public string OrderType { get; set; } - - [JsonPropertyName("order_class")] - public string OrderClass { get; set; } - - [JsonPropertyName("side")] - public string OrderSide { get; set; } - - [JsonPropertyName("time_in_force")] - public string TimeInForce { get; set; } - - [JsonPropertyName("limit_price")] - public double? LimitPrice { get; set; } - - [JsonPropertyName("stop_price")] - public double? StopPrice { get; set; } - - [JsonPropertyName("trail_price")] - public double? TrailOffsetInDollars { get; set; } - - [JsonPropertyName("trail_percent")] - public double? TrailOffsetInPercent { get; set; } - - [JsonPropertyName("hwm")] - public double? HighWaterMark { get; set; } - - [JsonPropertyName("filled_avg_price")] - public double? AverageFillPrice { get; set; } - - [JsonPropertyName("status")] - public string OrderStatus { get; set; } - - [JsonPropertyName("replaced_by")] - public string ReplacedByOrderId { get; set; } - - [JsonPropertyName("replaces")] - public string ReplacesOrderId { get; set; } - - [JsonPropertyName("legs")] - public List LegsList { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonOrderActionStatus.cs b/Gateways/Alpaca/Libs/Messages/JsonOrderActionStatus.cs deleted file mode 100644 index ef3f47a95..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonOrderActionStatus.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonOrderActionStatus -{ - [JsonPropertyName("id")] - public string OrderId { get; set; } - - [JsonPropertyName("status")] - public double? StatusCode { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonOrderBookEntry.cs b/Gateways/Alpaca/Libs/Messages/JsonOrderBookEntry.cs deleted file mode 100644 index 648f7fbd7..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonOrderBookEntry.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonOrderBookEntry -{ - [JsonPropertyName("p")] - public double? Price { get; set; } - - [JsonPropertyName("s")] - public double? Size { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonPortfolioHistory.cs b/Gateways/Alpaca/Libs/Messages/JsonPortfolioHistory.cs deleted file mode 100644 index 83c289dcb..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonPortfolioHistory.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonPortfolioHistory -{ - public class Item - { - public double? Equity { get; set; } - - public double? ProfitLoss { get; set; } - - public double? ProfitLossPercentage { get; set; } - - public DateTime? TimestampUtc { get; set; } - } - - [JsonPropertyName("equity")] - public List EquityList { get; set; } = []; - - [JsonPropertyName("profit_loss")] - public List ProfitLossList { get; set; } = []; - - [JsonPropertyName("profit_loss_pct")] - public List ProfitLossPercentageList { get; set; } = []; - - [JsonPropertyName("timestamp")] - public List TimestampsList { get; set; } = []; - - [JsonPropertyName("timeframe")] - public string TimeFrame { get; set; } - - [JsonPropertyName("base_value")] - public double? BaseValue { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonPosition.cs b/Gateways/Alpaca/Libs/Messages/JsonPosition.cs deleted file mode 100644 index 7a5c47e75..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonPosition.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonPosition -{ - [JsonPropertyName("asset_id")] - public string AssetId { get; set; } - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonPropertyName("exchange")] - public string Exchange { get; set; } - - [JsonPropertyName("asset_class")] - public string AssetClass { get; set; } - - [JsonPropertyName("avg_entry_price")] - public double? AverageEntryPrice { get; set; } - - [JsonPropertyName("qty")] - public double? Quantity { get; set; } - - [JsonPropertyName("qty_available")] - public double? AvailableQuantity { get; set; } - - [JsonPropertyName("side")] - public string Side { get; set; } - - [JsonPropertyName("market_value")] - public double? MarketValue { get; set; } - - [JsonPropertyName("cost_basis")] - public double? CostBasis { get; set; } - - [JsonPropertyName("unrealized_pl")] - public double? UnrealizedProfitLoss { get; set; } - - [JsonPropertyName("unrealized_plpc")] - public double? UnrealizedProfitLossPercent { get; set; } - - [JsonPropertyName("unrealized_intraday_pl")] - public double? IntradayUnrealizedProfitLoss { get; set; } - - [JsonPropertyName("unrealized_intraday_plpc")] - public double? IntradayUnrealizedProfitLossPercent { get; set; } - - [JsonPropertyName("current_price")] - public double? AssetCurrentPrice { get; set; } - - [JsonPropertyName("lastday_price")] - public double? AssetLastPrice { get; set; } - - [JsonPropertyName("change_today")] - public double? AssetChangePercent { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonPositionActionStatus.cs b/Gateways/Alpaca/Libs/Messages/JsonPositionActionStatus.cs deleted file mode 100644 index 1d8b1ad75..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonPositionActionStatus.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonPositionActionStatus -{ - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonPropertyName("status")] - public double? StatusCode { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonQuotesPage.cs b/Gateways/Alpaca/Libs/Messages/JsonQuotesPage.cs deleted file mode 100644 index 55832a0c6..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonQuotesPage.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonQuotesPage -{ - [JsonPropertyName("quotes")] - public List ItemsList { get; set; } = []; - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonPropertyName("next_page_token")] - public string NextPageToken { get; set; } - - [JsonIgnore] - public List Items { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonRealTimeBar.cs b/Gateways/Alpaca/Libs/Messages/JsonRealTimeBar.cs deleted file mode 100644 index 5021a8c03..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonRealTimeBar.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonRealTimeBar -{ - [JsonPropertyName("o")] - public double? Open { get; set; } - - [JsonPropertyName("h")] - public double? High { get; set; } - - [JsonPropertyName("l")] - public double? Low { get; set; } - - [JsonPropertyName("c")] - public double? Close { get; set; } - - [JsonPropertyName("v")] - public double? Volume { get; set; } - - [JsonPropertyName("vw")] - public double? Vwap { get; set; } - - [JsonPropertyName("n")] - public int TradeCount { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonRealTimeBase.cs b/Gateways/Alpaca/Libs/Messages/JsonRealTimeBase.cs deleted file mode 100644 index 0b3e0434e..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonRealTimeBase.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonRealTimeBase -{ - [JsonPropertyName("T")] - public string Channel { get; set; } - - [JsonPropertyName("S")] - public string Symbol { get; set; } - - [JsonPropertyName("t")] - public DateTime? TimestampUtc { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonRealTimeCryptoQuote.cs b/Gateways/Alpaca/Libs/Messages/JsonRealTimeCryptoQuote.cs deleted file mode 100644 index e6956474c..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonRealTimeCryptoQuote.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonRealTimeCryptoQuote -{ - [JsonPropertyName("x")] - public string BidExchange { get; set; } - - [JsonPropertyName("bp")] - public double? BidPrice { get; set; } - - [JsonPropertyName("ap")] - public double? AskPrice { get; set; } - - [JsonPropertyName("bs")] - public double? BidSize { get; set; } - - [JsonPropertyName("as")] - public double? AskSize { get; set; } - - [JsonPropertyName("c")] - public List ConditionsList { get; set; } = []; - - [JsonPropertyName("z")] - public string Tape { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonRealTimeOrderBook.cs b/Gateways/Alpaca/Libs/Messages/JsonRealTimeOrderBook.cs deleted file mode 100644 index fc397ac4f..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonRealTimeOrderBook.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonRealTimeOrderBook -{ - [JsonPropertyName("x")] - public string Exchange { get; set; } - - [JsonPropertyName("b")] - public List BidsList { get; set; } = []; - - [JsonPropertyName("a")] - public List AsksList { get; set; } = []; - - [JsonPropertyName("r")] - public bool IsReset { get; set; } - - [JsonIgnore] - public List Bids { get; set; } = []; - - [JsonIgnore] - public List Asks { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonRealTimeQuote.cs b/Gateways/Alpaca/Libs/Messages/JsonRealTimeQuote.cs deleted file mode 100644 index db8dee1b5..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonRealTimeQuote.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonRealTimeQuote -{ - [JsonPropertyName("bx")] - public string BidExchange { get; set; } - - [JsonPropertyName("ax")] - public string AskExchange { get; set; } - - [JsonPropertyName("bp")] - public double? BidPrice { get; set; } - - [JsonPropertyName("ap")] - public double? AskPrice { get; set; } - - [JsonPropertyName("bs")] - public double? BidSize { get; set; } - - [JsonPropertyName("as")] - public double? AskSize { get; set; } - - [JsonPropertyName("c")] - public List ConditionsList { get; set; } = []; - - [JsonPropertyName("z")] - public string Tape { get; set; } - - [JsonPropertyName("S")] - public string Symbol { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonRealTimeTrade.cs b/Gateways/Alpaca/Libs/Messages/JsonRealTimeTrade.cs deleted file mode 100644 index 8cce68e3c..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonRealTimeTrade.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonRealTimeTrade -{ - [JsonPropertyName("i")] - public string TradeId { get; set; } - - [JsonPropertyName("x")] - public string Exchange { get; set; } - - [JsonPropertyName("z")] - public string Tape { get; set; } - - [JsonPropertyName("p")] - public double? Price { get; set; } - - [JsonPropertyName("s")] - public double? Size { get; set; } - - [JsonPropertyName("c")] - public List ConditionsList { get; set; } = []; - - [JsonPropertyName("tks")] - public string TakerSide { get; set; } - - [JsonPropertyName("u")] - public string Update { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonSnapshot.cs b/Gateways/Alpaca/Libs/Messages/JsonSnapshot.cs deleted file mode 100644 index 80a977dcc..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonSnapshot.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonSnapshot -{ - [JsonPropertyName("latestQuote")] - public JsonHistoricalQuote JsonQuote { get; set; } - - [JsonPropertyName("latestTrade")] - public JsonHistoricalTrade JsonTrade { get; set; } - - [JsonPropertyName("minuteBar")] - public JsonHistoricalBar JsonMinuteBar { get; set; } - - [JsonPropertyName("dailyBar")] - public JsonHistoricalBar JsonCurrentDailyBar { get; set; } - - [JsonPropertyName("prevDailyBar")] - public JsonHistoricalBar JsonPreviousDailyBar { get; set; } - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonStreamError.cs b/Gateways/Alpaca/Libs/Messages/JsonStreamError.cs deleted file mode 100644 index c7dd560eb..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonStreamError.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonStreamError -{ - [JsonPropertyName("code")] - public double? Code { get; set; } - - [JsonPropertyName("msg")] - public string Message { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonSubscriptionUpdate.cs b/Gateways/Alpaca/Libs/Messages/JsonSubscriptionUpdate.cs deleted file mode 100644 index 14b967c99..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonSubscriptionUpdate.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonSubscriptionUpdate -{ - [JsonPropertyName("action")] - public string Action { get; set; } - - [JsonPropertyName("trades")] - public List Trades { get; set; } = []; - - [JsonPropertyName("quotes")] - public List Quotes { get; set; } = []; - - [JsonPropertyName("bars")] - public List MinuteBars { get; set; } = []; - - [JsonPropertyName("dailyBars")] - public List DailyBars { get; set; } = []; - - [JsonPropertyName("statuses")] - public List Statuses { get; set; } = []; - - [JsonPropertyName("lulds")] - public List Lulds { get; set; } = []; - - [JsonPropertyName("news")] - public List News { get; set; } = []; - - [JsonPropertyName("updatedBars")] - public List UpdatedBars { get; set; } = []; - - [JsonPropertyName("orderbooks")] - public List OrderBooks { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonTradeUpdate.cs b/Gateways/Alpaca/Libs/Messages/JsonTradeUpdate.cs deleted file mode 100644 index b0328872f..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonTradeUpdate.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonTradeUpdate -{ - [JsonPropertyName("event")] - public string Event { get; set; } - - [JsonPropertyName("execution_id")] - public string ExecutionId { get; set; } - - [JsonPropertyName("price")] - public double? Price { get; set; } - - [JsonPropertyName("position_qty")] - public double? PositionQuantity { get; set; } - - [JsonPropertyName("qty")] - public double? TradeQuantity { get; set; } - - [JsonPropertyName("timestamp")] - public DateTime? TimestampUtc { get; set; } - - [JsonPropertyName("order")] - public JsonOrder JsonOrder { get; set; } = new(); -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonTradesPage.cs b/Gateways/Alpaca/Libs/Messages/JsonTradesPage.cs deleted file mode 100644 index 14e9e11b3..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonTradesPage.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonTradesPage -{ - [JsonPropertyName("trades")] - public List ItemsList { get; set; } = []; - - [JsonPropertyName("symbol")] - public string Symbol { get; set; } - - [JsonPropertyName("next_page_token")] - public string NextPageToken { get; set; } - - [JsonIgnore] - public List Items { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonTradingStatus.cs b/Gateways/Alpaca/Libs/Messages/JsonTradingStatus.cs deleted file mode 100644 index d4887529f..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonTradingStatus.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonTradingStatus -{ - [JsonPropertyName("sc")] - public string StatusCode { get; set; } - - [JsonPropertyName("sm")] - public string StatusMessage { get; set; } - - [JsonPropertyName("rc")] - public string ReasonCode { get; set; } - - [JsonPropertyName("rm")] - public string ReasonMessage { get; set; } - - [JsonPropertyName("z")] - public string Tape { get; set; } -} diff --git a/Gateways/Alpaca/Libs/Messages/JsonWatchList.cs b/Gateways/Alpaca/Libs/Messages/JsonWatchList.cs deleted file mode 100644 index de394ee9b..000000000 --- a/Gateways/Alpaca/Libs/Messages/JsonWatchList.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Alpaca.Markets; - -public class JsonWatchList -{ - [JsonPropertyName("id")] - public string WatchListId { get; set; } - - [JsonPropertyName("created_at")] - public DateTime? CreatedUtc { get; set; } - - [JsonPropertyName("updated_at")] - public DateTime? UpdatedUtc { get; set; } - - [JsonPropertyName("name")] - public string Name { get; set; } - - [JsonPropertyName("account_id")] - public string AccountId { get; set; } - - [JsonPropertyName("assets")] - public List AssetsList { get; set; } = []; -} diff --git a/Gateways/Alpaca/Libs/Messages/LatestBarMessage.cs b/Gateways/Alpaca/Libs/Messages/LatestBarMessage.cs index cf1755a4c..aebc66434 100644 --- a/Gateways/Alpaca/Libs/Messages/LatestBarMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/LatestBarMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class LatestBarMessage { diff --git a/Gateways/Alpaca/Libs/Messages/LatestBestBidOfferMessage.cs b/Gateways/Alpaca/Libs/Messages/LatestBestBidOfferMessage.cs index 910e32835..3ee9cdb26 100644 --- a/Gateways/Alpaca/Libs/Messages/LatestBestBidOfferMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/LatestBestBidOfferMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class LatestBestBidOfferMessage { diff --git a/Gateways/Alpaca/Libs/Messages/LatestDataMessage.cs b/Gateways/Alpaca/Libs/Messages/LatestDataMessage.cs index 4c4f9d5a6..130deb36a 100644 --- a/Gateways/Alpaca/Libs/Messages/LatestDataMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/LatestDataMessage.cs @@ -1,15 +1,15 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; -public class LatestDataMessage +public class LatestDataMessage { [JsonPropertyName("quotes")] public Dictionary Quotes { get; set; } = []; [JsonPropertyName("bars")] - public Dictionary Bars { get; set; } = []; + public Dictionary Bars { get; set; } = []; [JsonPropertyName("trades")] public Dictionary Trades { get; set; } = []; @@ -18,5 +18,5 @@ public class LatestDataMessage public Dictionary Snapshots { get; set; } = []; [JsonPropertyName("orderbooks")] - public Dictionary OrderBooks { get; set; } = []; + public Dictionary OrderBooks { get; set; } = []; } diff --git a/Gateways/Alpaca/Libs/Messages/LatestQuoteMessage.cs b/Gateways/Alpaca/Libs/Messages/LatestQuoteMessage.cs index d7230c39e..b7bebcdfb 100644 --- a/Gateways/Alpaca/Libs/Messages/LatestQuoteMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/LatestQuoteMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class LatestQuoteMessage { diff --git a/Gateways/Alpaca/Libs/Messages/LatestTradeMessage.cs b/Gateways/Alpaca/Libs/Messages/LatestTradeMessage.cs index 261b36ae9..fe7e0ba46 100644 --- a/Gateways/Alpaca/Libs/Messages/LatestTradeMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/LatestTradeMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class LatestTradeMessage { diff --git a/Gateways/Alpaca/Libs/Messages/LimitUpLimitDownMessage.cs b/Gateways/Alpaca/Libs/Messages/LimitUpLimitDownMessage.cs index 4a955f4ee..25f083b0b 100644 --- a/Gateways/Alpaca/Libs/Messages/LimitUpLimitDownMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/LimitUpLimitDownMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class LimitUpLimitDownMessage { diff --git a/Gateways/Alpaca/Libs/Messages/ListenRequestMessage.cs b/Gateways/Alpaca/Libs/Messages/ListenRequestMessage.cs index ec735318b..9c3fd1a6b 100644 --- a/Gateways/Alpaca/Libs/Messages/ListenRequestMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/ListenRequestMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class ListenRequestMessage { diff --git a/Gateways/Alpaca/Libs/Messages/MarketMoverMessage.cs b/Gateways/Alpaca/Libs/Messages/MarketMoverMessage.cs index 6b6aec952..0a10c3516 100644 --- a/Gateways/Alpaca/Libs/Messages/MarketMoverMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/MarketMoverMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class MarketMoverMessage { diff --git a/Gateways/Alpaca/Libs/Messages/MarketMoversMessage.cs b/Gateways/Alpaca/Libs/Messages/MarketMoversMessage.cs index 6e90748ae..b0aad0e3b 100644 --- a/Gateways/Alpaca/Libs/Messages/MarketMoversMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/MarketMoversMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class MarketMoversMessage { diff --git a/Gateways/Alpaca/Libs/Messages/MultiAuctionsPageMessage.cs b/Gateways/Alpaca/Libs/Messages/MultiAuctionsPageMessage.cs index 186b915ea..d9e9524ec 100644 --- a/Gateways/Alpaca/Libs/Messages/MultiAuctionsPageMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/MultiAuctionsPageMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class MultiAuctionsPageMessage { diff --git a/Gateways/Alpaca/Libs/Messages/MultiBarsPageMessage.cs b/Gateways/Alpaca/Libs/Messages/MultiBarsPageMessage.cs index a704f67ab..370b2a346 100644 --- a/Gateways/Alpaca/Libs/Messages/MultiBarsPageMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/MultiBarsPageMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class MultiBarsPageMessage { diff --git a/Gateways/Alpaca/Libs/Messages/MultiQuotesPageMessage.cs b/Gateways/Alpaca/Libs/Messages/MultiQuotesPageMessage.cs index 1474f531c..468d3ce8f 100644 --- a/Gateways/Alpaca/Libs/Messages/MultiQuotesPageMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/MultiQuotesPageMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class MultiQuotesPageMessage { diff --git a/Gateways/Alpaca/Libs/Messages/MultiTradesPageMessage.cs b/Gateways/Alpaca/Libs/Messages/MultiTradesPageMessage.cs index e9a9330a2..4cb94c513 100644 --- a/Gateways/Alpaca/Libs/Messages/MultiTradesPageMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/MultiTradesPageMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class MultiTradesPageMessage { diff --git a/Gateways/Alpaca/Libs/Messages/NewsArticleMessage.cs b/Gateways/Alpaca/Libs/Messages/NewsArticleMessage.cs index cc613ea18..6ee2092ba 100644 --- a/Gateways/Alpaca/Libs/Messages/NewsArticleMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/NewsArticleMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class NewsArticleMessage { diff --git a/Gateways/Alpaca/Libs/Messages/NewsPageMessage.cs b/Gateways/Alpaca/Libs/Messages/NewsPageMessage.cs index bd8e73923..afc2da8a7 100644 --- a/Gateways/Alpaca/Libs/Messages/NewsPageMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/NewsPageMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class NewsPageMessage { diff --git a/Gateways/Alpaca/Libs/Messages/OptionContractMessage.cs b/Gateways/Alpaca/Libs/Messages/OptionContractMessage.cs index d1602e309..a579aab14 100644 --- a/Gateways/Alpaca/Libs/Messages/OptionContractMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/OptionContractMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class OptionContractMessage { diff --git a/Gateways/Alpaca/Libs/Messages/OptionContractsPageMessage.cs b/Gateways/Alpaca/Libs/Messages/OptionContractsPageMessage.cs index 1b8ff95f1..f404face4 100644 --- a/Gateways/Alpaca/Libs/Messages/OptionContractsPageMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/OptionContractsPageMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class OptionContractsPageMessage { diff --git a/Gateways/Alpaca/Libs/Messages/OptionQuoteMessage.cs b/Gateways/Alpaca/Libs/Messages/OptionQuoteMessage.cs index 549a070d7..082c75eee 100644 --- a/Gateways/Alpaca/Libs/Messages/OptionQuoteMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/OptionQuoteMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class OptionQuoteMessage { diff --git a/Gateways/Alpaca/Libs/Messages/OptionSnapshotMessage.cs b/Gateways/Alpaca/Libs/Messages/OptionSnapshotMessage.cs index 9c1dc8ec6..c2c7dd145 100644 --- a/Gateways/Alpaca/Libs/Messages/OptionSnapshotMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/OptionSnapshotMessage.cs @@ -1,12 +1,12 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class OptionSnapshotMessage { [JsonPropertyName("latestQuote")] - public OptionQuoteMessage JsonQuote { get; set; } + public OptionQuoteMessage Quote { get; set; } [JsonPropertyName("latestTrade")] - public OptionTradeMessage JsonTrade { get; set; } + public OptionTradeMessage Trade { get; set; } } diff --git a/Gateways/Alpaca/Libs/Messages/OptionTradeMessage.cs b/Gateways/Alpaca/Libs/Messages/OptionTradeMessage.cs index dfc999dac..23a88ab02 100644 --- a/Gateways/Alpaca/Libs/Messages/OptionTradeMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/OptionTradeMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class OptionTradeMessage { diff --git a/Gateways/Alpaca/Libs/Messages/OrderActionStatusMessage.cs b/Gateways/Alpaca/Libs/Messages/OrderActionStatusMessage.cs index 830724064..f22528923 100644 --- a/Gateways/Alpaca/Libs/Messages/OrderActionStatusMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/OrderActionStatusMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class OrderActionStatusMessage { diff --git a/Gateways/Alpaca/Libs/Messages/OrderAdvancedAttributesMessage.cs b/Gateways/Alpaca/Libs/Messages/OrderAdvancedAttributesMessage.cs index 7f67e3826..61f37d50e 100644 --- a/Gateways/Alpaca/Libs/Messages/OrderAdvancedAttributesMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/OrderAdvancedAttributesMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class OrderAdvancedAttributesMessage { diff --git a/Gateways/Alpaca/Libs/Messages/OrderBookEntryMessage.cs b/Gateways/Alpaca/Libs/Messages/OrderBookEntryMessage.cs index 9bfd6e217..acb4c0a6c 100644 --- a/Gateways/Alpaca/Libs/Messages/OrderBookEntryMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/OrderBookEntryMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class OrderBookEntryMessage { diff --git a/Gateways/Alpaca/Libs/Messages/OrderCreationMessage.cs b/Gateways/Alpaca/Libs/Messages/OrderCreationMessage.cs index c6ae43dc1..153f048e2 100644 --- a/Gateways/Alpaca/Libs/Messages/OrderCreationMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/OrderCreationMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class OrderCreationMessage { diff --git a/Gateways/Alpaca/Libs/Messages/OrderMessage.cs b/Gateways/Alpaca/Libs/Messages/OrderMessage.cs index 66b1bbc56..cd8b941ae 100644 --- a/Gateways/Alpaca/Libs/Messages/OrderMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/OrderMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class OrderMessage { diff --git a/Gateways/Alpaca/Libs/Messages/PortfolioHistoryMessage.cs b/Gateways/Alpaca/Libs/Messages/PortfolioHistoryMessage.cs index 9d434db62..3a86123aa 100644 --- a/Gateways/Alpaca/Libs/Messages/PortfolioHistoryMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/PortfolioHistoryMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class PortfolioHistoryMessage { diff --git a/Gateways/Alpaca/Libs/Messages/PositionActionStatusMessage.cs b/Gateways/Alpaca/Libs/Messages/PositionActionStatusMessage.cs index e90367105..da4a101ff 100644 --- a/Gateways/Alpaca/Libs/Messages/PositionActionStatusMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/PositionActionStatusMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class PositionActionStatusMessage { diff --git a/Gateways/Alpaca/Libs/Messages/PositionMessage.cs b/Gateways/Alpaca/Libs/Messages/PositionMessage.cs index eb59b783f..0bdd04d3e 100644 --- a/Gateways/Alpaca/Libs/Messages/PositionMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/PositionMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class PositionMessage { diff --git a/Gateways/Alpaca/Libs/Messages/QuotesPageMessage.cs b/Gateways/Alpaca/Libs/Messages/QuotesPageMessage.cs index 7cba8b7e9..43dbbc192 100644 --- a/Gateways/Alpaca/Libs/Messages/QuotesPageMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/QuotesPageMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class QuotesPageMessage { diff --git a/Gateways/Alpaca/Libs/Messages/RealTimeBarMessage.cs b/Gateways/Alpaca/Libs/Messages/RealTimeBarMessage.cs index 523db1d6d..4c610a718 100644 --- a/Gateways/Alpaca/Libs/Messages/RealTimeBarMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/RealTimeBarMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class RealTimeBarMessage { diff --git a/Gateways/Alpaca/Libs/Messages/RealTimeBaseMessage.cs b/Gateways/Alpaca/Libs/Messages/RealTimeBaseMessage.cs index 61bcfd2ce..8984e876d 100644 --- a/Gateways/Alpaca/Libs/Messages/RealTimeBaseMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/RealTimeBaseMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class RealTimeBaseMessage { diff --git a/Gateways/Alpaca/Libs/Messages/RealTimeCryptoQuoteMessage.cs b/Gateways/Alpaca/Libs/Messages/RealTimeCryptoQuoteMessage.cs index 1b901eb27..f86f3a8f6 100644 --- a/Gateways/Alpaca/Libs/Messages/RealTimeCryptoQuoteMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/RealTimeCryptoQuoteMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class RealTimeCryptoQuoteMessage { diff --git a/Gateways/Alpaca/Libs/Messages/RealTimeOrderBookMessage.cs b/Gateways/Alpaca/Libs/Messages/RealTimeOrderBookMessage.cs index 074bb16e8..e759fea5b 100644 --- a/Gateways/Alpaca/Libs/Messages/RealTimeOrderBookMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/RealTimeOrderBookMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class RealTimeOrderBookMessage { diff --git a/Gateways/Alpaca/Libs/Messages/RealTimeQuoteMessage.cs b/Gateways/Alpaca/Libs/Messages/RealTimeQuoteMessage.cs index 3ee55a439..101259dc8 100644 --- a/Gateways/Alpaca/Libs/Messages/RealTimeQuoteMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/RealTimeQuoteMessage.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; -public class RealTimeQuoteMessage +public class RealTimeQuoteMessage : RealTimeBaseMessage { [JsonPropertyName("bx")] public string BidExchange { get; set; } @@ -28,7 +28,4 @@ public class RealTimeQuoteMessage [JsonPropertyName("z")] public string Tape { get; set; } - - [JsonPropertyName("S")] - public string Symbol { get; set; } } diff --git a/Gateways/Alpaca/Libs/Messages/RealTimeTradeMessage.cs b/Gateways/Alpaca/Libs/Messages/RealTimeTradeMessage.cs index a63c01cfe..5331f35b6 100644 --- a/Gateways/Alpaca/Libs/Messages/RealTimeTradeMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/RealTimeTradeMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class RealTimeTradeMessage { diff --git a/Gateways/Alpaca/Libs/Messages/SnapshotMessage.cs b/Gateways/Alpaca/Libs/Messages/SnapshotMessage.cs index d925fbeec..91e5097b4 100644 --- a/Gateways/Alpaca/Libs/Messages/SnapshotMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/SnapshotMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class SnapshotMessage { diff --git a/Gateways/Alpaca/Libs/Messages/StreamErrorMessage.cs b/Gateways/Alpaca/Libs/Messages/StreamErrorMessage.cs index 6f0a5c0f4..375ee0e53 100644 --- a/Gateways/Alpaca/Libs/Messages/StreamErrorMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/StreamErrorMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class StreamErrorMessage { diff --git a/Gateways/Alpaca/Libs/Messages/SubscriptionUpdateMessage.cs b/Gateways/Alpaca/Libs/Messages/SubscriptionUpdateMessage.cs index 00050b08f..e3a6764e8 100644 --- a/Gateways/Alpaca/Libs/Messages/SubscriptionUpdateMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/SubscriptionUpdateMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class SubscriptionUpdateMessage { diff --git a/Gateways/Alpaca/Libs/Messages/TradeUpdateMessage.cs b/Gateways/Alpaca/Libs/Messages/TradeUpdateMessage.cs index 712a868cc..0e743dc7e 100644 --- a/Gateways/Alpaca/Libs/Messages/TradeUpdateMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/TradeUpdateMessage.cs @@ -1,7 +1,7 @@ using System; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class TradeUpdateMessage { diff --git a/Gateways/Alpaca/Libs/Messages/TradesPageMessage.cs b/Gateways/Alpaca/Libs/Messages/TradesPageMessage.cs index 6657aff11..fee9b0aa8 100644 --- a/Gateways/Alpaca/Libs/Messages/TradesPageMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/TradesPageMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class TradesPageMessage { diff --git a/Gateways/Alpaca/Libs/Messages/TradingStatusMessage.cs b/Gateways/Alpaca/Libs/Messages/TradingStatusMessage.cs index f1a3d1f02..959fa3d20 100644 --- a/Gateways/Alpaca/Libs/Messages/TradingStatusMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/TradingStatusMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class TradingStatusMessage { diff --git a/Gateways/Alpaca/Libs/Messages/WatchListMessage.cs b/Gateways/Alpaca/Libs/Messages/WatchListMessage.cs index 6ef58a3d6..f1749478d 100644 --- a/Gateways/Alpaca/Libs/Messages/WatchListMessage.cs +++ b/Gateways/Alpaca/Libs/Messages/WatchListMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Alpaca.Markets; +namespace Alpaca.Messages; public class WatchListMessage { diff --git a/Gateways/Schwab/Libs/Adapter.cs b/Gateways/Schwab/Libs/Adapter.cs index 2d14d3fd1..e524c1a7c 100644 --- a/Gateways/Schwab/Libs/Adapter.cs +++ b/Gateways/Schwab/Libs/Adapter.cs @@ -1,20 +1,19 @@ -using Distribution.Services; using Distribution.Stream; using Distribution.Stream.Extensions; +using Schwab.Mappers; +using Schwab.Messages; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net.Http; +using System.Net.Http.Headers; using System.Net.WebSockets; using System.Text; using System.Text.Json; using System.Threading.Tasks; using Terminal.Core.Domains; -using Terminal.Core.Enums; using Terminal.Core.Models; -using Terminal.Core.Services; -using Terminal.Gateway.Schwab.Messages; namespace Schwab { @@ -144,62 +143,13 @@ public override async Task>> GetOptions(Opt ["includeQuotes"] = "TRUE" }; - var response = await SendData($"/marketdata/v1/chains?{props.ToQuery()}", HttpMethod.Get, props); + var response = await SendData($"/marketdata/v1/chains?{props.ToQuery()}"); var options = response .Data .PutExpDateMap ?.Concat(response.Data.CallExpDateMap) ?.SelectMany(dateMap => dateMap.Value.SelectMany(o => o.Value)) - ?.Select(o => - { - var option = new OptionModel - { - Name = o.Symbol, - BaseName = response.Data.Symbol, - OpenInterest = o.OpenInterest ?? 0, - Strike = o.StrikePrice ?? 0, - IntrinsicValue = o.IntrinsicValue ?? 0, - Leverage = o.Multiplier ?? 0, - Volatility = o.Volatility ?? 0, - Volume = o.TotalVolume ?? 0, - Point = new PointModel - { - Ask = o.Ask ?? 0, - AskSize = o.AskSize ?? 0, - Bid = o.Bid ?? 0, - BidSize = o.BidSize ?? 0, - Bar = new BarModel - { - Low = o.LowPrice ?? 0, - High = o.LowPrice ?? 0, - Open = o.OpenPrice ?? 0, - Close = o.ClosePrice ?? 0 - } - }, - Derivatives = new DerivativeModel - { - Rho = o.Rho ?? 0, - Vega = o.Vega ?? 0, - Delta = o.Delta ?? 0, - Gamma = o.Gamma ?? 0, - Theta = o.Theta ?? 0 - } - }; - - switch (o.PutCall.ToUpper()) - { - case "PUT": option.Side = OptionSideEnum.Put; break; - case "CALL": option.Side = OptionSideEnum.Call; break; - } - - if (o.ExpirationDate is not null) - { - option.ExpirationDate = DateTimeOffset.FromUnixTimeMilliseconds(o.ExpirationDate.Value).UtcDateTime; - } - - return option; - - })?.ToList() ?? []; + ?.Select(InternalMap.GetOption)?.ToList() ?? []; return new ResponseItemModel> { @@ -212,15 +162,24 @@ public override async Task>> GetOptions(Opt /// /// /// - /// - public override Task>> GetPoints(PointMessageModel message) + public override async Task>> GetPoint(PointMessageModel message) { - var response = new ResponseItemModel> + var props = new Hashtable + { + ["symbols"] = string.Join(",", message.Names), + ["fields"] = "quote,fundamental,extended,reference,regular" + }; + + var pointResponse = await SendData>($"/marketdata/v1/quotes?{props.ToQuery()}"); + var response = new ResponseItemModel> { - Data = Account.Instruments[message.Name].Points + Data = message + .Names + .Select(name => InternalMap.GetPoint(pointResponse.Data[name])) + .ToDictionary(o => o.Instrument.Name) }; - return Task.FromResult(response); + return response; } /// @@ -228,7 +187,6 @@ public override Task>> GetPoints(PointMessag /// /// /// - /// public override async Task> CreateOrders(params OrderModel[] orders) { var response = new ResponseMapModel(); @@ -262,163 +220,40 @@ public override async Task> DeleteOrders(params Ord /// Sync open balance, order, and positions /// /// - protected async Task GetAccountData() - { - try - { - var dateFormat = "yyyy-MM-ddTHH:mm:ss.fffZ"; - var orderProps = new Hashtable - { - ["maxResults"] = 50, - ["toEnteredTime"] = DateTime.Now.AddDays(5).ToString(dateFormat), - ["fromEnteredTime"] = DateTime.Now.AddDays(-100).ToString(dateFormat) - }; - - var accountProps = new Hashtable { ["fields"] = "positions" }; - var accountNumbers = await SendData("/trader/v1/accounts/accountNumbers"); - - _accountCode = accountNumbers.Data.First(o => Equals(o.AccountNumber, Account.Descriptor)).HashValue; - - var account = await SendData($"/trader/v1/accounts/{_accountCode}", HttpMethod.Get, accountProps); - var orders = await SendData($"/trader/v1/accounts/{_accountCode}/orders", HttpMethod.Get, orderProps); - - Account.Balance = account.Data.AggregatedBalance.CurrentLiquidationValue; - Account.ActiveOrders = orders - .Data - .Where(o => o.CloseTime is null) - .Select(GetInternalOrder) - .ToDictionary(o => o.Transaction.Id, o => o); - - Account.ActivePositions = account - .Data - .SecuritiesAccount - .Positions - .Select(GetInternalPosition).ToDictionary(o => o.Order.Transaction.Id, o => o); - - Account.ActiveOrders.ForEach(async o => await Subscribe(o.Value.Transaction.Instrument.Name)); - Account.ActivePositions.ForEach(async o => await Subscribe(o.Value.Order.Transaction.Instrument.Name)); - } - catch (Exception e) - { - InstanceService.Instance.OnMessage($"{e}"); - } - } - - /// - /// Convert remote position to local - /// - /// - /// - protected PositionModel GetInternalPosition(PositionMessage position) - { - var instrument = new Instrument - { - Name = position.Instrument.Symbol - }; - - var action = new TransactionModel - { - Instrument = instrument, - Price = position.AveragePrice, - Descriptor = position.Instrument.Symbol, - Volume = position.LongQuantity + position.ShortQuantity, - CurrentVolume = position.LongQuantity + position.ShortQuantity - }; - - var order = new OrderModel - { - Transaction = action, - Type = OrderTypeEnum.Market, - Side = GetInternalPositionSide(position) - }; - - var gainLossPoints = 0.0; - var gainLoss = position.LongOpenProfitLoss; - - return new PositionModel - { - GainLossPointsMax = gainLossPoints, - GainLossPointsMin = gainLossPoints, - GainLossPoints = gainLossPoints, - GainLossMax = gainLoss, - GainLossMin = gainLoss, - GainLoss = gainLoss, - Order = order, - Orders = [order] - }; - } - - /// - /// Convert remote position side to local - /// - /// - /// - protected OrderSideEnum GetInternalPositionSide(PositionMessage position) - { - switch (true) - { - case true when position.LongQuantity > 0: return OrderSideEnum.Buy; - case true when position.ShortQuantity > 0: return OrderSideEnum.Sell; - } - - return OrderSideEnum.None; - } - - /// - /// Convert remote order to local - /// - /// - /// - protected OrderModel GetInternalOrder(OrderMessage order) + protected virtual async Task GetAccountData() { - var assets = order - ?.OrderLegCollection - ?.Select(o => o?.Instrument?.Symbol); - - var instrument = new Instrument + var dateFormat = "yyyy-MM-ddTHH:mm:ss.fffZ"; + var orderProps = new Hashtable { - Name = string.Join($" {Environment.NewLine}", assets) + ["maxResults"] = 50, + ["toEnteredTime"] = DateTime.Now.AddDays(5).ToString(dateFormat), + ["fromEnteredTime"] = DateTime.Now.AddDays(-100).ToString(dateFormat) }; - var action = new TransactionModel - { - Id = $"{order.OrderId}", - Descriptor = order.OrderId, - Instrument = instrument, - CurrentVolume = order.FilledQuantity, - Volume = order.Quantity, - Time = order.EnteredTime, - Status = GetInternalStatus(order) - }; + var accountProps = new Hashtable { ["fields"] = "positions" }; + var accountNumbers = await SendData("/trader/v1/accounts/accountNumbers"); - var inOrder = new OrderModel - { - Transaction = action, - Type = OrderTypeEnum.Market, - Side = GetInternalOrderSide(order), - TimeSpan = GetInternalTimeSpan(order) - }; + _accountCode = accountNumbers.Data.First(o => Equals(o.AccountNumber, Account.Descriptor)).HashValue; - switch (order.OrderType.ToUpper()) - { - case "STOP": - inOrder.Type = OrderTypeEnum.Stop; - inOrder.Price = order.Price; - break; + var account = await SendData($"/trader/v1/accounts/{_accountCode}?{accountProps.ToQuery()}"); + var orders = await SendData($"/trader/v1/accounts/{_accountCode}/orders?{orderProps.ToQuery()}"); - case "LIMIT": - inOrder.Type = OrderTypeEnum.Limit; - inOrder.Price = order.Price; - break; + Account.Balance = account.Data.AggregatedBalance.CurrentLiquidationValue; + Account.ActiveOrders = orders + .Data + .Where(o => o.CloseTime is null) + .Select(InternalMap.GetOrder) + .ToDictionary(o => o.Transaction.Id, o => o); - case "STOP_LIMIT": - inOrder.Type = OrderTypeEnum.StopLimit; - inOrder.Price = order.Price; - inOrder.ActivationPrice = order.StopPrice; - break; - } + Account.ActivePositions = account + .Data + .SecuritiesAccount + .Positions + .Select(InternalMap.GetPosition) + .ToDictionary(o => o.Order.Transaction.Id, o => o); - return inOrder; + Account.ActiveOrders.ForEach(async o => await Subscribe(o.Value.Transaction.Instrument.Name)); + Account.ActivePositions.ForEach(async o => await Subscribe(o.Value.Order.Transaction.Instrument.Name)); } /// @@ -429,20 +264,14 @@ protected OrderModel GetInternalOrder(OrderMessage order) /// /// /// - protected async Task> SendData( + protected virtual async Task> SendData( string source, HttpMethod verb = null, - Hashtable query = null, object content = null) { - query ??= []; verb ??= HttpMethod.Get; - var uri = new UriBuilder(DataUri) - { - Path = source - }; - + var uri = new UriBuilder(DataUri + source); var message = new HttpRequestMessage { Method = verb @@ -450,10 +279,11 @@ protected OrderModel GetInternalOrder(OrderMessage order) switch (true) { - case true when Equals(verb, HttpMethod.Get): uri.Query = query.ToQuery(); break; case true when Equals(verb, HttpMethod.Put): case true when Equals(verb, HttpMethod.Post): - case true when Equals(verb, HttpMethod.Patch): message.Content = new StringContent(JsonSerializer.Serialize(content)); break; + case true when Equals(verb, HttpMethod.Patch): + message.Content = new StringContent(JsonSerializer.Serialize(content), new MediaTypeHeaderValue("application/json")); + break; } message.RequestUri = uri.Uri; @@ -467,7 +297,7 @@ protected OrderModel GetInternalOrder(OrderMessage order) /// /// /// - protected async Task UpdateToken(string source) + protected virtual async Task UpdateToken(string source) { var uri = new UriBuilder(DataUri) { @@ -498,203 +328,69 @@ protected async Task UpdateToken(string source) /// /// /// - protected async Task> CreateOrder(OrderModel order) + protected virtual async Task> CreateOrder(OrderModel order) { var inResponse = new ResponseItemModel(); try { - var exOrder = GetExternalOrder(order); - var exResponse = await SendData($"/trader/v1/accounts/{_accountCode}/orders", HttpMethod.Post, null, exOrder); + var exOrder = ExternalMap.GetOrder(order); + var exResponse = await SendData($"/trader/v1/accounts/{_accountCode}/orders", HttpMethod.Post, exOrder); inResponse.Data = order; - inResponse.Data.Transaction.Id = $"{exResponse.Data.OrderId}"; - inResponse.Data.Transaction.Status = GetInternalStatus(exResponse.Data); - if (exResponse.Status < 400) + if (exResponse.Message.Headers.TryGetValues("Location", out var orderData)) { + var orderItem = orderData.First(); + var orderId = $"{orderItem.Substring(orderItem.LastIndexOf('/') + 1)}"; + + if (string.IsNullOrEmpty(orderId)) + { + inResponse.Errors.Add(new ErrorModel { ErrorMessage = $"{exResponse.Message.StatusCode}" }); + return inResponse; + } + + inResponse.Data.Transaction.Id = orderId; + inResponse.Data.Transaction.Status = Terminal.Core.Enums.OrderStatusEnum.Filled; Account.ActiveOrders.Add(order.Transaction.Id, order); } } catch (Exception e) { - inResponse.Errors.Add(new ErrorModel - { - ErrorMessage = e.Message - }); + inResponse.Errors.Add(new ErrorModel { ErrorMessage = $"{e}" }); } return inResponse; } - - /// - /// Convert remote order from brokerage to local record - /// - /// - /// - protected OrderMessage GetExternalOrder(OrderModel order) - { - var action = order.Transaction; - var message = new OrderMessage - { - //Quantity = action.Volume, - //Symbol = action.Instrument.Name, - //TimeInForce = GetExternalTimeSpan(order.TimeSpan.Value), - //OrderType = "market" - }; - - //switch (order.Side) - //{ - // case OrderSideEnum.Buy: message.OrderSide = "buy"; break; - // case OrderSideEnum.Sell: message.OrderSide = "sell"; break; - //} - - //switch (order.Type) - //{ - // case OrderTypeEnum.Stop: message.StopPrice = order.Price; break; - // case OrderTypeEnum.Limit: message.LimitPrice = order.Price; break; - // case OrderTypeEnum.StopLimit: message.StopPrice = order.ActivationPrice; message.LimitPrice = order.Price; break; - //} - - //if (order.Orders.Any()) - //{ - // message.OrderClass = "bracket"; - - // switch (order.Side) - // { - // case OrderSideEnum.Buy: - // message.StopLoss = GetExternalBracket(order, 1); - // message.TakeProfit = GetExternalBracket(order, -1); - // break; - - // case OrderSideEnum.Sell: - // message.StopLoss = GetExternalBracket(order, -1); - // message.TakeProfit = GetExternalBracket(order, 1); - // break; - // } - //} - - return null; - } - /// /// Cancel order /// /// /// - protected async Task> DeleteOrder(OrderModel order) + protected virtual async Task> DeleteOrder(OrderModel order) { var inResponse = new ResponseItemModel(); try { - var exResponse = await SendData($"/trader/v1/accounts/{_accountCode}/orders", HttpMethod.Delete); - - inResponse.Data = order; - inResponse.Data.Transaction.Id = $"{exResponse.Data.OrderId}"; - inResponse.Data.Transaction.Status = GetInternalStatus(exResponse.Data); + var exResponse = await SendData($"/trader/v1/accounts/{_accountCode}/orders/{order.Transaction.Id}", HttpMethod.Delete); - if (exResponse.Status < 400) + if ((int)exResponse.Message.StatusCode >= 400) { - Account.ActiveOrders.Remove(order.Transaction.Id); + inResponse.Errors.Add(new ErrorModel { ErrorMessage = $"{exResponse.Message.StatusCode}" }); + return inResponse; } + + inResponse.Data = order; + inResponse.Data.Transaction.Status = Terminal.Core.Enums.OrderStatusEnum.Closed; } catch (Exception e) { - inResponse.Errors.Add(new ErrorModel - { - ErrorMessage = e.Message - }); + inResponse.Errors.Add(new ErrorModel { ErrorMessage = $"{e}" }); } return inResponse; } - - /// - /// Convert remote order status to local - /// - /// - /// - protected OrderStatusEnum GetInternalStatus(OrderMessage order) - { - switch (order.Status.ToUpper()) - { - case "FILLED": - case "REPLACED": return OrderStatusEnum.Filled; - case "WORKING": return OrderStatusEnum.Partitioned; - case "REJECTED": - case "CANCELED": - case "EXPIRED": return OrderStatusEnum.Canceled; - case "NEW": - case "PENDING_RECALL": - case "PENDING_CANCEL": - case "PENDING_REPLACE": - case "PENDING_ACTIVATION": - case "PENDING_ACKNOWLEDGEMENT": - case "AWAITING_CONDITION": - case "AWAITING_PARENT_ORDER": - case "AWAITING_RELEASE_TIME": - case "AWAITING_MANUAL_REVIEW": - case "AWAITING_STOP_CONDITION": return OrderStatusEnum.Pending; - } - - return OrderStatusEnum.None; - } - - /// - /// Convert remote order side to local - /// - /// - /// - protected OrderSideEnum GetInternalOrderSide(OrderMessage order) - { - static bool E(string x, string o) => string.Equals(x, o, StringComparison.OrdinalIgnoreCase); - - var position = order - ?.OrderLegCollection - ?.FirstOrDefault(); - - if (E(position.OrderLegType, "EQUITY")) - { - switch (position.Instruction.ToUpper()) - { - case "BUY": - case "BUY_TO_OPEN": - case "BUY_TO_CLOSE": return OrderSideEnum.Buy; - - case "SELL": - case "SELL_TO_OPEN": - case "SELL_TO_CLOSE": return OrderSideEnum.Sell; - } - } - - return OrderSideEnum.None; - } - - /// - /// Convert remote time in force to local - /// - /// - /// - protected OrderTimeSpanEnum GetInternalTimeSpan(OrderMessage order) - { - var span = order.Duration; - var session = order.Session; - - static bool E(string x, string o) => string.Equals(x, o, StringComparison.OrdinalIgnoreCase); - - switch (true) - { - case true when E(span, "DAY"): return OrderTimeSpanEnum.Day; - case true when E(span, "FOK") || E(span, "FILL_OR_KILL"): return OrderTimeSpanEnum.Fok; - case true when E(span, "GTC") || E(span, "GOOD_TILL_CANCEL"): return OrderTimeSpanEnum.Gtc; - case true when E(span, "IOC") || E(span, "IMMEDIATE_OR_CANCEL"): return OrderTimeSpanEnum.Ioc; - case true when E(session, "AM"): return OrderTimeSpanEnum.Am; - case true when E(session, "PM"): return OrderTimeSpanEnum.Pm; - } - - return OrderTimeSpanEnum.None; - } } } diff --git a/Gateways/Schwab/Libs/Maps/ExternalMap.cs b/Gateways/Schwab/Libs/Maps/ExternalMap.cs new file mode 100644 index 000000000..1abdac80d --- /dev/null +++ b/Gateways/Schwab/Libs/Maps/ExternalMap.cs @@ -0,0 +1,113 @@ +using Schwab.Messages; +using System; +using System.Linq; +using Terminal.Core.Enums; +using Terminal.Core.Models; + +namespace Schwab.Mappers +{ + public class ExternalMap + { + /// + /// Convert remote order from brokerage to local record + /// + /// + /// + public static OrderMessage GetOrder(OrderModel order) + { + var action = order.Transaction; + var message = new OrderMessage + { + Duration = "DAY", + Session = "NORMAL", + OrderType = "MARKET", + OrderStrategyType = order.Combination + }; + + switch (order.Type) + { + case OrderTypeEnum.Stop: + message.OrderType = "STOP"; + message.StopPrice = order.Price; + break; + + case OrderTypeEnum.Limit: + message.OrderType = "LIMIT"; + message.Price = order.Price; + break; + + case OrderTypeEnum.StopLimit: + message.OrderType = "STOP_LIMIT"; + message.Price = order.Price; + message.StopPrice = order.Price; + message.ActivationPrice = order.ActivationPrice; + break; + } + + if (E(order.Combination, "TRIGGER")) + { + message.OrderLegCollection = [GetOrderItem(order)]; + message.ChildOrderStrategies = order + .Orders + .Select(o => + { + var subOrder = GetOrder(o); + subOrder.OrderLegCollection = [GetOrderItem(o)]; + return subOrder; + }) + .ToList(); + } + else + { + message.OrderLegCollection = order.Orders.Select(GetOrderItem).ToList(); + } + + return message; + } + + /// + /// Create leg in a combo-order + /// + /// + /// + public static OrderLegMessage GetOrderItem(OrderModel order) + { + var instrument = new InstrumentMessage + { + AssetType = order.AssetType, + Symbol = order.Transaction.Instrument.Name + }; + + var response = new OrderLegMessage + { + Instrument = instrument, + Quantity = order.Transaction.Volume, + }; + + switch (order.Side) + { + case OrderSideEnum.Buy: response.Instruction = "BUY"; break; + case OrderSideEnum.Sell: response.Instruction = "SELL"; break; + } + + if (E(order.AssetType, "OPTION")) + { + switch (order.Side) + { + case OrderSideEnum.Buy: response.Instruction = "BUY_TO_OPEN"; break; + case OrderSideEnum.Sell: response.Instruction = "SELL_TO_CLOSE"; break; + } + } + + return response; + } + + /// + /// Case insensitive comparison + /// + /// + /// + /// + public static bool E(string x, string o) => string.Equals(x, o, StringComparison.OrdinalIgnoreCase); + } +} diff --git a/Gateways/Schwab/Libs/Maps/InternalMap.cs b/Gateways/Schwab/Libs/Maps/InternalMap.cs new file mode 100644 index 000000000..6ed9e2c58 --- /dev/null +++ b/Gateways/Schwab/Libs/Maps/InternalMap.cs @@ -0,0 +1,298 @@ +using Schwab.Messages; +using System; +using System.Collections.Generic; +using System.Collections; +using System.Linq; +using System.Threading.Tasks; +using Terminal.Core.Domains; +using Terminal.Core.Enums; +using Terminal.Core.Models; + +namespace Schwab.Mappers +{ + public class InternalMap + { + /// + /// Get internal option + /// + /// + /// + public static OptionModel GetOption(OptionMessage message) + { + var option = new OptionModel + { + Name = message.Symbol, + OpenInterest = message.OpenInterest ?? 0, + Strike = message.StrikePrice ?? 0, + IntrinsicValue = message.IntrinsicValue ?? 0, + Leverage = message.Multiplier ?? 0, + Volatility = message.Volatility ?? 0, + Volume = message.TotalVolume ?? 0, + Point = new PointModel + { + Ask = message.Ask ?? 0, + AskSize = message.AskSize ?? 0, + Bid = message.Bid ?? 0, + BidSize = message.BidSize ?? 0, + Bar = new BarModel + { + Low = message.LowPrice ?? 0, + High = message.LowPrice ?? 0, + Open = message.OpenPrice ?? 0, + Close = message.ClosePrice ?? 0 + } + }, + Derivatives = new DerivativeModel + { + Rho = message.Rho ?? 0, + Vega = message.Vega ?? 0, + Delta = message.Delta ?? 0, + Gamma = message.Gamma ?? 0, + Theta = message.Theta ?? 0 + } + }; + + switch (message.PutCall.ToUpper()) + { + case "PUT": option.Side = OptionSideEnum.Put; break; + case "CALL": option.Side = OptionSideEnum.Call; break; + } + + if (message.ExpirationDate is not null) + { + option.ExpirationDate = DateTimeOffset.FromUnixTimeMilliseconds(message.ExpirationDate.Value).UtcDateTime; + } + + return option; + } + + /// + /// Get internal point + /// + /// + /// + public static PointModel GetPoint(AssetMessage pointMessage) + { + var o = pointMessage.Quote; + var point = new PointModel + { + Ask = o.AskPrice, + Bid = o.BidPrice, + AskSize = o.AskSize, + BidSize = o.BidSize, + Time = DateTimeOffset.FromUnixTimeMilliseconds(o.QuoteTime ?? DateTime.Now.Ticks).UtcDateTime, + Last = o.AskTime > o.BidTime ? o.AskPrice : o.BidPrice, + Instrument = new Instrument { Name = pointMessage.Symbol } + }; + + return point; + } + + /// + /// Convert remote position to local + /// + /// + /// + public static PositionModel GetPosition(PositionMessage position) + { + var instrument = new Instrument + { + Name = position.Instrument.Symbol + }; + + var action = new TransactionModel + { + Instrument = instrument, + Price = position.AveragePrice, + Descriptor = position.Instrument.Symbol, + Volume = position.LongQuantity + position.ShortQuantity, + CurrentVolume = position.LongQuantity + position.ShortQuantity + }; + + var order = new OrderModel + { + Transaction = action, + Type = OrderTypeEnum.Market, + Side = GetPositionSide(position) + }; + + var gainLossPoints = 0.0; + var gainLoss = position.LongOpenProfitLoss; + + return new PositionModel + { + GainLossPointsMax = gainLossPoints, + GainLossPointsMin = gainLossPoints, + GainLossPoints = gainLossPoints, + GainLossMax = gainLoss, + GainLossMin = gainLoss, + GainLoss = gainLoss, + Order = order, + Orders = [order] + }; + } + + /// + /// Convert remote position side to local + /// + /// + /// + public static OrderSideEnum GetPositionSide(PositionMessage position) + { + switch (true) + { + case true when position.LongQuantity > 0: return OrderSideEnum.Buy; + case true when position.ShortQuantity > 0: return OrderSideEnum.Sell; + } + + return OrderSideEnum.None; + } + + /// + /// Convert remote order to local + /// + /// + /// + public static OrderModel GetOrder(OrderMessage order) + { + var assets = order + ?.OrderLegCollection + ?.Select(o => o?.Instrument?.Symbol); + + var instrument = new Instrument + { + Name = string.Join($" {Environment.NewLine}", assets) + }; + + var action = new TransactionModel + { + Id = $"{order.OrderId}", + Descriptor = order.OrderId, + Instrument = instrument, + CurrentVolume = order.FilledQuantity, + Volume = order.Quantity, + Time = order.EnteredTime, + Status = GetStatus(order) + }; + + var inOrder = new OrderModel + { + Transaction = action, + Type = OrderTypeEnum.Market, + Side = GetOrderSide(order), + TimeSpan = GetTimeSpan(order) + }; + + switch (order.OrderType.ToUpper()) + { + case "STOP": + inOrder.Type = OrderTypeEnum.Stop; + inOrder.Price = order.Price; + break; + + case "LIMIT": + inOrder.Type = OrderTypeEnum.Limit; + inOrder.Price = order.Price; + break; + + case "STOP_LIMIT": + inOrder.Type = OrderTypeEnum.StopLimit; + inOrder.Price = order.Price; + inOrder.ActivationPrice = order.StopPrice; + break; + } + + return inOrder; + } + + /// + /// Convert remote order status to local + /// + /// + /// + public static OrderStatusEnum GetStatus(OrderMessage order) + { + switch (order.Status.ToUpper()) + { + case "FILLED": + case "REPLACED": return OrderStatusEnum.Filled; + case "WORKING": return OrderStatusEnum.Partitioned; + case "REJECTED": + case "CANCELED": + case "EXPIRED": return OrderStatusEnum.Canceled; + case "NEW": + case "PENDING_RECALL": + case "PENDING_CANCEL": + case "PENDING_REPLACE": + case "PENDING_ACTIVATION": + case "PENDING_ACKNOWLEDGEMENT": + case "AWAITING_CONDITION": + case "AWAITING_PARENT_ORDER": + case "AWAITING_RELEASE_TIME": + case "AWAITING_MANUAL_REVIEW": + case "AWAITING_STOP_CONDITION": return OrderStatusEnum.Pending; + } + + return OrderStatusEnum.None; + } + + /// + /// Convert remote order side to local + /// + /// + /// + public static OrderSideEnum GetOrderSide(OrderMessage order) + { + var position = order + ?.OrderLegCollection + ?.FirstOrDefault(); + + if (E(position.OrderLegType, "EQUITY")) + { + switch (position.Instruction.ToUpper()) + { + case "BUY": + case "BUY_TO_OPEN": + case "BUY_TO_CLOSE": return OrderSideEnum.Buy; + + case "SELL": + case "SELL_TO_OPEN": + case "SELL_TO_CLOSE": return OrderSideEnum.Sell; + } + } + + return OrderSideEnum.None; + } + + /// + /// Convert remote time in force to local + /// + /// + /// + public static OrderTimeSpanEnum GetTimeSpan(OrderMessage order) + { + var span = order.Duration; + var session = order.Session; + + switch (true) + { + case true when E(span, "DAY"): return OrderTimeSpanEnum.Day; + case true when E(span, "FILL_OR_KILL"): return OrderTimeSpanEnum.Fok; + case true when E(span, "GOOD_TILL_CANCEL"): return OrderTimeSpanEnum.Gtc; + case true when E(span, "IMMEDIATE_OR_CANCEL"): return OrderTimeSpanEnum.Ioc; + case true when E(session, "AM"): return OrderTimeSpanEnum.Am; + case true when E(session, "PM"): return OrderTimeSpanEnum.Pm; + } + + return OrderTimeSpanEnum.None; + } + + /// + /// Case insensitive comparison + /// + /// + /// + /// + public static bool E(string x, string o) => string.Equals(x, o, StringComparison.OrdinalIgnoreCase); + } +} diff --git a/Gateways/Schwab/Libs/Messages/AccountNumbersMessage.cs b/Gateways/Schwab/Libs/Messages/AccountNumbersMessage.cs index 986fa7853..77ed1e6d7 100644 --- a/Gateways/Schwab/Libs/Messages/AccountNumbersMessage.cs +++ b/Gateways/Schwab/Libs/Messages/AccountNumbersMessage.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { using System.Text.Json.Serialization; diff --git a/Gateways/Schwab/Libs/Messages/AccountsMessage.cs b/Gateways/Schwab/Libs/Messages/AccountsMessage.cs index 180bc07ff..d1dd82553 100644 --- a/Gateways/Schwab/Libs/Messages/AccountsMessage.cs +++ b/Gateways/Schwab/Libs/Messages/AccountsMessage.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { using System.Text.Json.Serialization; diff --git a/Gateways/Schwab/Libs/Messages/AggregatedBalanceMessage.cs b/Gateways/Schwab/Libs/Messages/AggregatedBalanceMessage.cs index 6965d38bb..3396c8721 100644 --- a/Gateways/Schwab/Libs/Messages/AggregatedBalanceMessage.cs +++ b/Gateways/Schwab/Libs/Messages/AggregatedBalanceMessage.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { using System.Text.Json.Serialization; diff --git a/Gateways/Schwab/Libs/Messages/AssetErrorMessage.cs b/Gateways/Schwab/Libs/Messages/AssetErrorMessage.cs new file mode 100644 index 000000000..9c8cd9fd6 --- /dev/null +++ b/Gateways/Schwab/Libs/Messages/AssetErrorMessage.cs @@ -0,0 +1,12 @@ +namespace Schwab.Messages +{ + using System.Collections.Generic; + using System.Text.Json.Serialization; + + public partial class AssetErrorMessage + { + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("invalidSymbols")] + public List InvalidSymbols { get; set; } + } +} diff --git a/Gateways/Schwab/Libs/Messages/AssetMessage.cs b/Gateways/Schwab/Libs/Messages/AssetMessage.cs new file mode 100644 index 000000000..95c3544c0 --- /dev/null +++ b/Gateways/Schwab/Libs/Messages/AssetMessage.cs @@ -0,0 +1,52 @@ +namespace Schwab.Messages +{ + using System.Collections.Generic; + using System.Text.Json.Serialization; + + public partial class AssetMessage + { + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("assetMainType")] + public string AssetMainType { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("assetSubType")] + public string AssetSubType { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("quoteType")] + public string QuoteType { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("realtime")] + public bool? Realtime { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("ssid")] + public long? Ssid { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("symbol")] + public string Symbol { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("extended")] + public Dictionary Extended { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("fundamental")] + public FundamentalsMessage Fundamental { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("quote")] + public QuoteMessage Quote { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("reference")] + public ReferenceMessage Reference { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("regular")] + public AssetRegularMessage Regular { get; set; } + } +} diff --git a/Gateways/Schwab/Libs/Messages/AssetRegularMessage.cs b/Gateways/Schwab/Libs/Messages/AssetRegularMessage.cs new file mode 100644 index 000000000..1b278ab55 --- /dev/null +++ b/Gateways/Schwab/Libs/Messages/AssetRegularMessage.cs @@ -0,0 +1,27 @@ +namespace Schwab.Messages +{ + using System.Text.Json.Serialization; + + public partial class AssetRegularMessage + { + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("regularMarketLastPrice")] + public double? RegularMarketLastPrice { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("regularMarketLastSize")] + public double? RegularMarketLastSize { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("regularMarketNetChange")] + public double? RegularMarketNetChange { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("regularMarketPercentChange")] + public double? RegularMarketPercentChange { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("regularMarketTradeTime")] + public long? RegularMarketTradeTime { get; set; } + } +} diff --git a/Gateways/Schwab/Libs/Messages/ExecutionLegMessage.cs b/Gateways/Schwab/Libs/Messages/ExecutionLegMessage.cs index ae4bbdcbd..c5cc21492 100644 --- a/Gateways/Schwab/Libs/Messages/ExecutionLegMessage.cs +++ b/Gateways/Schwab/Libs/Messages/ExecutionLegMessage.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { using System; using System.Text.Json.Serialization; diff --git a/Gateways/Schwab/Libs/Messages/FundamentalsMessage.cs b/Gateways/Schwab/Libs/Messages/FundamentalsMessage.cs new file mode 100644 index 000000000..f57f7f4ff --- /dev/null +++ b/Gateways/Schwab/Libs/Messages/FundamentalsMessage.cs @@ -0,0 +1,68 @@ +namespace Schwab.Messages +{ + using System; + using System.Text.Json.Serialization; + + public partial class FundamentalsMessage + { + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("avg10DaysVolume")] + public double? Avg10DaysVolume { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("avg1YearVolume")] + public double? Avg1YearVolume { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("declarationDate")] + public DateTime? DeclarationDate { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("divAmount")] + public double? DivAmount { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("divExDate")] + public DateTime? DivExDate { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("divFreq")] + public double? DivFreq { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("divPayAmount")] + public double? DivPayAmount { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("divPayDate")] + public DateTime? DivPayDate { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("divYield")] + public double? DivYield { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("eps")] + public double? Eps { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("fundLeverageFactor")] + public double? FundLeverageFactor { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("lastEarningsDate")] + public DateTime? LastEarningsDate { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("nextDivExDate")] + public DateTime? NextDivExDate { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("nextDivPayDate")] + public DateTime? NextDivPayDate { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("peRatio")] + public double? PeRatio { get; set; } + } +} diff --git a/Gateways/Schwab/Libs/Messages/InitialBalanceMessage.cs b/Gateways/Schwab/Libs/Messages/InitialBalanceMessage.cs index f571fe63c..bb28c7420 100644 --- a/Gateways/Schwab/Libs/Messages/InitialBalanceMessage.cs +++ b/Gateways/Schwab/Libs/Messages/InitialBalanceMessage.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { using System.Text.Json.Serialization; diff --git a/Gateways/Schwab/Libs/Messages/InstrumentMessage.cs b/Gateways/Schwab/Libs/Messages/InstrumentMessage.cs index 317a7ab11..c2d2786e7 100644 --- a/Gateways/Schwab/Libs/Messages/InstrumentMessage.cs +++ b/Gateways/Schwab/Libs/Messages/InstrumentMessage.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { using System.Text.Json.Serialization; diff --git a/Gateways/Schwab/Libs/Messages/OptionChainMessage.cs b/Gateways/Schwab/Libs/Messages/OptionChainMessage.cs index eedfe9b9a..d74592d28 100644 --- a/Gateways/Schwab/Libs/Messages/OptionChainMessage.cs +++ b/Gateways/Schwab/Libs/Messages/OptionChainMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { public class OptionChainMessage { diff --git a/Gateways/Schwab/Libs/Messages/OptionDeliverableMessage.cs b/Gateways/Schwab/Libs/Messages/OptionDeliverableMessage.cs index 4538668ab..85ae929a2 100644 --- a/Gateways/Schwab/Libs/Messages/OptionDeliverableMessage.cs +++ b/Gateways/Schwab/Libs/Messages/OptionDeliverableMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { public class OptionDeliverableMessage { diff --git a/Gateways/Schwab/Libs/Messages/OptionMessage.cs b/Gateways/Schwab/Libs/Messages/OptionMessage.cs index b44bb5a92..7cccdead0 100644 --- a/Gateways/Schwab/Libs/Messages/OptionMessage.cs +++ b/Gateways/Schwab/Libs/Messages/OptionMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { public class OptionMessage { diff --git a/Gateways/Schwab/Libs/Messages/OrderActivityMessage.cs b/Gateways/Schwab/Libs/Messages/OrderActivityMessage.cs index de27c4de6..e1336301e 100644 --- a/Gateways/Schwab/Libs/Messages/OrderActivityMessage.cs +++ b/Gateways/Schwab/Libs/Messages/OrderActivityMessage.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { using System.Collections.Generic; using System.Text.Json.Serialization; diff --git a/Gateways/Schwab/Libs/Messages/OrderLegMessage.cs b/Gateways/Schwab/Libs/Messages/OrderLegMessage.cs index 4e6508bb6..44a9ff597 100644 --- a/Gateways/Schwab/Libs/Messages/OrderLegMessage.cs +++ b/Gateways/Schwab/Libs/Messages/OrderLegMessage.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { using System.Text.Json.Serialization; diff --git a/Gateways/Schwab/Libs/Messages/OrderMessage.cs b/Gateways/Schwab/Libs/Messages/OrderMessage.cs index 2b98fe3cd..7ec00049d 100644 --- a/Gateways/Schwab/Libs/Messages/OrderMessage.cs +++ b/Gateways/Schwab/Libs/Messages/OrderMessage.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { using System; using System.Collections.Generic; @@ -140,11 +140,11 @@ public partial class OrderMessage [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("replacingOrderCollection")] - public List ReplacingOrderCollection { get; set; } + public List ReplacingOrderCollection { get; set; } [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("childOrderStrategies")] - public List ChildOrderStrategies { get; set; } + public List ChildOrderStrategies { get; set; } [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("statusDescription")] diff --git a/Gateways/Schwab/Libs/Messages/PositionMessage.cs b/Gateways/Schwab/Libs/Messages/PositionMessage.cs index 8c72212de..eca473ca5 100644 --- a/Gateways/Schwab/Libs/Messages/PositionMessage.cs +++ b/Gateways/Schwab/Libs/Messages/PositionMessage.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { using System.Text.Json.Serialization; diff --git a/Gateways/Schwab/Libs/Messages/ProjectedBalanceMessage.cs b/Gateways/Schwab/Libs/Messages/ProjectedBalanceMessage.cs index df91f6b0b..db8bff6b8 100644 --- a/Gateways/Schwab/Libs/Messages/ProjectedBalanceMessage.cs +++ b/Gateways/Schwab/Libs/Messages/ProjectedBalanceMessage.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { using System.Text.Json.Serialization; diff --git a/Gateways/Schwab/Libs/Messages/QuoteMessage.cs b/Gateways/Schwab/Libs/Messages/QuoteMessage.cs new file mode 100644 index 000000000..0b89d7257 --- /dev/null +++ b/Gateways/Schwab/Libs/Messages/QuoteMessage.cs @@ -0,0 +1,119 @@ +namespace Schwab.Messages +{ + using System.Text.Json.Serialization; + + public partial class QuoteMessage + { + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("52WeekHigh")] + public double? The52WeekHigh { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("52WeekLow")] + public double? The52WeekLow { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("askMICId")] + public string AskMicId { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("askPrice")] + public double? AskPrice { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("askSize")] + public double? AskSize { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("askTime")] + public long? AskTime { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("bidMICId")] + public string BidMicId { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("bidPrice")] + public double? BidPrice { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("bidSize")] + public double? BidSize { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("bidTime")] + public long? BidTime { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("closePrice")] + public double? ClosePrice { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("highPrice")] + public double? HighPrice { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("lastMICId")] + public string LastMicId { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("lastPrice")] + public double? LastPrice { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("lastSize")] + public double? LastSize { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("lowPrice")] + public double? LowPrice { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("mark")] + public double? Mark { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("markChange")] + public double? MarkChange { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("markPercentChange")] + public double? MarkPercentChange { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("netChange")] + public double? NetChange { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("netPercentChange")] + public double? NetPercentChange { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("openPrice")] + public double? OpenPrice { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("postMarketChange")] + public double? PostMarketChange { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("postMarketPercentChange")] + public double? PostMarketPercentChange { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("quoteTime")] + public long? QuoteTime { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("securityStatus")] + public string SecurityStatus { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("totalVolume")] + public double? TotalVolume { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("tradeTime")] + public double? TradeTime { get; set; } + } +} diff --git a/Gateways/Schwab/Libs/Messages/ReferenceMessage.cs b/Gateways/Schwab/Libs/Messages/ReferenceMessage.cs new file mode 100644 index 000000000..78035afbc --- /dev/null +++ b/Gateways/Schwab/Libs/Messages/ReferenceMessage.cs @@ -0,0 +1,35 @@ +namespace Schwab.Messages +{ + using System.Text.Json.Serialization; + + public partial class ReferenceMessage + { + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("cusip")] + public string Cusip { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("description")] + public string Description { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("exchange")] + public string Exchange { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("exchangeName")] + public string ExchangeName { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("isHardToBorrow")] + public bool? IsHardToBorrow { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("isShortable")] + public bool? IsShortable { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("htbRate")] + public double? HtbRate { get; set; } + } +} diff --git a/Gateways/Schwab/Libs/Messages/ScopeMessage.cs b/Gateways/Schwab/Libs/Messages/ScopeMessage.cs index c39bd8f69..3db4541d7 100644 --- a/Gateways/Schwab/Libs/Messages/ScopeMessage.cs +++ b/Gateways/Schwab/Libs/Messages/ScopeMessage.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { public class ScopeMessage { diff --git a/Gateways/Schwab/Libs/Messages/SecuritiesMessage.cs b/Gateways/Schwab/Libs/Messages/SecuritiesMessage.cs index 19bbc199e..2b70ce252 100644 --- a/Gateways/Schwab/Libs/Messages/SecuritiesMessage.cs +++ b/Gateways/Schwab/Libs/Messages/SecuritiesMessage.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { using System.Collections.Generic; using System.Text.Json.Serialization; diff --git a/Gateways/Schwab/Libs/Messages/UnderlyingMessage.cs b/Gateways/Schwab/Libs/Messages/UnderlyingMessage.cs index 2959847f8..2873f327f 100644 --- a/Gateways/Schwab/Libs/Messages/UnderlyingMessage.cs +++ b/Gateways/Schwab/Libs/Messages/UnderlyingMessage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Terminal.Gateway.Schwab.Messages +namespace Schwab.Messages { public class UnderlyingMessage { diff --git a/Gateways/Schwab/Libs/Schwab.csproj b/Gateways/Schwab/Libs/Schwab.csproj index d61770efa..6957a70ad 100644 --- a/Gateways/Schwab/Libs/Schwab.csproj +++ b/Gateways/Schwab/Libs/Schwab.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/Gateways/Simulation/Libs/Adapter.cs b/Gateways/Simulation/Libs/Adapter.cs index 3d7291d59..f48759e31 100644 --- a/Gateways/Simulation/Libs/Adapter.cs +++ b/Gateways/Simulation/Libs/Adapter.cs @@ -259,10 +259,7 @@ protected virtual PositionModel CreatePosition(OrderModel order) var nextPosition = new PositionModel { Order = order, - Orders = new List - { - nextOrder - } + Orders = [nextOrder] }; Account.Orders.Add(nextOrder); @@ -319,7 +316,7 @@ protected virtual PositionModel IncreasePosition(OrderModel order, PositionModel nextPosition.Order.Transaction.Time = nextOrder.Transaction.Time; nextPosition.Order.Transaction.Volume += nextOrder.Transaction.Volume; - nextPosition.Order.Transaction.Price = + nextPosition.Order.Transaction.Price = nextPosition.Orders.Sum(o => o.Transaction.Volume * o.Transaction.Price) / nextPosition.Orders.Sum(o => o.Transaction.Volume); @@ -528,7 +525,7 @@ protected virtual PointModel Parse(string name, string input) return response; } - public override Task>> GetPoints(PointMessageModel message) + public override Task>> GetPoint(PointMessageModel message) { throw new NotImplementedException(); } diff --git a/Solution.sln b/Solution.sln index be1b16ab3..c4756a7bf 100644 --- a/Solution.sln +++ b/Solution.sln @@ -17,8 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Simulation", "Gateways\Simu EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Schwab", "Gateways\Schwab\Libs\Schwab.csproj", "{697A2F71-6DC7-4AA3-9D5B-61899605BE3F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Gateways\Schwab\Tests\Tests.csproj", "{8DA38824-8E1A-4E42-92AF-D1AA6F4AA730}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Gateways\Simulation\Tests\Tests.csproj", "{7FFC95C5-48CA-4475-BEA3-740CB427345C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Alpaca", "Alpaca", "{E7CD6538-C7F9-4D33-9F0A-23A699FC84FB}" @@ -65,14 +63,6 @@ Global {697A2F71-6DC7-4AA3-9D5B-61899605BE3F}.Release|Any CPU.Build.0 = Release|Any CPU {697A2F71-6DC7-4AA3-9D5B-61899605BE3F}.Release|x64.ActiveCfg = Release|Any CPU {697A2F71-6DC7-4AA3-9D5B-61899605BE3F}.Release|x64.Build.0 = Release|Any CPU - {8DA38824-8E1A-4E42-92AF-D1AA6F4AA730}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8DA38824-8E1A-4E42-92AF-D1AA6F4AA730}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8DA38824-8E1A-4E42-92AF-D1AA6F4AA730}.Debug|x64.ActiveCfg = Debug|Any CPU - {8DA38824-8E1A-4E42-92AF-D1AA6F4AA730}.Debug|x64.Build.0 = Debug|Any CPU - {8DA38824-8E1A-4E42-92AF-D1AA6F4AA730}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8DA38824-8E1A-4E42-92AF-D1AA6F4AA730}.Release|Any CPU.Build.0 = Release|Any CPU - {8DA38824-8E1A-4E42-92AF-D1AA6F4AA730}.Release|x64.ActiveCfg = Release|Any CPU - {8DA38824-8E1A-4E42-92AF-D1AA6F4AA730}.Release|x64.Build.0 = Release|Any CPU {7FFC95C5-48CA-4475-BEA3-740CB427345C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7FFC95C5-48CA-4475-BEA3-740CB427345C}.Debug|Any CPU.Build.0 = Debug|Any CPU {7FFC95C5-48CA-4475-BEA3-740CB427345C}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -98,7 +88,6 @@ Global {CAD78AFC-793C-45A9-B5A5-628011D599E4} = {A7B0DEF1-75C8-440A-ADDC-D6C1B758D2AA} {1F838D97-6CF0-40E4-813F-B4C4707E4DDC} = {CAD78AFC-793C-45A9-B5A5-628011D599E4} {697A2F71-6DC7-4AA3-9D5B-61899605BE3F} = {9AF565D1-31F6-416A-9A71-C755E355A741} - {8DA38824-8E1A-4E42-92AF-D1AA6F4AA730} = {9AF565D1-31F6-416A-9A71-C755E355A741} {7FFC95C5-48CA-4475-BEA3-740CB427345C} = {CAD78AFC-793C-45A9-B5A5-628011D599E4} {E7CD6538-C7F9-4D33-9F0A-23A699FC84FB} = {A7B0DEF1-75C8-440A-ADDC-D6C1B758D2AA} {9DF6CCD0-280E-4387-8222-460D52B17EB2} = {E7CD6538-C7F9-4D33-9F0A-23A699FC84FB}