private async Task SltpGroupAsync(CancellationToken cancellationToken)
        {
            var id      = CommonFuncs.NewClOrdId("limit-sltp-1");
            var command = OrderExtensions.NewLimitOrder(id, "XBTUSD", Side.Sell, 1M, MarginAccountId, 10600);

            command.AddTrailingStopLoss(500);
            command.AddTakeProfit(10000);

            var executionReport = await _restClient.NewOrderAsync(command, cancellationToken).ConfigureAwait(false);

            HandleOrderReport(executionReport);

            // OR
            executionReport = await _restClient.NewLimitOrderAsync(
                CommonFuncs.NewClOrdId("limit-sltp-2"),
                "XBTUSD",
                Side.Sell,
                1M,
                MarginAccountId,
                10600,
                trailingOffset : 500,
                takeProfitPrice : 10000,
                cancellationToken : cancellationToken).ConfigureAwait(false);

            HandleOrderReport(executionReport);
        }
Example #2
0
        public async Task Test_NewOrder()
        {
            var command = OrderExtensions.NewLimitOrder(NewClOrdId("limit"), "XBTUSD", Side.Sell, 1M,
                                                        MarginAccountId, 10000M);

            var er = await _restClient.NewOrderAsync(command, _token).ConfigureAwait(false);

            er.Should().NotBeNull();
            er.Should().NotBeNull();
            er.ExecType.Should().Be(ExecType.PendingNewExec);
        }