def dxfeed(): dxf = dx.Endpoint(connection_address=ValueStorage.demo_address) yield dxf dxf.close_connection()
def test_connection_fail_on_incorrect_address(): dxfeed = dx.Endpoint(connection_address='8.8.8.8')
def test_endpoint_no_arguments(): dxf = dx.Endpoint() assert 'Connected' == dxf.connection_status
def test_create_endpoint_without_connection(): dxf = dx.Endpoint(connect=False) assert 'Not connected' == dxf.connection_status
import pytz from dateutil.relativedelta import relativedelta # Dash imports import dash import dash_core_components as dcc import dash_html_components as html import plotly.graph_objects as go from dash.dependencies import Input, Output # dxFeed init date_time = datetime.now() - relativedelta(hours=2) dxf_initialize_logger( f'logs/dx_logs_{datetime.now().strftime("%Y%m%d_%H%M")}.log', True, True, True) endpoint = dx.Endpoint('demo.dxfeed.com:7300') candle_subscription = endpoint.create_subscription('Candle', date_time=date_time) candle_handler = CandleHandler(100) candle_subscription.set_event_handler(candle_handler).add_symbols( ['AAPL&Q{=5m}', 'AMZN&Q{=5m}']) # external JavaScript files external_scripts = [ 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js', ] # Dash app app = dash.Dash(__name__, title='dxFeed Candle Charting',