Multi Exchange, Multi Market adaptations part 1

This commit is contained in:
Luis Fernando Molina committed 2019-04-02 14:32:26 +02:00
1 parent 8b878bbb74
commit b459856f1f
4 files changed
+17 -9

No files matched your search

+1 -1
View File
@@ -94,7 +94,7 @@ function convertTimePeriodToName(pTimePeriod) {
window.AT_BREAKPOINT = false;
const INITIAL_DEFAULT_MARKET = 2; // This is the market that will be shown when loading the site for the first time.
const SUPPORTED_EXCHANGES = ["Poloniex", "Coss"];
const DEFAULT_EXCHANGE = "Poloniex";
const DEFAULT_MARKET = {
assetA: "USDT",
+8 -4
View File
@@ -33,6 +33,8 @@ function newPlottersManager () {
let initializationReady = false
let productsPanel
let exchange
let market
return thisObject
@@ -97,13 +99,15 @@ function newPlottersManager () {
}
}
function initialize (pProductsPanel, callBackFunction) {
function initialize (pProductsPanel, pExchange, pMarket, callBackFunction) {
try {
if (INFO_LOG === true) { logger.write('[INFO] initialize -> Entering function.') }
/* Remember the Products Panel */
productsPanel = pProductsPanel
exchange = pExchange
market = pMarket
/* Listen to the event of change of status */
@@ -222,7 +226,7 @@ function newPlottersManager () {
let host = ecosystem.getHost(COMPETITION_HOST)
let competition = ecosystem.getCompetition(host, COMPETITION)
storage.initialize(host, competition, DEFAULT_EXCHANGE, DEFAULT_MARKET, onCompetitionStorageInitialized)
storage.initialize(host, competition, exchange, market, onCompetitionStorageInitialized)
function onCompetitionStorageInitialized (err) {
try {
@@ -461,7 +465,7 @@ function newPlottersManager () {
}
}
storage.initialize(pProductCard.devTeam, pProductCard.bot, pProductCard.product, DEFAULT_EXCHANGE, DEFAULT_MARKET, datetime, timePeriod, onProductStorageInitialized)
storage.initialize(pProductCard.devTeam, pProductCard.bot, pProductCard.product, exchange, market, datetime, timePeriod, onProductStorageInitialized)
function onProductStorageInitialized (err) {
try {
@@ -505,7 +509,7 @@ function newPlottersManager () {
plotter.container.frame.position.x = thisObject.container.frame.width / 2 - plotter.container.frame.width / 2
plotter.container.frame.position.y = thisObject.container.frame.height / 2 - plotter.container.frame.height / 2
plotter.initialize(storage, DEFAULT_EXCHANGE, DEFAULT_MARKET, datetime, timePeriod, onPlotterInizialized)
plotter.initialize(storage, exchange, market, datetime, timePeriod, onPlotterInizialized)
function onPlotterInizialized () {
try {
+2 -2
View File
@@ -78,7 +78,7 @@ function newTimeMachine () {
timelineChart.container.frame.position.x = thisObject.container.frame.width / 2 - timelineChart.container.frame.width / 2
timelineChart.container.frame.position.y = timelineChart.container.frame.height * 1.5 * iteration
timelineChart.initialize(productsPanel, onDefaultMarketInitialized)
timelineChart.initialize(productsPanel, DEFAULT_EXCHANGE, DEFAULT_MARKET, onDefaultMarketInitialized)
iteration++
@@ -110,7 +110,7 @@ function newTimeMachine () {
function initializeTimelineChart (item, key, mapObj) {
if (INFO_LOG === true) { logger.write('[INFO] initialize -> initializeTheRestOfTheMarkets -> initializeTimelineChart -> Entering function.') }
if (key === INITIAL_DEFAULT_MARKET) {
if (key === DEFAULT_MARKET.assetA + '.' + DEFAULT_MARKET.assetB) {
// We skip this market since it has already been initialized.
return
+6 -2
View File
@@ -45,6 +45,8 @@
let canDrawLogoAA = false
let plotterManager
let exchange
let market
return thisObject
@@ -58,11 +60,13 @@
}
}
function initialize (pProductsPanel, callBackFunction) {
function initialize (pProductsPanel, pExchange, pMarket, callBackFunction) {
try {
if (INFO_LOG === true) { logger.write('[INFO] initialize -> Entering function.') }
/* We load the logow we will need for the background. */
exchange = pExchange
market = pMarket
logoA = new Image()
logoB = new Image()
@@ -135,7 +139,7 @@
plotterManager.container.frame.position.x = thisObject.container.frame.position.x
plotterManager.container.frame.position.y = thisObject.container.frame.position.y
plotterManager.initialize(pProductsPanel, onPlotterManagerReady)
plotterManager.initialize(pProductsPanel, pExchange, pMarket, onPlotterManagerReady)
function onPlotterManagerReady (err) {
if (INFO_LOG === true) { logger.write('[INFO] initialize -> onPlotterManagerReady -> Entering function.') }