示例#1
0
        public JsonResult SendAmendPosition([FromBody] Params param)
        {
            _tcpClient = new TcpClient(param.ApiHost, param.ApiPort);;
            _apiSocket = new SslStream(_tcpClient.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate), null);
            _apiSocket.AuthenticateAsClient(param.ApiHost);
            SendAuthorizationRequest(param);
            List <string> data = new List <string>();

            var msgFactory = new OpenApiMessagesFactory();
            var msg        = msgFactory.CreateAmendPositionProtectionRequest(param.AccountId, param.AccessToken.ToString(), param.PositionId, param.StopLossPrice, param.TakeProfitPrice);

            Transmit(msg);
            byte[] _message     = Listen(_apiSocket);
            var    protoMessage = msgFactory.GetMessage(_message);

            data.Add(OpenApiMessagesPresentation.ToString(protoMessage));
            return(Json(new { data }));
        }