(self, base_url=None, symbol=None, login=None, password=None, otpToken=None,
                 apiKey=None, apiSecret=None, orderIDPrefix='mm_bitmex_', shouldWSAuth=True)
Init connector.
Init connector.
Init connector .
def __init__(self, base_url=None, symbol=None, login=None, password=None, otpToken=None,
                 apiKey=None, apiSecret=None, orderIDPrefix='mm_bitmex_', shouldWSAuth=True):
        """Init connector."""
        self.logger = logging.getLogger('root')
        self.base_url = base_url
        self.symbol = symbol
        self.token = None
        # User/pass auth is no longer supported
        if (login or password or otpToken):
            raise Exception("User/password authentication is no longer supported via the API. Please use " +
                            "an API key. You can generate one at https://www.bitmex.com/app/apiKeys")
        self.apiKey = apiKey
        self.apiSecret = apiSecret
        if len(orderIDPrefix) > 13:
            raise ValueError("settings.ORDERID_PREFIX must be at most 13 characters long!")
        self.orderIDPrefix = orderIDPrefix

        # Prepare HTTPS session
        self.session = requests.Session()
        # These headers are always sent
        self.session.headers.update({'user-agent': 'liquidbot-' + constants.VERSION})
        self.session.headers.update({'content-type': 'application/json'})
        self.session.headers.update({'accept': 'application/json'})

        # Create websocket for streaming data
        self.ws = BitMEXWebsocket()
        self.ws.connect(base_url, symbol, shouldAuth=shouldWSAuth)
def __init__ ( self , base_url = None , symbol = None , login = None , password = None , otpToken = None , apiKey = None , apiSecret = None , orderIDPrefix = 'mm_bitmex_' , shouldWSAuth = True ) : self . logger = logging . getLogger ( 'root' ) self . base_url = base_url self . symbol = symbol self . token = None # User/pass auth is no longer supported if ( login or password or otpToken ) : raise Exception ( "User/password authentication is no longer supported via the API. Please use " + "an API key. You can generate one at https://www.bitmex.com/app/apiKeys" ) self . apiKey = apiKey self . apiSecret = apiSecret if len ( orderIDPrefix ) > 13 : raise ValueError ( "settings.ORDERID_PREFIX must be at most 13 characters long!" ) self . orderIDPrefix = orderIDPrefix # Prepare HTTPS session self . session = requests . Session ( ) # These headers are always sent self . session . headers . update ( { 'user-agent' : 'liquidbot-' + constants . VERSION } ) self . session . headers . update ( { 'content-type' : 'application/json' } ) self . session . headers . update ( { 'accept' : 'application/json' } ) # Create websocket for streaming data self . ws = BitMEXWebsocket ( ) self . ws . connect ( base_url , symbol , shouldAuth = shouldWSAuth )