예제 #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);
        }
        /// <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;
            }
        }