1

i have a problem with the Bitmex Api, im trying to connect to the api for send orders for buy or sell and i realice the instalation for bitmex:

pip3 install bitmex

and after i realice the connection with the suggest command:

from bitmex import bitmex
import requests, json
api_key = ''#i put here the api key
api_secret = ''#i put here the api secret key
client = bitmex(test=False, api_key=api_key, api_secret=api_secret)

after of this i run for check that all its runing ok, and receive this error:

Warning (from warnings module): File "C:\Users\neoma\AppData\Local\Programs\Python\Python38-32\lib\site-packages\swagger_spec_validator\validator20.py", line 49 warnings.warn( 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)

i same try with the websocket bitmex version. i can connect, but with this version i can't realice orders for buy or sell. on this version i try with the next method and work. but i think that this version on websocket its only for consults.

from bitmex_websocket import BitMEXWebsocket
ws = BitMEXWebsocket(endpoint="https://testnet.bitmex.com/api/v1", symbol="XBTUSD", api_key="...", api_secret="...").

i'm not sure what i can does for that the bitmex REST API version work (the first that i share on this text). someone can help me with this error? . thanks


Gabriel
  • 11
  • 3

2 Answers2

2

Its a warning, not an error. I get the same warning, but everything works fine, from getting Orders, positions or placing orders. Just ignore it.

  • Can you explain the the warning means, and what he can do to avoid it? Usually, it's not a good idea to ignore warnings. – Higigig Jun 13 '20 at 20:14
  • sry, not sure what it is exactly about, here you can have a look at its origin line 49: https://github.com/Yelp/swagger_spec_validator/blob/master/swagger_spec_validator/validator20.py We are using the bitmex module and the bitmex module itself uses swagger(API stuff). Swagger sees that an "siblings case"(line 38-39) occures and returns the warning above. Usually, its not a good idea to ignore warnings, right, but in this case the warning is somehow not for us, but for the devs of the bitmex module. If they ignored it and swagger says it doesnt "contradict the spec"(line 38) it should be fine – Severin Ludwig Jun 15 '20 at 21:05
1

This warning occurs if a ref_dict has siblings that will be overwritten by $ref or $ref is None.

It is a warning resulting from a validation check performed on the data returned from the BitMEX servers.

It has nothing to do with your implementation and should only be taken into consideration by the API team at BitMEX when deciding how to return their data.

You can safely ignore it.

While the siblings case does not contradict the spec, it may cause confusion and mislead developers. See https://stackoverflow.com/a/48114924.

You can suppress swagger validation warnings by using:

import warnings
from swagger_spec_validator.common import SwaggerValidationWarning

def __init__():
warnings.simplefilter("ignore", SwaggerValidationWarning)

You cannot place orders using a BitMEX WebSocket connection, it is just for streaming updates.

Sean Thorburn
  • 1,728
  • 17
  • 31