Issue #107: Added function PositionCloseAll

This commit is contained in:
vdemydiuk
2018-06-06 14:24:39 +03:00
parent 897892dc89
commit 0c38d37559
6 changed files with 47 additions and 5 deletions
@@ -486,6 +486,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Button Grid.Row="0" Command="{Binding PositionOpenCommand}" Content="PositionOpen" Margin="2" HorizontalAlignment="Left"/>
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="4">
@@ -493,6 +494,7 @@
<TextBox Text="{Binding PositionTicketValue}" Width="150" Margin="2"/>
<Button Command="{Binding PositionCloseCommand}" Content="PositionClose" Margin="2"/>
</StackPanel>
<Button Grid.Row="2" Command="{Binding PositionCloseAllCommand}" Content="PositionCloseAll" Margin="2" HorizontalAlignment="Left"/>
</Grid>
</TabItem>
@@ -67,6 +67,7 @@ namespace MtApi5TestClient
public DelegateCommand PositionOpenCommand { get; private set; }
public DelegateCommand PositionCloseCommand { get; private set; }
public DelegateCommand PositionCloseAllCommand { get; private set; }
public DelegateCommand GetLastErrorCommand { get; private set; }
public DelegateCommand ResetLastErrorCommand { get; private set; }
@@ -375,6 +376,7 @@ namespace MtApi5TestClient
PositionOpenCommand = new DelegateCommand(ExecutePositionOpen);
PositionCloseCommand = new DelegateCommand(ExecutePositionClose);
PositionCloseAllCommand = new DelegateCommand(ExecutePositionCloseAll);
PrintCommand = new DelegateCommand(ExecutePrint);
AlertCommand = new DelegateCommand(ExecuteAlert);
@@ -1126,6 +1128,12 @@ namespace MtApi5TestClient
AddLog($"PositionClose: ticket {ticket} retVal = {retVal}, result = {tradeResult}");
}
private async void ExecutePositionCloseAll(object obj)
{
var retVal = await Execute(() => _mtApiClient.PositionCloseAll());
AddLog($"PositionCloseAll: count = {retVal}");
}
private async void ExecutePrint(object obj)
{
var message = MessageText;