BitMEX / api-connectors

Libraries for connecting to the BitMEX API.
https://www.bitmex.com/app/restAPI
909 stars 797 forks source link

SwaggerValidationWarning at new instance initiation #279

Open golfdriver opened 5 years ago

golfdriver commented 5 years ago

When I put client = bitmex.bitmex() the following message is returned. Is it ok to proceed with the warning?

validator20.py:56: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information. warnings.warn(swagger_validation_warning)

Also, when I issue a quote request as on the github page, the following is returned. Please let me know whether it is an issue on my side. Please note that the 403 Forbidden is the part of the returned value that is interpreted as html.

Traceback (most recent call last): File "", line 1, in File "rest/lib/python3.5/site-packages/bravado/http_future.py", line 214, in result swagger_result = self._get_swagger_result(incoming_response) File "rest/lib/python3.5/site-packages/bravado/http_future.py", line 97, in wrapper return func(self, *args, **kwargs) File "rest/lib/python3.5/site-packages/bravado/http_future.py", line 239, in _get_swagger_result self.request_config.response_callbacks, File "rest/lib/python3.5/site-packages/bravado/http_future.py", line 284, in unmarshal_response raise_on_expected(incoming_response) File "rest/lib/python3.5/site-packages/bravado/http_future.py", line 344, in raise_on_expected swagger_result=http_response.swagger_result) bravado.exception.HTTPForbidden: 403 Forbidden:

403 Forbidden

403 Forbidden

Thank you,

ghost commented 5 years ago

I get the same error. I use simple:

client = bitmex.bitmex()
client.Quote.Quote_get(symbol='XBTUSD').result()

and get error:

SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information.
  warnings.warn(swagger_validation_warning)
Traceback (most recent call last):
  File "C:/Users/Valentin/PycharmProjects/projekt/testBitmex.py", line 12, in <module>
    client.Quote.Quote_get(symbol='XBTUSD').result()
  File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bravado\http_future.py", line 214, in result
    swagger_result = self._get_swagger_result(incoming_response)
  File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bravado\http_future.py", line 97, in wrapper
    return func(self, *args, **kwargs)
  File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bravado\http_future.py", line 239, in _get_swagger_result
    self.request_config.response_callbacks,
  File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bravado\http_future.py", line 284, in unmarshal_response
    raise_on_expected(incoming_response)
  File "C:\Users\Valentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bravado\http_future.py", line 344, in raise_on_expected
    swagger_result=http_response.swagger_result)
bravado.exception.HTTPForbidden: 403 Forbidden: <html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
</body>
</html>
sunoy14 commented 5 years ago

I am using python

client = bitmex.bitmex() gives swagger validation warning and I too get forbidden message when using result()

this library seems unusable at the moment. or am i missing something?

please help

bitRomney commented 5 years ago

I am using python

client = bitmex.bitmex() gives swagger validation warning and I too get forbidden message when using result()

this library seems unusable at the moment. or am i missing something?

please help

1 I wrote a tutorial here: https://link.medium.com/qDRwB8KgqT

Another common error is

ImportError: No module named parse.

Taken care of with try-catch (see tutorial).

2 Some may still see this error

/Library/Python/2.7/site-packages/swagger_spec_validator/validator20.py:56: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information.
  warnings.warn(swagger_validation_warning)

You can comment out the line 56 of validator20.py where it prints the error because the request is already successful

3 Getting a simple Price Quote To avoid getting the 403 Forbidden error(They closed the Quote endpoint) use this to get the current price by using another endpoint. orderBook/L2 python:

import requests, json
response = requests.get("https://www.bitmex.com/api/v1/orderBook/L2?symbol=eth&depth=1 …").json()
ether_bid_price = response[1]['price']
pastet89 commented 5 years ago

The warning has nothing to do with the Forbidden response. The Quote endpoint was closed by Bitmex, hence the 403 response code.

To suppress the warning, use:

import warnings
from swagger_spec_validator.common import SwaggerValidationWarning

def __init__():
    warnings.simplefilter("ignore", SwaggerValidationWarning)
    # and here initialize the client
kadnan commented 3 years ago

I am using python client = bitmex.bitmex() gives swagger validation warning and I too get forbidden message when using result() this library seems unusable at the moment. or am i missing something? please help

1 I wrote a tutorial here: https://link.medium.com/qDRwB8KgqT

Another common error is

ImportError: No module named parse.

Taken care of with try-catch (see tutorial).

2 Some may still see this error

/Library/Python/2.7/site-packages/swagger_spec_validator/validator20.py:56: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information.
  warnings.warn(swagger_validation_warning)

You can comment out the line 56 of validator20.py where it prints the error because the request is already successful

3 Getting a simple Price Quote To avoid getting the 403 Forbidden error(They closed the Quote endpoint) use this to get the current price by using another endpoint. orderBook/L2 python:

import requests, json
response = requests.get("https://www.bitmex.com/api/v1/orderBook/L2?symbol=eth&depth=1 …").json()
ether_bid_price = response[1]['price']

I am getting the message:

/Users/XX/Data/anaconda3/lib/python3.7/site-packages/swagger_spec_validator/validator20.py:53: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information. (path #/definitions/User/properties/preferences)
  ref_dict['$ref'], '/'.join(path),
pastet89 commented 3 years ago

Not sure how appropriate this answer is, however Bitmex API is hopeless. I lost months trying to get something to work with it and finally gave up. Also, Bitmex is notorious for blocking your access when a lot of liquidations happen so it is dangerous. I moved to Deribit I am extremely happy. Their API is perfect, no bugs, 10/10, even the request limits are higher.

On Thu, Nov 19, 2020 at 9:57 AM Adnan Siddiqi notifications@github.com wrote:

I am using python client = bitmex.bitmex() gives swagger validation warning and I too get forbidden message when using result() this library seems unusable at the moment. or am i missing something? please help

1 I wrote a tutorial here: https://link.medium.com/qDRwB8KgqT

Another common error is

ImportError: No module named parse.

Taken care of with try-catch (see tutorial).

2 Some may still see this error

/Library/Python/2.7/site-packages/swagger_spec_validator/validator20.py:56: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information.

warnings.warn(swagger_validation_warning)

You can comment out the line 56 of validator20.py where it prints the error because the request is already successful

3 Getting a simple Price Quote To avoid getting the 403 Forbidden error(They closed the Quote endpoint) use this to get the current price by using another endpoint. orderBook/L2 python:

import requests, json

response = requests.get("https://www.bitmex.com/api/v1/orderBook/L2?symbol=eth&depth=1 …").json()

ether_bid_price = response[1]['price']

I am getting the message:

/Users/XX/Data/anaconda3/lib/python3.7/site-packages/swagger_spec_validator/validator20.py:53: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information. (path #/definitions/User/properties/preferences)

ref_dict['$ref'], '/'.join(path),

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BitMEX/api-connectors/issues/279#issuecomment-730197259, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABY7QALI4JKYX3VXX3QTRZDSQTFXFANCNFSM4GGFBQ5Q .