MarketIndex eliminated, order book pannel removed
This commit is contained in:
1 parent
9517ff8ae9
commit
eb3ed29858
9 files changed
+54220
-141
No files matched your search
Binary file not shown.
File diff suppressed because it is too large.
Load diff
+14
-30
@@ -2,8 +2,8 @@
|
||||
|
||||
/* The Dashboard is the root object that contains all the other stuff in it. Some of that stuff is visible, some other is invisible. */
|
||||
|
||||
var canvas;
|
||||
var markets;
|
||||
let canvas;
|
||||
let markets;
|
||||
let ecosystem = newEcosystem();
|
||||
|
||||
let marketFilesPeriods =
|
||||
@@ -70,6 +70,8 @@ const DEFAULT_MARKET = {
|
||||
assetB: "BTC",
|
||||
};
|
||||
|
||||
const USDT_BTC_HTH = 19900; // This is needed to know the scale of the market time line.
|
||||
|
||||
const WIDHTER_VOLUME_BAR_BASE_FACTOR = 2.5;
|
||||
const LESS_WIDHTER_VOLUME_BAR_TOP_FACTOR = 1 / 4;
|
||||
|
||||
@@ -149,38 +151,20 @@ function start() {
|
||||
|
||||
const ID_EXCHANGE_POLONIEX = 1;
|
||||
|
||||
var server = newFileServer();
|
||||
server.initialize();
|
||||
/* For now, we are supporting only one market. */
|
||||
|
||||
server.getMarkets(ID_EXCHANGE_POLONIEX, onResultSetReady);
|
||||
let market = {
|
||||
id: 2,
|
||||
assetA: "USDT",
|
||||
assetB: "BTC"
|
||||
};
|
||||
|
||||
function onResultSetReady(resultSet) {
|
||||
markets = new Map();
|
||||
|
||||
markets = new Map();
|
||||
markets.set(market.id, market);
|
||||
|
||||
var totalRows = resultSet.length;
|
||||
|
||||
for (var i = 0; i < totalRows; i++) {
|
||||
|
||||
var row = resultSet[i];
|
||||
|
||||
/* We move the information from the result set to an order object, and use that from now on. */
|
||||
|
||||
market = {
|
||||
id: row[0],
|
||||
assetA: row[1],
|
||||
assetB: row[2]
|
||||
};
|
||||
|
||||
markets.set(market.id, market);
|
||||
|
||||
}
|
||||
|
||||
|
||||
canvas = newCanvas();
|
||||
canvas.initialize();
|
||||
|
||||
}
|
||||
canvas = newCanvas();
|
||||
canvas.initialize();
|
||||
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -8,13 +8,13 @@ function newFileCloud() {
|
||||
initialize: initialize
|
||||
};
|
||||
|
||||
let fileService;
|
||||
let blobService;
|
||||
|
||||
return fileCloud;
|
||||
|
||||
function initialize(pBot) {
|
||||
|
||||
fileService = AzureStorage.createFileServiceWithSas(pBot.storage.fileUri, pBot.storage.sas).withFilter(new AzureStorage.ExponentialRetryPolicyFilter());
|
||||
blobService = AzureStorage.createBlobServiceWithSas(pBot.storage.fileUri, pBot.storage.sas).withFilter(new AzureStorage.ExponentialRetryPolicyFilter());
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ function newFileCloud() {
|
||||
|
||||
}
|
||||
|
||||
fileService.getFileToText('data', filePath, fileName, undefined, onFileReceived);
|
||||
blobService.getBlobToText('data', filePath + "/" + fileName, onFileReceived);
|
||||
|
||||
if (CONSOLE_LOG === true) {
|
||||
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
|
||||
|
||||
function newMarketIndex() {
|
||||
|
||||
let marketIndex = {
|
||||
candles: undefined,
|
||||
volumes: undefined,
|
||||
maxRate: maxRate,
|
||||
maxVolume: maxVolume,
|
||||
initialize: initialize
|
||||
}
|
||||
|
||||
let marketId;
|
||||
let exchangeId;
|
||||
|
||||
return marketIndex;
|
||||
|
||||
function initialize(exchange, market, callBackFunction) {
|
||||
|
||||
marketId = market;
|
||||
exchangeId = exchange;
|
||||
|
||||
let server;
|
||||
|
||||
server = newFileServer();
|
||||
server.initialize();
|
||||
|
||||
server.getMarketFilesCandles(exchangeId, marketId, onCandlesReady);
|
||||
|
||||
function onCandlesReady(data) {
|
||||
|
||||
marketIndex.candles = data;
|
||||
|
||||
server.getMarketIndexVolumes(exchangeId, marketId, onVolumesReady);
|
||||
|
||||
function onVolumesReady(data) {
|
||||
|
||||
marketIndex.volumes = data;
|
||||
|
||||
callBackFunction();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function maxRate() {
|
||||
|
||||
let maxValue = 0;
|
||||
|
||||
for (var i = 0; i < marketIndex.candles.length; i++) {
|
||||
|
||||
let currentMax = marketIndex.candles[i][1];
|
||||
|
||||
if (maxValue < currentMax) {
|
||||
maxValue = currentMax;
|
||||
}
|
||||
}
|
||||
|
||||
return maxValue;
|
||||
}
|
||||
|
||||
function maxVolume() {
|
||||
|
||||
let maxValue = 0;
|
||||
|
||||
for (var i = 0; i < marketIndex.volumes.length; i++) {
|
||||
|
||||
let currentMax = marketIndex.volumes[i][0] + marketIndex.volumes[i][1];
|
||||
|
||||
if (maxValue < currentMax) {
|
||||
maxValue = currentMax;
|
||||
}
|
||||
}
|
||||
|
||||
return maxValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -32,6 +32,7 @@
|
||||
<Compile Include="AccumulatedVolumeBar.js" />
|
||||
<Compile Include="AggregatedOrdersArray.js" />
|
||||
<Compile Include="Animation.js" />
|
||||
<Compile Include="Azure\azure-storage.blob.js" />
|
||||
<Compile Include="Azure\azure-storage.common.js" />
|
||||
<Compile Include="Azure\azure-storage.file.js" />
|
||||
<Compile Include="Ball.js" />
|
||||
@@ -77,7 +78,6 @@
|
||||
<Compile Include="EventHandler.js" />
|
||||
<Compile Include="FloatingSpace.js" />
|
||||
<Compile Include="Frame.js" />
|
||||
<Compile Include="MarketIndex.js" />
|
||||
<Compile Include="Markets.js" />
|
||||
<Compile Include="MarketTrades.js" />
|
||||
<Compile Include="Order.js" />
|
||||
|
||||
+2
-16
@@ -23,7 +23,6 @@ function newTimeMachine() {
|
||||
container.frame.containerName = "Time Machine";
|
||||
|
||||
let botsPanel;
|
||||
let orderBookPanel;
|
||||
|
||||
return timeMachine;
|
||||
|
||||
@@ -35,9 +34,6 @@ function newTimeMachine() {
|
||||
controlPanel.initialize();
|
||||
this.controlPanel = controlPanel;
|
||||
|
||||
orderBookPanel = newOrderBookPanel();
|
||||
orderBookPanel.initialize();
|
||||
|
||||
botsPanel = newProductsPanel();
|
||||
botsPanel.initialize();
|
||||
|
||||
@@ -59,7 +55,7 @@ function newTimeMachine() {
|
||||
timelineChart.container.frame.position.x = timeMachine.container.frame.width / 2 - timelineChart.container.frame.width / 2;
|
||||
timelineChart.container.frame.position.y = timelineChart.container.frame.height * 1.5 * iteration;
|
||||
|
||||
timelineChart.initialize(1, INITIAL_DEFAULT_MARKET, botsPanel, orderBookPanel, onDefaultMarketInitialized);
|
||||
timelineChart.initialize(1, INITIAL_DEFAULT_MARKET, botsPanel, onDefaultMarketInitialized);
|
||||
|
||||
iteration++;
|
||||
|
||||
@@ -100,7 +96,7 @@ function newTimeMachine() {
|
||||
timelineChart.container.frame.position.x = timeMachine.container.frame.width / 2 - timelineChart.container.frame.width / 2;
|
||||
timelineChart.container.frame.position.y = timelineChart.container.frame.height * 1.5 * iteration;
|
||||
|
||||
timelineChart.initialize(1, key, botsPanel, orderBookPanel, finalSteps);
|
||||
timelineChart.initialize(1, key, botsPanel, finalSteps);
|
||||
|
||||
iteration++;
|
||||
|
||||
@@ -246,8 +242,6 @@ function newTimeMachine() {
|
||||
|
||||
botsPanel.draw();
|
||||
|
||||
orderBookPanel.draw();
|
||||
|
||||
}
|
||||
|
||||
function getContainer(point) {
|
||||
@@ -278,14 +272,6 @@ function newTimeMachine() {
|
||||
return container;
|
||||
}
|
||||
|
||||
container = orderBookPanel.getContainer(point);
|
||||
|
||||
if (container !== undefined) {
|
||||
|
||||
/* We found an inner container which has the point. We return it. */
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
//for (var i = 0; i < this.charts.length; i++) {
|
||||
|
||||
+2
-10
@@ -30,8 +30,6 @@ function newTimelineChart() {
|
||||
let marketId;
|
||||
let exchangeId;
|
||||
|
||||
let marketIndex;
|
||||
|
||||
let level;
|
||||
|
||||
let chartGrid;
|
||||
@@ -39,11 +37,10 @@ function newTimelineChart() {
|
||||
let initializationReady = false;
|
||||
|
||||
let productsPanel;
|
||||
let orderBookPanel;
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize(exchange, market, pProductsPanel, orderBookPanelToUse, callBackFunction) {
|
||||
function initialize(exchange, market, pProductsPanel, callBackFunction) {
|
||||
|
||||
/* Remember the Products Panel */
|
||||
|
||||
@@ -55,16 +52,11 @@ function newTimelineChart() {
|
||||
|
||||
/* Legacy code to clean */
|
||||
|
||||
orderBookPanel = orderBookPanelToUse;
|
||||
|
||||
marketId = market;
|
||||
exchangeId = exchange;
|
||||
|
||||
chartGrid = newChartGrid();
|
||||
|
||||
marketIndex = newMarketIndex();
|
||||
marketIndex.initialize(exchangeId, marketId, continueInitialization);
|
||||
|
||||
function continueInitialization() {
|
||||
|
||||
recalculateScale();
|
||||
@@ -490,7 +482,7 @@ function newTimelineChart() {
|
||||
|
||||
var maxValue = {
|
||||
x: MAX_PLOTABLE_DATE.valueOf(),
|
||||
y: nextPorwerOf10(marketIndex.maxRate())
|
||||
y: nextPorwerOf10(USDT_BTC_HTH)
|
||||
};
|
||||
|
||||
|
||||
|
||||
+1
-2
@@ -45,7 +45,6 @@
|
||||
<script type="text/javascript" src="OrderBookFilesCursor.js"></script>
|
||||
<script type="text/javascript" src="Resistance.js"></script>
|
||||
<script type="text/javascript" src="ChartGrid.js"></script>
|
||||
<script type="text/javascript" src="MarketIndex.js"></script>
|
||||
<script type="text/javascript" src="DailyFileCursor.js"></script>
|
||||
<script type="text/javascript" src="TradesCursor.js"></script>
|
||||
<script type="text/javascript" src="Animation.js"></script>
|
||||
@@ -60,7 +59,7 @@
|
||||
<script type="text/javascript" src="AccumulatedVolumeBar.js"></script>
|
||||
|
||||
<script type="text/javascript" src="Azure/azure-storage.common.js"></script>
|
||||
<script type="text/javascript" src="Azure/azure-storage.file.js"></script>
|
||||
<script type="text/javascript" src="Azure/azure-storage.blob.js"></script>
|
||||
|
||||
<script type="text/javascript" src="Panels/ControlPanel.js"></script>
|
||||
<script type="text/javascript" src="Panels/ProductsPanel.js"></script>
|
||||
|
||||
Reference in new issue
Block a user