brighter-trading/static/general.js

89 lines
2.6 KiB
JavaScript

//
//class Backtesting {
// constructor() {
// this.height = height;
// }
//}
//
//class Trade {
// constructor() {
// this.height = height;
// }
//}
//class Strategies {
// constructor() {
// this.height = height;
// }
//}
//class Exchange_Info {
// constructor() {
// this.height = height;
// }
//}
//
//class Alerts {
// 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();
/* These classes interact with HTML elements that need to be parsed first */
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);
});
/* 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);
}
}
UI = new User_Interface();