diff --git a/.vs/AAWebPlatform/v15/.suo b/.vs/AAWebPlatform/v15/.suo index 87e963a56..eb2f4a698 100644 Binary files a/.vs/AAWebPlatform/v15/.suo and b/.vs/AAWebPlatform/v15/.suo differ diff --git a/ChartUtilities.js b/ChartUtilities.js index 27bb78841..e652f8bf9 100644 --- a/ChartUtilities.js +++ b/ChartUtilities.js @@ -70,7 +70,7 @@ function getTransparenceFactor(timePeriod) { function recalculatePeriod(zoomLevel) { - console.log(" recalculatePeriod > " + zoomLevel); + //console.log(" recalculatePeriod > " + zoomLevel); if (zoomLevel > 200) { return _1_MINUTE_IN_MILISECONDS; diff --git a/Dashboard.js b/Dashboard.js index 43dccd81c..9ebc5bb3a 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -61,8 +61,6 @@ function convertTimePeriodToName(pTimePeriod) { -var viewPort = newViewPort(); - const DEBUG_START_UP_DELAY = 0 //3000; // This is a waiting time in case there is a need to debug the very first steps of initialization, to be able to hit F12 on time. const INITIAL_DEFAULT_MARKET = 2; // This is the market that will be shown when loading the site for the first time. const DEFAULT_EXCHANGE = "Poloniex"; @@ -98,7 +96,15 @@ const _1_MINUTE_IN_MILISECONDS = 1 * 60 * 1000; const EARLIEST_DATE = new Date(2014, 0, 18, 4, 26, 8); const FONT_ASPECT_RATIO = 0.60; const CHART_ASPECT_RATIO = 1 / 10; -const INITIAL_TIME_PERIOD = _10_MINUTES_IN_MILISECONDS; + +const INITIAL_ZOOM_LEVEL = 0; // This is the zoom level at the view port in which the APP starts. +const INITIAL_TIME_PERIOD = recalculatePeriod(INITIAL_ZOOM_LEVEL); + +var viewPort = newViewPort(); + + + + /* Here we list the valid Time Periods: */ @@ -116,7 +122,7 @@ var newDate = new Date(); newDate.setMilliseconds(0); newDate.setDate(newDate.getDate() - 90); -const INITIAL_DATE = newDate; +const INITIAL_DATE = new Date(2017,11,17,14,18,0,0); var maxDate = new Date(); maxDate.setMilliseconds(0); diff --git a/Ecosystem.js b/Ecosystem.js index 73f3eab1a..faae1e831 100644 --- a/Ecosystem.js +++ b/Ecosystem.js @@ -74,15 +74,8 @@ function newEcosystem() { plotter: { devTeam: "AAMasters", repo: "AAOlivia-Plotter", - moduleName: "Candlesticks", - target: "Timeline", - dependencies: { - dependency: { - devTeam: "AAMasters", - repo: "Plotters-Utilities", - moduleName: "Candlesticks" - } - } + moduleName: "Candles", + target: "Timeline" } }] } @@ -91,7 +84,7 @@ function newEcosystem() { displayName: "Market Volumes per Period", description: "A set of files per period that contains all volumes of one whole market.", storageAccount: "aaolivia", - filePath: "@Exchange/Output/Candles/Multi-Period-Market/@Period", + filePath: "@Exchange/Output/Volumes/Multi-Period-Market/@Period", fileName: "@AssetA_@AssetB.json", exchangeList: { exchange: [{ @@ -112,14 +105,7 @@ function newEcosystem() { devTeam: "AAMasters", repo: "AAOlivia-Plotter", moduleName: "Volumes", - target: "Timeline", - dependencies: { - dependency: { - devTeam: "AAMasters", - repo: "Plotters-Utilities", - moduleName: "Volumes" - } - } + target: "Timeline" } }] } @@ -149,14 +135,7 @@ function newEcosystem() { devTeam: "AAMasters", repo: "AAOlivia-Plotter", moduleName: "Candlesticks", - target: "Timeline", - dependencies: { - dependency: { - devTeam: "AAMasters", - repo: "Plotters-Utilities", - moduleName: "Candlesticks" - } - } + target: "Timeline" } }] } @@ -165,7 +144,7 @@ function newEcosystem() { displayName: "Daily Volumes per Period", description: "A set of files per period that contains all volumes of one whole market.", storageAccount: "aaolivia", - filePath: "@Exchange/Output/Candles/Multi-Period-Daily/@Period/@Year/@Month/@Day", + filePath: "@Exchange/Output/Volumes/Multi-Period-Daily/@Period/@Year/@Month/@Day", fileName: "@AssetA_@AssetB.json", exchangeList: { exchange: [{ @@ -186,14 +165,7 @@ function newEcosystem() { devTeam: "AAMasters", repo: "AAOlivia-Plotter", moduleName: "Volumes", - target: "Timeline", - dependencies: { - dependency: { - devTeam: "AAMasters", - repo: "Plotters-Utilities", - moduleName: "Volumes" - } - } + target: "Timeline" } }] } @@ -225,6 +197,164 @@ function newEcosystem() { sas: '?sv=2017-04-17&ss=f&srt=sco&sp=rl&se=2018-12-31T02:34:32Z&st=2018-02-01T18:34:32Z&spr=https,http&sig=24UJjGDVpPrHjhBoZtt3iKj4sxgenfSV4VTJD2v0q1U%3D', fileUri: 'https://' + 'aaolivia' + '.file.core.windows.net' } + }, + { + codeName: "AATom", + displayName: "Tom", + type: "Indicator", + version: { + number: "1.0.0", + status: "Mantained", // Discontinued + }, + products: { + product: [{ + codeName: "Market Candle-Stairs", + displayName: "Market Candle-Stairs per Period", + description: "A set of files per period that contains all candle-stairs of one whole market.", + storageAccount: "aatom", + filePath: "@Exchange/Tom/dataSet.V1/Output/CandleStairs/Multi-Period-Market/@Period", + fileName: "@AssetA_@AssetB.json", + exchangeList: { + exchange: [{ + name: "Poloniex", + datetimeRange: { + minDatetime: "2017-02-19 19:15:00.000 GMT+0000", + maxDatetime: "2018-02-13 10:10:00.000 GMT+0000" + } + }] + }, + layers: { + layer: [{ + codeName: "Market Candle-Stairs", + displayName: "Candle-Stairs", + exchangeList: ["Poloniex"], + validPeriods: ["24-hs", "12-hs", "08-hs", "06-hs", "04-hs", "03-hs", "02-hs", "01-hs"], + plotter: { + devTeam: "AAMasters", + repo: "AATom-Plotter", + moduleName: "CandleStairs", + target: "Timeline" + } + }] + } + }, { + codeName: "Market Volume-Stairs", + displayName: "Market Volume-Stairs per Period", + description: "A set of files per period that contains all volume-stairs of one whole market.", + storageAccount: "aaolivia", + filePath: "@Exchange/Tom/dataSet.V1/Output/Volume-Stairs/Multi-Period-Market/@Period", + fileName: "@AssetA_@AssetB.json", + exchangeList: { + exchange: [{ + name: "Poloniex", + datetimeRange: { + minDatetime: "2017-02-19 19:15:00.000 GMT+0000", + maxDatetime: "2018-02-13 10:10:00.000 GMT+0000" + } + }] + }, + layers: { + layer: [{ + codeName: "Market Volume-Stairs", + displayName: "Volume-Stairs", + exchangeList: ["Poloniex"], + validPeriods: ["24-hs", "12-hs", "08-hs", "06-hs", "04-hs", "03-hs", "02-hs", "01-hs"], + plotter: { + devTeam: "AAMasters", + repo: "AATom-Plotter", + moduleName: "VolumeStairs", + target: "Timeline" + } + }] + } + }, { + codeName: "Daily Candle-Stairs", + displayName: "Daily Candle-Stairs per Period", + description: "A set of files per period that contains all candle-stairs of one whole market.", + storageAccount: "aatom", + filePath: "@Exchange/Tom/dataSet.V1/Output/CandleStairs/Multi-Period-Daily/@Period/@Year/@Month/@Day", + fileName: "@AssetA_@AssetB.json", + exchangeList: { + exchange: [{ + name: "Poloniex", + datetimeRange: { + minDatetime: "2017-02-19 19:15:00.000 GMT+0000", + maxDatetime: "2018-02-13 10:10:00.000 GMT+0000" + } + }] + }, + layers: { + layer: [{ + codeName: "Daily Candle-Stairs", + displayName: "Candle-Stairs", + exchangeList: ["Poloniex"], + validPeriods: ["45-min", "40-min", "30-min", "20-min", "15-min", "10-min", "05-min", "04-min", "03-min", "02-min", "01-min"], + plotter: { + devTeam: "AAMasters", + repo: "AATom-Plotter", + moduleName: "CandleStairs", + target: "Timeline" + } + }] + } + }, { + codeName: "Daily Volume-Stairs", + displayName: "Daily Volume-Stairs per Period", + description: "A set of files per period that contains all volume-stairs of one whole market.", + storageAccount: "aaotom", + filePath: "@Exchange/Tom/dataSet.V1/Output/Volume-Stairs/Multi-Period-Daily/@Period/@Year/@Month/@Day", + fileName: "@AssetA_@AssetB.json", + exchangeList: { + exchange: [{ + name: "Poloniex", + datetimeRange: { + minDatetime: "2017-02-19 19:15:00.000 GMT+0000", + maxDatetime: "2018-02-13 10:10:00.000 GMT+0000" + } + }] + }, + layers: { + layer: [{ + codeName: "Daily Volume-Stairs", + displayName: "Volume-Stairs", + exchangeList: ["Poloniex"], + validPeriods: ["45-min", "40-min", "30-min", "20-min", "15-min", "10-min", "05-min", "04-min", "03-min", "02-min", "01-min"], + plotter: { + devTeam: "AAMasters", + repo: "AATom-Plotter", + moduleName: "VolumeStairs", + target: "Timeline" + } + }] + } + }] + }, + processes: + { + process: [{ + name: "One-Min-Daily-Candles-Volumes", + description: "Read trades files and generates one minute candles and volumes files for each day." + }] + }, + directDependencies: [], + directDependents: [], + collaboratorsList: [], + github: { + org: "AAMasters", + repos: { + repo: [{ + name: "AABruce", + description: "Produces two data-sets with candles and volumes for all markets at all exchanges.", + openIssues: 0, + openPullRequests: 0, + contributors: 1 + }] + } + }, + storage: { + sas: '?sv=2017-04-17&ss=f&srt=sco&sp=r&se=2018-12-31T19:28:33Z&st=2018-02-22T11:28:33Z&spr=https&sig=YaprSp9zO%2Fsz0nPPWwPMqPACxZTnYhSWKApfun%2Bfez4%3D', + fileUri: 'https://' + 'aatom' + '.file.core.windows.net' + } } ] } diff --git a/FileCloud.js b/FileCloud.js index 9fd9fb913..7da02dbb7 100644 --- a/FileCloud.js +++ b/FileCloud.js @@ -39,7 +39,7 @@ function newFileCloud() { fileService.getFileToText('data', filePath, fileName, undefined, onFileReceived); - console.log("File Requested > " + filePath); + //console.log("File Requested > " + filePath); function onFileReceived(err, text, response) { diff --git a/FileCursor.js b/FileCursor.js index 5c71f822c..64cd6901e 100644 --- a/FileCursor.js +++ b/FileCursor.js @@ -25,7 +25,7 @@ function newFileCursor() { return fileCursor; - function initialize(pFileCloud, pProduct, pExchange, pMarket, pPeriodName, pCursorDate, pTimePeriod, callBackFunction) { + function initialize(pFileCloud, pProduct, pExchange, pMarket, pPeriodName, pTimePeriod, pCursorDate, pCurrentTimePeriod, callBackFunction) { market = pMarket; exchange = pExchange; @@ -35,7 +35,7 @@ function newFileCursor() { cursorDate = pCursorDate; timePeriod = pTimePeriod; - setTimePeriod(pTimePeriod); + setTimePeriod(pCurrentTimePeriod); getFiles(callBackFunction); @@ -76,12 +76,12 @@ function newFileCursor() { if (Math.abs(positionB - positionA) <= 1) { exitSavingMode(); - console.log("File Cursor with period " + periodName + " EXITED saving mode after being notified the user is at period " + convertTimePeriodToName(pTimePeriod)); + //console.log("File Cursor with period " + periodName + " EXITED saving mode after being notified the user is at period " + convertTimePeriodToName(pTimePeriod)); } else { enterSavingMode(); - console.log("File Cursor with period " + periodName + " ENTERED saving mode after being notified the user is at period " + convertTimePeriodToName(pTimePeriod)); + //console.log("File Cursor with period " + periodName + " ENTERED saving mode after being notified the user is at period " + convertTimePeriodToName(pTimePeriod)); } @@ -166,25 +166,25 @@ function newFileCursor() { case _45_MINUTES_IN_MILISECONDS: { - minCursorSize = 10; + minCursorSize = 13; maxCursorSize = 30; } break; case _40_MINUTES_IN_MILISECONDS: { - minCursorSize = 8; + minCursorSize = 11; maxCursorSize = 20; } break; case _30_MINUTES_IN_MILISECONDS: { - minCursorSize = 6; + minCursorSize = 9; maxCursorSize = 15; } break; case _20_MINUTES_IN_MILISECONDS: { - minCursorSize = 5; + minCursorSize = 7; maxCursorSize = 15; } break; diff --git a/FileCursorCache.js b/FileCursorCache.js index 24c89c631..bc348199b 100644 --- a/FileCursorCache.js +++ b/FileCursorCache.js @@ -4,6 +4,7 @@ function newFileCursorCache() { let fileCursorCache = { getFileCursor: getFileCursor, setDatetime: setDatetime, + setTimePeriod: setTimePeriod, initialize: initialize } @@ -53,7 +54,7 @@ function newFileCursorCache() { if (layer.validPeriods.includes(periodName) === true) { let fileCursor = newFileCursor(); - fileCursor.initialize(fileCloud, product, exchange, pMarket, periodName, pDatetime, pTimePeriod, onFileReceived); + fileCursor.initialize(fileCloud, product, exchange, pMarket, periodName, periodTime, pDatetime, pTimePeriod, onFileReceived); fileCursors.set(periodTime, fileCursor); diff --git a/Panels/ChartLayersPanel.js b/Panels/ChartLayersPanel.js index 0dec6e1f0..c303819a3 100644 --- a/Panels/ChartLayersPanel.js +++ b/Panels/ChartLayersPanel.js @@ -11,8 +11,9 @@ function newChartLayersPanel() { const LAYER_NAMES = { OLIVIA_CANDLES: 'Olivia Candlesticks', - CANDLESTICKS: 'Candlesticks', - VOLUME: 'Volume', + OLIVIA_VOLUMES: 'Olivia Volumes', + TOM_CANDLE_STAIRS: 'Tom Candle-Stairs', + TOM_VOLUME_STAIRS: 'Tom Volume-Stairs', ATH: 'All-time Highs and Lows', HIGH_LOWS: 'High and Lows', FORECAST: 'Forecast', @@ -62,7 +63,7 @@ function newChartLayersPanel() { var buttonPosition; - var buttonNames = [LAYER_NAMES.OLIVIA_CANDLES,LAYER_NAMES.CANDLESTICKS, LAYER_NAMES.VOLUME, LAYER_NAMES.ATH, LAYER_NAMES.HIGH_LOWS, LAYER_NAMES.FORECAST, LAYER_NAMES.ORDER_BOOKS, LAYER_NAMES.CANDLE_STAIRS, LAYER_NAMES.VOLUME_STAIRS, LAYER_NAMES.BUY_SELL_BALANCE, LAYER_NAMES.LINEAR_REGRESION_CURVE]; + var buttonNames = [LAYER_NAMES.OLIVIA_CANDLES, LAYER_NAMES.OLIVIA_VOLUMES, LAYER_NAMES.TOM_CANDLE_STAIRS, LAYER_NAMES.TOM_VOLUME_STAIRS, LAYER_NAMES.ATH, LAYER_NAMES.HIGH_LOWS, LAYER_NAMES.FORECAST, LAYER_NAMES.ORDER_BOOKS, LAYER_NAMES.CANDLE_STAIRS, LAYER_NAMES.VOLUME_STAIRS, LAYER_NAMES.BUY_SELL_BALANCE, LAYER_NAMES.LINEAR_REGRESION_CURVE]; var lastY = 5; buttons = []; diff --git a/Panels/ControlPanel.js b/Panels/ControlPanel.js index b579f3837..6d4f65575 100644 --- a/Panels/ControlPanel.js +++ b/Panels/ControlPanel.js @@ -102,7 +102,7 @@ function newControlPanel() { viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - PLAY_STEP = recalculatePeriod(viewPort.zoomLevel); + PLAY_STEP = INITIAL_TIME_PERIOD; } diff --git a/TimelineChart.js b/TimelineChart.js index c7fe82c8c..02c03631f 100644 --- a/TimelineChart.js +++ b/TimelineChart.js @@ -93,9 +93,25 @@ function newTimelineChart() { function initializeLayers() { + /* Here we need to move the viewPort to the default date. */ + + //-869208.2550614576 y = 40845.822907407215 + + + + let displaceVector = { + x: -869208.2550614576, + y: 40845.822907407215 + }; + + viewPort.displace(displaceVector); + + + let layerStatus; + /* AAMasters AAOlivia Candlesticks */ - var layerAAMastersAAOliviaCandlesticks = newAAMastersAAOliviaCandlesticks(); + var layerAAMastersAAOliviaCandlesticks = newAAMastersAAOliviaCandles(); layerAAMastersAAOliviaCandlesticks.container.displacement.parentDisplacement = timelineChart.container.displacement; layerAAMastersAAOliviaCandlesticks.container.zoom.parentZoom = timelineChart.container.zoom; @@ -109,16 +125,98 @@ function newTimelineChart() { layerAAMastersAAOliviaCandlesticks.container.frame.position.x = timelineChart.container.frame.width / 2 - layerAAMastersAAOliviaCandlesticks.container.frame.width / 2; layerAAMastersAAOliviaCandlesticks.container.frame.position.y = timelineChart.container.frame.height / 2 - layerAAMastersAAOliviaCandlesticks.container.frame.height / 2; - layerAAMastersAAOliviaCandlesticks.initialize(DEFAULT_EXCHANGE, DEFAULT_MARKET, INITIAL_DATE, INITIAL_TIME_PERIOD, chartLayersPanel, onOliviaInitialized); + layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); - function onOliviaInitialized() { + layerAAMastersAAOliviaCandlesticks.initialize(DEFAULT_EXCHANGE, DEFAULT_MARKET, INITIAL_DATE, INITIAL_TIME_PERIOD, layerStatus, onOliviaCandlesInitialized); + + function onOliviaCandlesInitialized() { splashScreenNeeded = false; // This is when we dont need a splash screen anymore! } - /* All Time Layer */ + /* AAMasters AAOlivia Volumes */ + var layerAAMastersAAOliviaVolumes = newAAMastersAAOliviaVolumes(); + + layerAAMastersAAOliviaVolumes.container.displacement.parentDisplacement = timelineChart.container.displacement; + layerAAMastersAAOliviaVolumes.container.zoom.parentZoom = timelineChart.container.zoom; + layerAAMastersAAOliviaVolumes.container.frame.parentFrame = timelineChart.container.frame; + + layerAAMastersAAOliviaVolumes.container.parentContainer = timelineChart.container; + + layerAAMastersAAOliviaVolumes.container.frame.width = timelineChart.container.frame.width * 1; + layerAAMastersAAOliviaVolumes.container.frame.height = timelineChart.container.frame.height * 1; + + layerAAMastersAAOliviaVolumes.container.frame.position.x = timelineChart.container.frame.width / 2 - layerAAMastersAAOliviaVolumes.container.frame.width / 2; + layerAAMastersAAOliviaVolumes.container.frame.position.y = timelineChart.container.frame.height / 2 - layerAAMastersAAOliviaVolumes.container.frame.height / 2; + + layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_VOLUMES); + + layerAAMastersAAOliviaVolumes.initialize(DEFAULT_EXCHANGE, DEFAULT_MARKET, INITIAL_DATE, INITIAL_TIME_PERIOD, layerStatus, onOliviaVolumesInitialized); + + function onOliviaVolumesInitialized() { + + // nothing to do here... + + } + + /* AAMasters AATom CandleStairs */ + + var layerAAMastersAATomCandleStairs = newAAMastersAATomCandleStairs(); + + layerAAMastersAATomCandleStairs.container.displacement.parentDisplacement = timelineChart.container.displacement; + layerAAMastersAATomCandleStairs.container.zoom.parentZoom = timelineChart.container.zoom; + layerAAMastersAATomCandleStairs.container.frame.parentFrame = timelineChart.container.frame; + + layerAAMastersAATomCandleStairs.container.parentContainer = timelineChart.container; + + layerAAMastersAATomCandleStairs.container.frame.width = timelineChart.container.frame.width * 1; + layerAAMastersAATomCandleStairs.container.frame.height = timelineChart.container.frame.height * 1; + + layerAAMastersAATomCandleStairs.container.frame.position.x = timelineChart.container.frame.width / 2 - layerAAMastersAATomCandleStairs.container.frame.width / 2; + layerAAMastersAATomCandleStairs.container.frame.position.y = timelineChart.container.frame.height / 2 - layerAAMastersAATomCandleStairs.container.frame.height / 2; + + layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); + + layerAAMastersAATomCandleStairs.initialize(DEFAULT_EXCHANGE, DEFAULT_MARKET, INITIAL_DATE, INITIAL_TIME_PERIOD, layerStatus, onOliviaCandlesInitialized); + + function onOliviaCandlesInitialized() { + + // nothing to do here... + + } + + /* AAMasters AATom VolumeStairs */ + + var layerAAMastersAATomVolumeStairs = newAAMastersAATomVolumeStairs(); + + layerAAMastersAATomVolumeStairs.container.displacement.parentDisplacement = timelineChart.container.displacement; + layerAAMastersAATomVolumeStairs.container.zoom.parentZoom = timelineChart.container.zoom; + layerAAMastersAATomVolumeStairs.container.frame.parentFrame = timelineChart.container.frame; + + layerAAMastersAATomVolumeStairs.container.parentContainer = timelineChart.container; + + layerAAMastersAATomVolumeStairs.container.frame.width = timelineChart.container.frame.width * 1; + layerAAMastersAATomVolumeStairs.container.frame.height = timelineChart.container.frame.height * 1; + + layerAAMastersAATomVolumeStairs.container.frame.position.x = timelineChart.container.frame.width / 2 - layerAAMastersAATomVolumeStairs.container.frame.width / 2; + layerAAMastersAATomVolumeStairs.container.frame.position.y = timelineChart.container.frame.height / 2 - layerAAMastersAATomVolumeStairs.container.frame.height / 2; + + layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_VOLUMES); + + layerAAMastersAATomVolumeStairs.initialize(DEFAULT_EXCHANGE, DEFAULT_MARKET, INITIAL_DATE, INITIAL_TIME_PERIOD, layerStatus, onOliviaVolumeStairsInitialized); + + function onOliviaVolumeStairsInitialized() { + + // nothing to do here... + + } + + + + /* All Time Layer */ + /* var allTimeChartLayer = newAllTimeChartLayer(); allTimeChartLayer.container.displacement.parentDisplacement = timelineChart.container.displacement; @@ -136,7 +234,7 @@ function newTimelineChart() { allTimeChartLayer.initialize(exchangeId, marketId, marketIndex, chartLayersPanel); /* Orderbook Resistances Layer */ - + /* var orderBooksChartLayer = newOrderBooksChartLayer(); orderBooksChartLayer.container.displacement.parentDisplacement = timelineChart.container.displacement; @@ -155,7 +253,7 @@ function newTimelineChart() { /* Candle Technical Analisys Layer */ - + /* var candleTechnicalAnalisysChartLayer = newCandleTechnicalAnalisysChartLayer(); candleTechnicalAnalisysChartLayer.container.displacement.parentDisplacement = timelineChart.container.displacement; @@ -174,7 +272,7 @@ function newTimelineChart() { /* Volume Technical Analisys Layer */ - + /* var volumeTechnicalAnalisysChartLayer = newVolumeTechnicalAnalisysChartLayer(); volumeTechnicalAnalisysChartLayer.container.displacement.parentDisplacement = timelineChart.container.displacement; @@ -193,7 +291,7 @@ function newTimelineChart() { /* Sopport Resistance Layer */ - + /* var supportResistanceChartLayer = newSupportResistanceChartLayer(); supportResistanceChartLayer.container.displacement.parentDisplacement = timelineChart.container.displacement; @@ -212,7 +310,7 @@ function newTimelineChart() { /* High Low Layer */ - + /* var highLowChartLayer = newHighLowChartLayer(); highLowChartLayer.container.displacement.parentDisplacement = timelineChart.container.displacement; @@ -230,47 +328,14 @@ function newTimelineChart() { highLowChartLayer.initialize(exchangeId, marketId, marketIndex, dailyFilesCursor, chartLayersPanel); - /* Candles Layer */ - - var candleStickChartLayer = newCandleStickChartLayer(); - - candleStickChartLayer.container.displacement.parentDisplacement = timelineChart.container.displacement; - candleStickChartLayer.container.zoom.parentZoom = timelineChart.container.zoom; - candleStickChartLayer.container.frame.parentFrame = timelineChart.container.frame; - - candleStickChartLayer.container.parentContainer = timelineChart.container; - - candleStickChartLayer.container.frame.width = timelineChart.container.frame.width * 1; - candleStickChartLayer.container.frame.height = timelineChart.container.frame.height * 1; - - candleStickChartLayer.container.frame.position.x = timelineChart.container.frame.width / 2 - candleStickChartLayer.container.frame.width / 2; - candleStickChartLayer.container.frame.position.y = timelineChart.container.frame.height / 2 - candleStickChartLayer.container.frame.height / 2; - - candleStickChartLayer.initialize(exchangeId, marketId, marketIndex, dailyFilesCursor, chartLayersPanel, chartLayersPanel); - /* Volume Layer */ - var volumeChartLayer = newVolumeChartLayer(); - - volumeChartLayer.container.displacement.parentDisplacement = timelineChart.container.displacement; - volumeChartLayer.container.zoom.parentZoom = timelineChart.container.zoom; - volumeChartLayer.container.frame.parentFrame = timelineChart.container.frame; - - volumeChartLayer.container.parentContainer = timelineChart.container; - - volumeChartLayer.container.frame.width = timelineChart.container.frame.width * 1; - volumeChartLayer.container.frame.height = timelineChart.container.frame.height * 1; - - volumeChartLayer.container.frame.position.x = timelineChart.container.frame.width / 2 - volumeChartLayer.container.frame.width / 2; - volumeChartLayer.container.frame.position.y = timelineChart.container.frame.height / 2 - volumeChartLayer.container.frame.height / 2; - - volumeChartLayer.initialize(exchangeId, marketId, marketIndex, dailyFilesCursor, chartLayersPanel, chartLayersPanel); /* Accumulated Volume Volume Layer */ - + /* var accumulatedVolumeChartLayer = newAccumulatedVolumeChartLayer(); accumulatedVolumeChartLayer.container.displacement.parentDisplacement = timelineChart.container.displacement; @@ -290,7 +355,7 @@ function newTimelineChart() { /* Forecast Layer */ - + /* var forecastChartLayer = newForecastChartLayer(); forecastChartLayer.container.displacement.parentDisplacement = timelineChart.container.displacement; @@ -307,13 +372,13 @@ function newTimelineChart() { forecastChartLayer.initialize(exchangeId, marketId, marketIndex, dailyFilesCursor, chartLayersPanel); - candleStickChartLayer.container.eventHandler.listenToEvent("Current Candle Changed", forecastChartLayer.setCurrentCandle); - forecastChartLayer.setCurrentCandle(candleStickChartLayer.currentCandle); + // candleStickChartLayer.container.eventHandler.listenToEvent("Current Candle Changed", forecastChartLayer.setCurrentCandle); + // forecastChartLayer.setCurrentCandle(candleStickChartLayer.currentCandle); /* Linear Regression Curve Layer */ - + /* var linearRegressionCurveChartLayer = newLinearRegressionCurve(); linearRegressionCurveChartLayer.container.displacement.parentDisplacement = timelineChart.container.displacement; @@ -329,12 +394,19 @@ function newTimelineChart() { linearRegressionCurveChartLayer.container.frame.position.y = timelineChart.container.frame.height / 2 - candleTechnicalAnalisysChartLayer.container.frame.height / 2; linearRegressionCurveChartLayer.initialize(exchangeId, marketId, marketIndex, dailyFilesCursor, chartLayersPanel); - - + */ /* Add all layers to the internal array */ - timelineChart.layers.push(layerAAMastersAAOliviaCandlesticks); + timelineChart.layers.push(layerAAMastersAATomCandleStairs); // This looks better if it goes below the candles layer. + timelineChart.layers.push(layerAAMastersAATomVolumeStairs); + + + timelineChart.layers.push(layerAAMastersAAOliviaCandlesticks); + timelineChart.layers.push(layerAAMastersAAOliviaVolumes); + + + /* timelineChart.layers.push(allTimeChartLayer); timelineChart.layers.push(orderBooksChartLayer); timelineChart.layers.push(forecastChartLayer); @@ -342,40 +414,38 @@ function newTimelineChart() { timelineChart.layers.push(highLowChartLayer); timelineChart.layers.push(candleTechnicalAnalisysChartLayer); timelineChart.layers.push(volumeTechnicalAnalisysChartLayer); - timelineChart.layers.push(candleStickChartLayer); - timelineChart.layers.push(volumeChartLayer); + timelineChart.layers.push(accumulatedVolumeChartLayer); timelineChart.layers.push(linearRegressionCurveChartLayer); /* Wiring some charts with others using events */ - candleStickChartLayer.container.eventHandler.listenToEvent("Candles Changed", candleTechnicalAnalisysChartLayer.onCandlesChanged); - candleStickChartLayer.container.eventHandler.listenToEvent("Candles Changed", highLowChartLayer.onCandlesChanged); - candleStickChartLayer.container.eventHandler.listenToEvent("Candles Changed", supportResistanceChartLayer.onCandlesChanged); - candleStickChartLayer.container.eventHandler.listenToEvent("Current Candle Info Changed", currentCandlePanel.onCurrentCandleChanged); - candleStickChartLayer.container.eventHandler.listenToEvent("Candles Changed", linearRegressionCurveChartLayer.onCandlesChanged); - volumeChartLayer.container.eventHandler.listenToEvent("Current Volume Info Changed", currentVolumePanel.onCurrentVolumeChanged); - volumeChartLayer.container.eventHandler.listenToEvent("Volumes Changed", volumeTechnicalAnalisysChartLayer.onVolumesChanged); - orderBooksChartLayer.container.eventHandler.listenToEvent("Current Order Book Changed", orderBookPanel.onCurrentOrderBookChanged); + + //orderBooksChartLayer.container.eventHandler.listenToEvent("Current Order Book Changed", orderBookPanel.onCurrentOrderBookChanged); /* Connecting all layers to the panel that provides a user interface to turn them on - visible - off */ chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", layerAAMastersAAOliviaCandlesticks.onLayerStatusChanged); + chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", layerAAMastersAAOliviaVolumes.onLayerStatusChanged); + chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", layerAAMastersAATomCandleStairs.onLayerStatusChanged); + chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", layerAAMastersAATomVolumeStairs.onLayerStatusChanged); + + /* chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", accumulatedVolumeChartLayer.onLayerStatusChanged); - chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", candleStickChartLayer.onLayerStatusChanged); + chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", candleTechnicalAnalisysChartLayer.onLayerStatusChanged); chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", highLowChartLayer.onLayerStatusChanged); - chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", volumeChartLayer.onLayerStatusChanged); + chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", volumeTechnicalAnalisysChartLayer.onLayerStatusChanged); chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", allTimeChartLayer.onLayerStatusChanged); chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", forecastChartLayer.onLayerStatusChanged); chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", orderBooksChartLayer.onLayerStatusChanged); chartLayersPanel.container.eventHandler.listenToEvent("Layer Status Changed", linearRegressionCurveChartLayer.onLayerStatusChanged); - + */ } diff --git a/ViewPort.js b/ViewPort.js index d0e6d3702..96f98cb99 100644 --- a/ViewPort.js +++ b/ViewPort.js @@ -10,7 +10,7 @@ function newViewPort() { let viewPort = { visibleArea: undefined, eventHandler: undefined, - zoomLevel: 0, + zoomLevel: INITIAL_ZOOM_LEVEL, mousePosition: undefined, applyZoom: applyZoom, zoomFontSize: zoomFontSize, @@ -25,7 +25,7 @@ function newViewPort() { initialize: initialize }; - targetLevel = 0; + zoomTargetLevel = INITIAL_ZOOM_LEVEL; let increment = 0.035; @@ -66,17 +66,17 @@ function newViewPort() { function animate() { - if (viewPort.zoomLevel < targetLevel) { - if (targetLevel - viewPort.zoomLevel < ANIMATION_INCREMENT) { - ANIMATION_INCREMENT = Math.abs(targetLevel - viewPort.zoomLevel); + if (viewPort.zoomLevel < zoomTargetLevel) { + if (zoomTargetLevel - viewPort.zoomLevel < ANIMATION_INCREMENT) { + ANIMATION_INCREMENT = Math.abs(zoomTargetLevel - viewPort.zoomLevel); } viewPort.zoomLevel = viewPort.zoomLevel + ANIMATION_INCREMENT; changeZoom(viewPort.zoomLevel - ANIMATION_INCREMENT, viewPort.zoomLevel); } - if (viewPort.zoomLevel > targetLevel) { - if (viewPort.zoomLevel - targetLevel < ANIMATION_INCREMENT) { - ANIMATION_INCREMENT = Math.abs(targetLevel - viewPort.zoomLevel); + if (viewPort.zoomLevel > zoomTargetLevel) { + if (viewPort.zoomLevel - zoomTargetLevel < ANIMATION_INCREMENT) { + ANIMATION_INCREMENT = Math.abs(zoomTargetLevel - viewPort.zoomLevel); } viewPort.zoomLevel = viewPort.zoomLevel - ANIMATION_INCREMENT; changeZoom(viewPort.zoomLevel + ANIMATION_INCREMENT, viewPort.zoomLevel); @@ -97,6 +97,9 @@ function newViewPort() { if (Math.trunc(Math.abs(targetOffset.y - offset.y) * 1000) >= Math.trunc(Math.abs(offsetIncrement.y) * 1000)) { offset.y = offset.y + offsetIncrement.y; + + //console.log("offset.y changed to " + offset.y) + } else { offsetIncrement.y = 0; } @@ -116,6 +119,8 @@ function newViewPort() { viewPort.eventHandler.raiseEvent("Offset Changed", event); + //console.log("displace produced new Offset x = " + offset.x + " y = " + offset.y); + } function displaceTarget(displaceVector) { @@ -129,67 +134,68 @@ function newViewPort() { x: (targetOffset.x - offset.x) / 10, y: (targetOffset.y - offset.y) / 10 }; - + + //console.log("displaceTarget x = " + targetOffset.x + " y = " + targetOffset.y); } function applyZoom(amount) { - + //console.log("applyZoom amount: " + amount); if (amount > 0) { - if (targetLevel > -5) { + if (zoomTargetLevel > -5) { amount = amount * 2; } - if (targetLevel > 10) { + if (zoomTargetLevel > 10) { amount = amount * 3; } - if (targetLevel > 15) { + if (zoomTargetLevel > 15) { amount = amount * 4; } } if (amount < 0) { - if (targetLevel > -4) { + if (zoomTargetLevel > -4) { amount = amount * 2; } - if (targetLevel > 13) { + if (zoomTargetLevel > 13) { amount = amount * 3; } - if (targetLevel > 19) { + if (zoomTargetLevel > 19) { amount = amount * 4; } } - if (targetLevel + amount > 1000) { + if (zoomTargetLevel + amount > 1000) { return false; } - if (targetLevel <= -27 && amount < 0) { + if (zoomTargetLevel <= -27 && amount < 0) { amount = amount / 4; } - if (targetLevel < -27 && amount > 0) { + if (zoomTargetLevel < -27 && amount > 0) { amount = amount / 4; } - if (targetLevel + amount < -28.25) { + if (zoomTargetLevel + amount < -28.25) { return false; } - targetLevel = targetLevel + amount; + zoomTargetLevel = zoomTargetLevel + amount; - ANIMATION_INCREMENT = Math.abs(targetLevel - viewPort.zoomLevel) / 3; + ANIMATION_INCREMENT = Math.abs(zoomTargetLevel - viewPort.zoomLevel) / 3; let event = { - newLevel: targetLevel, + newLevel: zoomTargetLevel, newOffset: offset, type: undefined }; @@ -200,7 +206,7 @@ function newViewPort() { event.type = "Zoom Out"; } - console.log("Zoom Changed > " + event.newLevel); + //console.log("Zoom Changed > " + event.newLevel); viewPort.eventHandler.raiseEvent("Zoom Changed", event); return true; @@ -215,6 +221,8 @@ function newViewPort() { offset.x = offset.x - newMouse.x + viewPort.mousePosition.x; offset.y = offset.y - newMouse.y + viewPort.mousePosition.y; + //console.log("changeZoom produced new Offset x = " + offset.x + " y = " + offset.y); + targetOffset.x = offset.x targetOffset.y = offset.y ; diff --git a/index.html b/index.html index 41eefd8bd..de53c2552 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,13 @@ Advanced Algos + + + + + + + @@ -51,7 +58,7 @@ - + diff --git a/server.js b/server.js index b7d5531a3..ea39703c4 100644 --- a/server.js +++ b/server.js @@ -48,17 +48,17 @@ function onRequestReceivedFromBrowser(request, response) { case "AAMasters": { - + /* const octokit = require('@octokit/rest')() global.atob = require("atob"); - let owner = "AAMasters"; - let repo = "AAOlivia-Plotter"; + let owner = requestParameters[1]; + let repo = requestParameters[2] + "-Plotter"; let branch = "master"; let page = 1; let per_page = 100; let ref = "master"; - let path = "Candlestick.js"; + let path = requestParameters[3]; octokit.repos.getContent({ owner, repo, path, ref }, onContent); @@ -66,13 +66,14 @@ function onRequestReceivedFromBrowser(request, response) { let decoded = atob(result.data.content); - //console.log(decoded); - - //console.log(result); - respondWithContent(decoded.substring(3), response); // Eliminate first 2 bytes of noise. - } + } + */ + + + respondWithFile('../' + requestParameters[2] + "-Plotter" + '/' + requestParameters[3], response); + } break;