private async Task ReplaceAsync(CancellationToken cancellationToken) { var executionReport = await _restClient.NewLimitOrderAsync( CommonFuncs.NewClOrdId("limit"), "XBTUSD", Side.Buy, 1M, MarginAccountId, 10000, cancellationToken : cancellationToken).ConfigureAwait(false); var replaceCommand = executionReport.ToOrderCancelReplaceRequest(CommonFuncs.NewClOrdId("replace")); replaceCommand.OrderQty = 2M.ToFixString(); var replaceResponse = await _restClient.ReplaceOrderAsync(replaceCommand, cancellationToken) .ConfigureAwait(false); HandleOrderReport(replaceResponse); }
public async Task Test_ReplaceOrderSingle() { var newOrderCmd = OrderExtensions.NewLimitOrder(NewClOrdId("limit"), "XBTUSD", Side.Sell, 1M, MarginAccountId, 10000M); var newOrderEr = await _restClient.NewOrderAsync(newOrderCmd, _token).ConfigureAwait(false); newOrderEr.Should().NotBeNull(); newOrderEr.Should().NotBeNull(); newOrderEr.ExecType.Should().Be(ExecType.PendingNewExec); var replaceOrderCmd = newOrderEr.ToOrderCancelReplaceRequest(NewClOrdId("cancel")); replaceOrderCmd.Price = 10500M.ToFixString(); var replaceOrderEr = await _restClient.ReplaceOrderAsync(replaceOrderCmd, _token).ConfigureAwait(false); replaceOrderEr.Should().NotBeNull(); replaceOrderEr.Should().NotBeNull(); replaceOrderEr.ExecType.Should().Be(ExecType.PendingReplaceExec); }