Ejemplo n.º 1
0
        public void CreateSignature_ShouldReturnCorrectString()
        {
            var nonce     = BitfinexAuthentication.CreateAuthNonce(123456);
            var payload   = BitfinexAuthentication.CreateAuthPayload(nonce);
            var signature = BitfinexAuthentication.CreateSignature(payload, "api_secret");

            Assert.Equal("cbe5ac2d70f8bb8246e31906d872408c29097df8c97a935ce367a93f57e47af51e033939a07cd5ecf1e078e7f7c9a344", signature);
        }
        public AuthenticationRequest(string apiKey, string apiSecret)
        {
            BfxValidations.ValidateInput(apiKey, nameof(apiKey));
            BfxValidations.ValidateInput(apiSecret, nameof(apiSecret));

            ApiKey = apiKey;

            AuthNonce   = BitfinexAuthentication.CreateAuthNonce();
            AuthPayload = BitfinexAuthentication.CreateAuthPayload(AuthNonce);

            AuthSig = BitfinexAuthentication.CreateSignature(AuthPayload, apiSecret);
        }
Ejemplo n.º 3
0
        private void Authenticate()
        {
            var n = nonce;
            var authentication = new BitfinexAuthentication()
            {
                Event   = "auth",
                ApiKey  = ApiKey,
                Nonce   = n,
                Payload = "AUTH" + n
            };

            authentication.Signature = GetHexHashSignature(authentication.Payload);

            socket.Send(JsonConvert.SerializeObject(authentication));
        }
Ejemplo n.º 4
0
        private void Authenticate()
        {
            var n = nonce;
            var authentication = new BitfinexAuthentication()
            {
                Event   = "auth",
                ApiKey  = apiKey,
                Nonce   = n,
                Payload = "AUTH" + n
            };

            authentication.Signature = ByteToString(encryptedSecret.ComputeHash(Encoding.ASCII.GetBytes(authentication.Payload)));

            Socket.Send(JsonConvert.SerializeObject(authentication));
        }
        /// <summary>
        /// Authentication request
        /// </summary>
        /// <param name="apiKey">Your API key</param>
        /// <param name="apiSecret">Your API secret</param>
        /// <param name="deadManSwitchEnabled">Dead-Man-Switch flag (optional), when socket is closed, cancel all account orders</param>
        public AuthenticationRequest(string apiKey, string apiSecret, bool deadManSwitchEnabled)
        {
            BfxValidations.ValidateInput(apiKey, nameof(apiKey));
            BfxValidations.ValidateInput(apiSecret, nameof(apiSecret));

            ApiKey = apiKey;

            AuthNonce   = BitfinexAuthentication.CreateAuthNonce();
            AuthPayload = BitfinexAuthentication.CreateAuthPayload(AuthNonce);

            AuthSig = BitfinexAuthentication.CreateSignature(AuthPayload, apiSecret);

            if (deadManSwitchEnabled)
            {
                Dms = 4;
            }
        }
Ejemplo n.º 6
0
        private BitfinexAuthentication GetAuthObject(params string[] filter)
        {
            var n = Nonce;
            var authentication = new BitfinexAuthentication
            {
                Event   = "auth",
                ApiKey  = authProvider.Credentials.Key.GetString(),
                Nonce   = n,
                Payload = "AUTH" + n
            };

            if (filter.Any())
            {
                authentication.Filter = filter;
            }
            authentication.Signature = authProvider.Sign(authentication.Payload).ToLower();
            return(authentication);
        }
        private void Authenticate()
        {
            if (authProvider == null || !running)
            {
                return;
            }

            var n = Nonce;
            var authentication = new BitfinexAuthentication()
            {
                Event   = "auth",
                ApiKey  = authProvider.Credentials.Key,
                Nonce   = n,
                Payload = "AUTH" + n
            };

            authentication.Signature = authProvider.Sign(authentication.Payload).ToLower();

            Send(JsonConvert.SerializeObject(authentication));
        }