private async Task StopOrderAsync()
        {
            await _wsClient.NewStopOrderAsync(CommonFuncs.NewClOrdId("stop-order"), "BTC/USDT", Side.Sell, 0.01M, SpotAccountId, 9500).ConfigureAwait(false);

            var command = OrderExtensions.NewStopOrder(CommonFuncs.NewClOrdId("stop-order"), "BTC/USDT", Side.Sell, 0.01M, SpotAccountId, 9500);
            await _wsClient.SendCommandAsync(command).ConfigureAwait(false);
        }
        private async Task StopLossForExistingPositionAsync()
        {
            var command = OrderExtensions.NewStopOrder(CommonFuncs.NewClOrdId("stop-order"), "XBTUSD", Side.Sell, 1M, MarginAccountId, 9500);

            command.ForPosition(12345);
            await _wsClient.SendCommandAsync(command).ConfigureAwait(false);

            command = OrderExtensions.NewStopOrder(CommonFuncs.NewClOrdId("stop-order"), "XBTUSD", Side.Sell, 1M, MarginAccountId, 9500, positionId: 12345);
            await _wsClient.SendCommandAsync(command).ConfigureAwait(false);
        }
        /// <inheritdoc />
        public async Task NewStopOrderAsync(
            string clOrdId,
            string symbol,
            string side,
            decimal orderQty,
            ulong account,
            decimal stopPx,
            string timeInForce      = null,
            string[] execInst       = null,
            ulong positionId        = 0,
            decimal stopLossPrice   = 0,
            decimal takeProfitPrice = 0,
            decimal trailingOffset  = 0,
            decimal capPrice        = 0,
            string text             = null,
            string groupId          = null)
        {
            var command = OrderExtensions.NewStopOrder(
                clOrdId,
                symbol,
                side,
                orderQty,
                account,
                stopPx,
                timeInForce,
                execInst,
                positionId,
                stopLossPrice,
                takeProfitPrice,
                trailingOffset,
                capPrice,
                text,
                groupId);

            await SendCommandAsync(command).ConfigureAwait(false);
        }
        private async Task StopLossForExistingPositionAsync(CancellationToken cancellationToken)
        {
            var id      = CommonFuncs.NewClOrdId("stop-order-1");
            var command = OrderExtensions.NewStopOrder(id, "XBTUSD", Side.Sell, 1M, MarginAccountId, 9500);

            command.ForPosition(12345);

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

            HandleOrderReport(executionReport);

            // OR
            executionReport = await _restClient.NewStopOrderAsync(
                CommonFuncs.NewClOrdId("stop-order-2"),
                "XBTUSD",
                Side.Sell, 1M,
                MarginAccountId,
                9500,
                positionId : 12345,
                cancellationToken : cancellationToken)
                              .ConfigureAwait(false);

            HandleOrderReport(executionReport);
        }
        /// <inheritdoc />
        public async Task <ExecutionReport> NewStopOrderAsync(string clOrdId,
                                                              string symbol,
                                                              string side,
                                                              decimal orderQty,
                                                              ulong account,
                                                              decimal stopPx,
                                                              string timeInForce                  = null,
                                                              string[] execInst                   = null,
                                                              ulong positionId                    = 0,
                                                              decimal stopLossPrice               = 0,
                                                              decimal takeProfitPrice             = 0,
                                                              decimal trailingOffset              = 0,
                                                              decimal capPrice                    = 0,
                                                              string text                         = null,
                                                              string groupId                      = null,
                                                              CancellationToken cancellationToken = default)
        {
            var command = OrderExtensions.NewStopOrder(
                clOrdId,
                symbol,
                side,
                orderQty,
                account,
                stopPx,
                timeInForce,
                execInst,
                positionId,
                stopLossPrice,
                takeProfitPrice,
                trailingOffset,
                capPrice,
                text,
                groupId);

            return(await NewOrderAsync(command, cancellationToken).ConfigureAwait(false));
        }