(self, symbol)
return {k: round(float(v or 0), instrument['tickLog']) for k, v in iteritems(ticker)}
Return a ticker object. Generated from instrument.
Return a ticker object. Generated from instrument.
Return a ticker object . Generated from instrument .
def get_ticker(self, symbol):
        '''Return a ticker object. Generated from instrument.'''

        instrument = self.get_instrument(symbol)

        # If this is an index, we have to get the data from the last trade.
        if instrument['symbol'][0] == '.':
            ticker = {}
            ticker['mid'] = ticker['buy'] = ticker['sell'] = ticker['last'] = instrument['markPrice']
        # Normal instrument
        else:
            bid = instrument['bidPrice'] or instrument['lastPrice']
            ask = instrument['askPrice'] or instrument['lastPrice']
            ticker = {
                "last": instrument['lastPrice'],
                "buy": bid,
                "sell": ask,
                "mid": (bid + ask) / 2
            }

        # The instrument has a tickSize. Use it to round values.
        return {k: round(float(v or 0), instrument['tickLog']) for k, v in iteritems(ticker)}
def get_ticker ( self , symbol ) : instrument = self . get_instrument ( symbol ) # If this is an index, we have to get the data from the last trade. if instrument [ 'symbol' ] [ 0 ] == '.' : ticker = { } ticker [ 'mid' ] = ticker [ 'buy' ] = ticker [ 'sell' ] = ticker [ 'last' ] = instrument [ 'markPrice' ] # Normal instrument else : bid = instrument [ 'bidPrice' ] or instrument [ 'lastPrice' ] ask = instrument [ 'askPrice' ] or instrument [ 'lastPrice' ] ticker = { "last" : instrument [ 'lastPrice' ] , "buy" : bid , "sell" : ask , "mid" : ( bid + ask ) / 2 } # The instrument has a tickSize. Use it to round values. return { k : round ( float ( v or 0 ) , instrument [ 'tickLog' ] ) for k , v in iteritems ( ticker ) }