diff --git a/TTWebClient/Domain/TTTrade.cs b/TTWebClient/Domain/TTTrade.cs index 30ff46e..ebfaa85 100644 --- a/TTWebClient/Domain/TTTrade.cs +++ b/TTWebClient/Domain/TTTrade.cs @@ -158,7 +158,10 @@ public class TTTrade /// Trigger Time public DateTime? TriggerTime { get; set; } - /// Commission + /// Order Id Triggered By public long? OrderIdTriggeredBy { get; set; } + + /// Close Price + public decimal? ClosePrice { get; set; } } } diff --git a/TTWebClient/TTWebClient.csproj b/TTWebClient/TTWebClient.csproj index 074e413..90ba7c1 100644 --- a/TTWebClient/TTWebClient.csproj +++ b/TTWebClient/TTWebClient.csproj @@ -9,7 +9,7 @@ Properties TTWebClient TTWebClient - v4.6.1 + v4.8 512 ..\ true diff --git a/TTWebClient/app.config b/TTWebClient/app.config index 323c0f4..a905483 100644 --- a/TTWebClient/app.config +++ b/TTWebClient/app.config @@ -1,17 +1,17 @@ - + - + - - + + - - + + diff --git a/TTWebClientRobot/App.config b/TTWebClientRobot/App.config index 1a53b96..1231108 100644 --- a/TTWebClientRobot/App.config +++ b/TTWebClientRobot/App.config @@ -1,17 +1,17 @@ - + - - + + - - + + diff --git a/TTWebClientRobot/TTWebClientRobot.csproj b/TTWebClientRobot/TTWebClientRobot.csproj index 3da7d46..3e9a667 100644 --- a/TTWebClientRobot/TTWebClientRobot.csproj +++ b/TTWebClientRobot/TTWebClientRobot.csproj @@ -9,7 +9,7 @@ Properties TTWebClientRobot TTWebClientRobot - v4.6.1 + v4.8 512 diff --git a/TTWebClientSample/App.config b/TTWebClientSample/App.config index 1a53b96..1231108 100644 --- a/TTWebClientSample/App.config +++ b/TTWebClientSample/App.config @@ -1,17 +1,17 @@ - + - - + + - - + + diff --git a/TTWebClientSample/TTWebClientSample.csproj b/TTWebClientSample/TTWebClientSample.csproj index f9cd116..15f31a7 100644 --- a/TTWebClientSample/TTWebClientSample.csproj +++ b/TTWebClientSample/TTWebClientSample.csproj @@ -9,7 +9,7 @@ Properties TTWebClientSample TTWebClientSample - v4.6.1 + v4.8 512 publish\ true diff --git a/TTWebClientUI/App.config b/TTWebClientUI/App.config index d87e154..6e0188a 100644 --- a/TTWebClientUI/App.config +++ b/TTWebClientUI/App.config @@ -6,18 +6,18 @@ - + - - + + - - + + diff --git a/TTWebClientUI/ClientView.cs b/TTWebClientUI/ClientView.cs index 4bbed2b..2396b64 100644 --- a/TTWebClientUI/ClientView.cs +++ b/TTWebClientUI/ClientView.cs @@ -143,6 +143,7 @@ internal class ClientView : ObservableObject public Command GetPositionsCommand { get; set; } public Command GetTradesCommand { get; set; } public Command PostTradeCommand { get; set; } + public Command CloseTradeCommand { get; set; } public Command GetTradeHistoryCommand { get; set; } public bool IsPublicEnabled @@ -538,6 +539,7 @@ public ClientView(CredsModel creds) GetPositionsCommand = new Command(async () => await GetPositions()); GetTradesCommand = new Command(async () => await GetTrades()); PostTradeCommand = new Command(async () => await PostTrade()); + CloseTradeCommand = new Command(async () => await CloseTrade()); GetTradeHistoryCommand = new Command(async () => await GetTradeHistory()); if (creds.IsPublicOnly) @@ -876,6 +878,27 @@ public async Task PostTrade() Trades = trades != null ? new ObservableCollection(trades) : null; } + public async Task CloseTrade() + { + // Account trades + List trades = null; + if (!long.TryParse(TradeId, out var tradeId)) + return; + else + { + try + { + var trade = await _client.CloseTradeAsync(tradeId, null); + trades = new List(new[] { trade.Trade }); + } + catch (Exception) + { + } + } + + Trades = trades != null ? new ObservableCollection(trades) : null; + } + #endregion #region Account trade history information diff --git a/TTWebClientUI/MainWindow.xaml b/TTWebClientUI/MainWindow.xaml index a4ebbb7..8fa781b 100644 --- a/TTWebClientUI/MainWindow.xaml +++ b/TTWebClientUI/MainWindow.xaml @@ -576,10 +576,15 @@ - -