Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion TTWebClient/Domain/TTTrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ public class TTTrade
/// <summary>Trigger Time</summary>
public DateTime? TriggerTime { get; set; }

/// <summary>Commission</summary>
/// <summary>Order Id Triggered By</summary>
public long? OrderIdTriggeredBy { get; set; }

/// <summary>Close Price</summary>
public decimal? ClosePrice { get; set; }
}
}
2 changes: 1 addition & 1 deletion TTWebClient/TTWebClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TTWebClient</RootNamespace>
<AssemblyName>TTWebClient</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
Expand Down
12 changes: 6 additions & 6 deletions TTWebClient/app.config
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Sigil" publicKeyToken="2d06c3494341c8ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
<assemblyIdentity name="Sigil" publicKeyToken="2d06c3494341c8ab" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
10 changes: 5 additions & 5 deletions TTWebClientRobot/App.config
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Sigil" publicKeyToken="2d06c3494341c8ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
<assemblyIdentity name="Sigil" publicKeyToken="2d06c3494341c8ab" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
2 changes: 1 addition & 1 deletion TTWebClientRobot/TTWebClientRobot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TTWebClientRobot</RootNamespace>
<AssemblyName>TTWebClientRobot</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
Expand Down
10 changes: 5 additions & 5 deletions TTWebClientSample/App.config
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Sigil" publicKeyToken="2d06c3494341c8ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
<assemblyIdentity name="Sigil" publicKeyToken="2d06c3494341c8ab" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
2 changes: 1 addition & 1 deletion TTWebClientSample/TTWebClientSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TTWebClientSample</RootNamespace>
<AssemblyName>TTWebClientSample</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
Expand Down
10 changes: 5 additions & 5 deletions TTWebClientUI/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Sigil" publicKeyToken="2d06c3494341c8ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
<assemblyIdentity name="Sigil" publicKeyToken="2d06c3494341c8ab" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
23 changes: 23 additions & 0 deletions TTWebClientUI/ClientView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -876,6 +878,27 @@ public async Task PostTrade()
Trades = trades != null ? new ObservableCollection<TTTrade>(trades) : null;
}

public async Task CloseTrade()
{
// Account trades
List<TTTrade> trades = null;
if (!long.TryParse(TradeId, out var tradeId))
return;
else
{
try
{
var trade = await _client.CloseTradeAsync(tradeId, null);
trades = new List<TTTrade>(new[] { trade.Trade });
}
catch (Exception)
{
}
}

Trades = trades != null ? new ObservableCollection<TTTrade>(trades) : null;
}

#endregion

#region Account trade history information
Expand Down
14 changes: 10 additions & 4 deletions TTWebClientUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -576,10 +576,15 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button Content="GET" Command="{Binding Path=ClientView.GetTradesCommand}"/>
<Label Content="Trade Id:"/>
<TextBox Text="{Binding Path=ClientView.TradeId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<StackPanel Grid.Row="0" Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Button Content="GET" Command="{Binding Path=ClientView.GetTradesCommand}"/>
<Label Content="Trade Id:"/>
<TextBox Text="{Binding Path=ClientView.TradeId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="DELETE" Command="{Binding Path=ClientView.CloseTradeCommand}"/>
</StackPanel>
</StackPanel>
<ListView Grid.Row="1" ItemsSource="{Binding Path=ClientView.Trades}">
<ListView.View>
Expand Down Expand Up @@ -619,6 +624,7 @@
<GridViewColumn Header="TriggerTime" DisplayMemberBinding="{Binding Path=TriggerTime}"/>
<GridViewColumn Header="TradeIdTriggeredBy" DisplayMemberBinding="{Binding Path=OrderIdTriggeredBy}"/>
<GridViewColumn Header="Comment" DisplayMemberBinding="{Binding Path=Comment}"/>
<GridViewColumn Header="ClosePrice" DisplayMemberBinding="{Binding Path=ClosePrice}"/>
</GridView.Columns>
</GridView>
</ListView.View>
Expand Down
2 changes: 1 addition & 1 deletion TTWebClientUI/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion TTWebClientUI/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion TTWebClientUI/TTWebClientUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TTWebClientUI</RootNamespace>
<AssemblyName>TTWebClientUI</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
Expand Down