diff --git a/src/Console.Sample/Program.cs b/src/Console.Sample/Program.cs index 37235a0..1863927 100644 --- a/src/Console.Sample/Program.cs +++ b/src/Console.Sample/Program.cs @@ -113,7 +113,7 @@ private static async Task Main() ClientSecret = _app.Secret, }; - await _client.SendMessage(applicationAuthReq, ProtoOAPayloadType.ProtoOaApplicationAuthReq); + await _client.SendMessage(applicationAuthReq); await Task.Delay(5000); @@ -278,7 +278,7 @@ private static async void RefreshToken() RefreshToken = _token.RefreshToken }; - await _client.SendMessage(refreshTokenReq, ProtoOAPayloadType.ProtoOaRefreshTokenReq); + await _client.SendMessage(refreshTokenReq); } private static async void SubscribeToSymbolTrendBar(string[] commandSplit) @@ -292,7 +292,7 @@ private static async void SubscribeToSymbolTrendBar(string[] commandSplit) SymbolId = long.Parse(commandSplit[4]), }; - await _client.SendMessage(subscribeLiveTrendbarReq, ProtoOAPayloadType.ProtoOaSubscribeLiveTrendbarReq); + await _client.SendMessage(subscribeLiveTrendbarReq); } private static async void SubscribeToSymbolSpot(string[] commandSplit) @@ -306,7 +306,7 @@ private static async void SubscribeToSymbolSpot(string[] commandSplit) subscribeSpotsReq.SymbolId.AddRange(commandSplit.Skip(3).Select(iSymbolId => long.Parse(iSymbolId))); - await _client.SendMessage(subscribeSpotsReq, ProtoOAPayloadType.ProtoOaSubscribeSpotsReq); + await _client.SendMessage(subscribeSpotsReq); } private static async void SymbolListRequest(string[] commandSplit) @@ -320,7 +320,7 @@ private static async void SymbolListRequest(string[] commandSplit) CtidTraderAccountId = accountId, }; - await _client.SendMessage(symbolsListReq, ProtoOAPayloadType.ProtoOaSymbolsListReq); + await _client.SendMessage(symbolsListReq); } private static async void ReconcileRequest(string[] commandSplit) @@ -334,7 +334,7 @@ private static async void ReconcileRequest(string[] commandSplit) CtidTraderAccountId = accountId, }; - await _client.SendMessage(reconcileReq, ProtoOAPayloadType.ProtoOaReconcileReq); + await _client.SendMessage(reconcileReq); } private static async void AccountListRequest() @@ -346,7 +346,7 @@ private static async void AccountListRequest() AccessToken = _token.AccessToken, }; - await _client.SendMessage(accountListByAccessTokenReq, ProtoOAPayloadType.ProtoOaGetAccountsByAccessTokenReq); + await _client.SendMessage(accountListByAccessTokenReq); } private static async void AccountAuthRequest(string[] commandSplit) @@ -361,7 +361,7 @@ private static async void AccountAuthRequest(string[] commandSplit) AccessToken = _token.AccessToken }; - await _client.SendMessage(accountAuthReq, ProtoOAPayloadType.ProtoOaAccountAuthReq); + await _client.SendMessage(accountAuthReq); } private static void GetCommand() diff --git a/src/OpenAPI.Net/Helpers/MessagePayloadTypeExtension.cs b/src/OpenAPI.Net/Helpers/MessagePayloadTypeExtension.cs index c2c5224..8df822c 100644 --- a/src/OpenAPI.Net/Helpers/MessagePayloadTypeExtension.cs +++ b/src/OpenAPI.Net/Helpers/MessagePayloadTypeExtension.cs @@ -26,7 +26,7 @@ public static uint GetPayloadType(this T message) where T : IMessage throw new InvalidOperationException($"Couldn't get the PayloadType of the message {message}", ex); } - return (uint)property.GetValue(message); + return Convert.ToUInt32(property.GetValue(message)); } } } diff --git a/src/OpenAPI.Net/OpenAPI.Net.csproj b/src/OpenAPI.Net/OpenAPI.Net.csproj index f6ef7c2..9d6ed5f 100644 --- a/src/OpenAPI.Net/OpenAPI.Net.csproj +++ b/src/OpenAPI.Net/OpenAPI.Net.csproj @@ -9,7 +9,7 @@ cTrader, Open API, Spotware A .NET RX library for Spotware Open API Spotware.OpenAPI.Net - 1.3.6-rc1 + 1.3.6-rc2 AnyCPU Spotware Spotware