// //class Header { // constructor() { // this.height = height; // } //} class User_Interface{ /* This contains all the code for our User interface. The code is separated into classes that maintain and provide the data and functionality of each panel of the UI. */ constructor() { /*The Exchanges class is is responsible for maintaining and retrieving exchanges data from the server. Also issuing exchange related commands to the server.*/ this.exchanges = new Exchanges(); /* Data object is responsible for fetching and maintaining up-to-date configurable and variable data for the UI */ this.data = new Data(); /* The object that handles the interface controls.*/ this.controls = new Controls(); /* The object that handles the signals interface.*/ this.signals = new Signals(this.data.indicators); /* The object that handles alerts. Pass in the html element that will hold the list of alerts*/ this.alerts = new Alerts("alert_list"); /* The object that handles alerts. Pass in the html element that will hold the strategies interface.*/ this.strats = new Strategies("strats_display"); /* The object that handles trades. Pass in the html element that will hold the trade interface.*/ this.trade = new Trade(); /* The object that handles user log in */ this.users = new Users(); /* Indicators contains methods that interact with indicator related menus and update indicator output in charts and panels. */ this.indicators = new Indicators(); /* Register an Indicator callback method to receive updates from the data class. */ this.data.registerCallback_i_updates(this.indicators.update); window.addEventListener('load', function () { /* This javascript files are loaded before the entire HTML document gets parsed. Place initializers here to be executed after the document is loaded. */ /* Charts object is responsible for maintaining the data visualisation area in the UI. */ let chart_init_data = { chart1_id : window.UI.data.chart1_id, chart2_id : window.UI.data.chart2_id, chart3_id : window.UI.data.chart3_id, trading_pair : window.UI.data.trading_pair, price_history : window.UI.data.price_history } window.UI.charts = new Charts(chart_init_data); /* Pass the initialization data to indicators. */ let ind_init_data = { // A list of indicator object available for display. indicators: window.UI.data.indicators, // Output data - indicator specific format. Example: list of indexed value, bools, or colours codes. indicator_data: window.UI.data.indicator_data }; // Pass in a reference to Charts so the indicators can update them directly window.UI.indicators.addToCharts(window.UI.charts, ind_init_data); /* Request Initialization data from the server. All incoming data is forwarded to any registered callback functions. */ window.UI.signals.request_signals(); window.UI.alerts.set_target(); window.UI.strats.initialize(); window.UI.controls.init_TP_selector(); window.UI.trade.initialize(); window.UI.exchanges.initialize(); }); } } UI = new User_Interface();