// //class Backtesting { // constructor() { // this.height = height; // } //} // //class Trade { // constructor() { // this.height = height; // } //} //class Exchange_Info { // constructor() { // this.height = height; // } //} // //class Header { // constructor() { // this.height = height; // } //} // //class Statistics { // 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() { /* 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 list of alerts*/ this.strats = new Strategies("strats_display"); /* These classes interact with HTML elements that need to be parsed first. TODO: Can any of these objects be created then run init functions after loading?*/ window.addEventListener('load', function () { /* 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); /* The Indicators object is responsible for interactions with the edit indicator menu and updating the display on the charts.*/ let ind_init_data = { indicators: window.UI.data.indicators, indicator_data: window.UI.data.indicator_data } /* Pass the initialization for the indicators and a reference to the charts object so the indicators can update it directly.*/ window.UI.indicators = new Indicators(window.UI.charts, ind_init_data); /* Point the callback fired when indicator updates are received to the indicator class object.*/ window.UI.data.set_i_updates(window.UI.indicators.update); // Request data from the server. Receives it in a callback function then injects the html. window.UI.signals.request_signals(); // initialize the alerts instance. window.UI.alerts.set_target(); // initialize the strategies instance. window.UI.strats.initialize(); }); } } UI = new User_Interface();