Hello i have a error with the bitmex rest api connection

750 Views Asked by At

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


2

There are 2 best solutions below

0
On

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.

2
On

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.