Esempio n. 1
0
 async def test_channel_subscribe(self, r):
     r = StrictRedis(host='localhost', port=6390)
     p = r.pubsub()
     with pytest.raises(ConnectionError):
         await p.subscribe('foo')
Esempio n. 2
0
'''
IV Chart Bokeh App

Bokeh App Docs: https://docs.bokeh.org/en/latest/docs/user_guide/server.html

`bokeh serve --show iv_app.py` from the project root

Live plot bid/mid/ask IV and BTC price
'''
# logging setup
logging.config.fileConfig('config/logging.conf')
logger = logging.getLogger(__name__)

# Redis setup
r = StrictRedis(host='localhost', decode_responses=True)
p = r.pubsub()

# Main Bokeh Doc
doc = curdoc()

# Bitcoin price datasource
adapter = CustomJS(code="""
    var price = cb_data.response['data']['amount']
    var data = {x: [price], y: [0]}
    console.log(price)
    return data 
""")
btc_price_source = AjaxDataSource(
    data_url='https://api.coinbase.com/v2/prices/BTC-USD/spot',
    method='GET',
    polling_interval=3000,