Exemple #1
0
        public void Setup()
        {
            _expiresTimeProvider = new ExpiresTimeProvider();
            _signatureProvider   = new SignatureProvider();

            _websocketClient = new WebSocket(SocketUrl);

            _websocketClient.Error           += new EventHandler <SuperSocket.ClientEngine.ErrorEventArgs>(websocketClient_Error);
            _websocketClient.Opened          += new EventHandler(websocketClient_Opened);
            _websocketClient.MessageReceived += new EventHandler <MessageReceivedEventArgs>(websocketClient_MessageReceived);
        }
        public BitmexHttpClient()
        {
            _expiresTimeProvider = new ExpiresTimeProvider();
            _signatureProvider   = new SignatureProvider();
            //_httpClient = new HttpClient { BaseAddress = new Uri($"https://{Environments.Values[_bitmexAuthorization.BitmexEnvironment]}") };

            _httpClient = new HttpClient {
                BaseAddress = new Uri($"https://testnet.bitmex.com")
            };

            _httpClient.DefaultRequestHeaders.Add("api-key", _key ?? string.Empty);
            _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));
            _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/xml"));
            _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/javascript"));
            _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/javascript"));
        }