FileCache debugged

This commit is contained in:
Luis Fernando Molina committed 2018-02-19 22:09:21 +01:00
1 parent deec705f4e
commit 39fed5e698
9 files changed
+548 -1333

No files matched your search

-641
View File
@@ -1,641 +0,0 @@
function newAAMastersAAOliviaCandlesticks() {
var candles = []; // this changed.
let timePeriod = INITIAL_TIME_PERIOD;
var plotArea = newPlotArea();
var datetime = INITIAL_DATE;
var candlesticks = {
onLayerStatusChanged: onLayerStatusChanged,
currentCandle: undefined,
positionAtDatetime: positionAtDatetime,
setTimePeriod: setTimePeriod,
setDatetime: setDatetime,
container: undefined,
draw: draw,
getContainer: getContainer,
initialize: initialize
};
var container = newContainer();
container.initialize();
candlesticks.container = container;
container.displacement.containerName = "AAMasters AAOlivia Candlesticks";
container.zoom.containerName = "AAMasters AAOlivia Candlesticks";
container.frame.containerName = "AAMasters AAOlivia Candlesticks";
let marketFile;
let dailyFilesCursor;
let layerStatus = 'off';
let fileCache;
return candlesticks;
function initialize(pExchange, pMarket, pDatetime, pTimePeriod, chartLayersPanel) {
datetime = pDatetime;
timePeriod = pTimePeriod;
fileCache = newFileCache();
fileCache.initialize("AAMasters", "AAOlivia", "Candles", "Candlesticks", pExchange, pMarket, pDatetime, onCacheInitialized);
function onCacheInitialized() {
marketFile = fileCache.getMarketFile(pTimePeriod, pDatetime);
recalculateScale();
// From here old code...
//recalculateCandlesUsingDailyFiles(true); // We need the first day of candles so as to see which is going to be the center of the viewport.
// if (marketId === INITIAL_DEFAULT_MARKET) { // For now, lets position the view port at the market USDT/BTC
// postitionViewPort();
// }
recalculateCandles();
viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged);
canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished);
layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES);
}
}
function getContainer(point) {
if (layerStatus !== 'on') { return; }
var container;
/* First we check if this point is inside this space. */
if (this.container.frame.isThisPointHere(point) === true) {
return this.container;
} else {
/* This point does not belong to this space. */
return undefined;
}
}
function onLayerStatusChanged(eventData) {
if (eventData.layer === 'Olivia Candlesticks') {
layerStatus = eventData.status;
}
}
function onZoomChanged(event) {
recalculateCandles();
}
function onDragFinished() {
if (timePeriod <= _1_HOUR_IN_MILISECONDS) {
recalculateCandles();
}
}
function setTimePeriod(pTimePeriod) {
timePeriod = period;
if (timePeriod >= ONE_HOUR_IN_MILISECONDS) {
marketFile = fileCache.getMarketFile(pTimePeriod, datetime);
} else {
dailyFilesCursor = fileCache.getFileCursor(pTimePeriod, datetime);
}
recalculateCandles();
}
function setDatetime(newDatetime) {
datetime = newDatetime;
recalculateCandles();
}
function postitionViewPort() {
try {
let targetPoint = {
x: candles[Math.round(candles.length / 2)].begin,
y: candles[Math.round(candles.length / 2)].min + (candles[Math.round(candles.length / 2)].max - candles[Math.round(candles.length / 2)].min)
};
targetPoint = plotArea.inverseTransform(targetPoint, candlesticks.container.frame.height);
targetPoint = transformThisPoint(targetPoint, candlesticks.container);
let displaceVector = {
x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.topLeft.x) / 2 - targetPoint.x,
y: (viewPort.visibleArea.bottomLeft.y - viewPort.visibleArea.topLeft.y) / 2 - targetPoint.y
};
viewPort.displace(displaceVector);
} catch (err) {
// if there data is missing of the days it must position in then an exception is raised.
}
}
function positionAtDatetime(newDatetime) {
value = newDatetime.valueOf();
/* Now we calculate which candle has this new time, because it will give us the y coordinate. */
for (let i = 0; i < candles.length; i++) {
if (value >= candles[i].begin && value <= candles[i].end) {
let targetPoint = {
x: value,
y: candles[i].open
};
targetPoint = plotArea.inverseTransform(targetPoint, candlesticks.container.frame.height);
targetPoint = transformThisPoint(targetPoint, candlesticks.container);
let targetMax = {
x: value,
y: candles[i].max
};
targetMax = plotArea.inverseTransform(targetMax, candlesticks.container.frame.height);
targetMax = transformThisPoint(targetMax, candlesticks.container);
let targetMin = {
x: value,
y: candles[i].min
};
targetMin = plotArea.inverseTransform(targetMin, candlesticks.container.frame.height);
targetMin = transformThisPoint(targetMin, candlesticks.container);
let center = {
x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.bottomLeft.x) / 2,
y: (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topRight.y) / 2
};
if (targetMax.y < viewPort.visibleArea.topLeft.y || targetMin.y > viewPort.visibleArea.bottomRight.y) {
let displaceVector = {
x: 0,
y: center.y - targetPoint.y
};
viewPort.displaceTarget(displaceVector);
}
let displaceVector = {
x: center.x - targetPoint.x,
y: 0
};
viewPort.displace(displaceVector);
return;
}
}
}
function draw() {
if (layerStatus !== 'on') { return; }
this.container.frame.draw();
if (timePeriod !== ONE_DAY_IN_MILISECONDS) {
if (Math.random() * 100 > 98) {
recalculateCandles();
}
}
plotCandleChart();
}
function recalculateCandles() {
if (layerStatus === 'off') { return; }
if (timePeriod >= ONE_HOUR_IN_MILISECONDS) {
recalculateCandlesUsingMarketFiles();
} else {
recalculateCandlesUsingDailyFiles();
}
candlesticks.container.eventHandler.raiseEvent("Candles Changed", candles);
}
function recalculateCandlesUsingDailyFiles(currentDateOnly) {
let daysOnSides = getSideDays(timePeriod);
let leftDate;
let rightDate;
if (currentDateOnly === true) {
leftDate = new Date(datetime.getTime());
rightDate = new Date(datetime.getTime());
leftDate = removeTime(datetime);
rightDate = removeTime(datetime);
} else {
leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea);
rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea);
leftDate.setDate(leftDate.getDate() - daysOnSides);
rightDate.setDate(rightDate.getDate() + daysOnSides);
}
let currentDate = new Date(leftDate.getTime());
candles = [];
while (currentDate.getTime() <= rightDate.getTime()) {
let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2);
let dailyFile = dailyFilesCursor.dailyFiles.get(stringDate);
if (dailyFile !== undefined) {
const fileTimePeriod = 60 * 1000;
const totalCandles = dailyFile.length * fileTimePeriod / timePeriod;
const recordsPerCandle = timePeriod / fileTimePeriod;
for (var i = 0; i < totalCandles; i++) {
var candle = newCandle();
let min = dailyFile[i * recordsPerCandle][0];
let max = dailyFile[i * recordsPerCandle][1];
for (var j = 0; j < recordsPerCandle; j++) {
if (dailyFile[i * recordsPerCandle + j][0] < min) {
min = dailyFile[i * recordsPerCandle + j][0];
}
if (dailyFile[i * recordsPerCandle + j][1] > max) {
max = dailyFile[i * recordsPerCandle + j][1];
}
}
candle.min = min;
candle.max = max;
candle.open = dailyFile[i * recordsPerCandle][2];
candle.close = dailyFile[i * recordsPerCandle + recordsPerCandle - 1][3];
candle.begin = dailyFile[i * recordsPerCandle][4];
candle.end = dailyFile[i * recordsPerCandle + recordsPerCandle - 1][5];
candle.beginId = dailyFile[i * recordsPerCandle][6];
candle.endId = dailyFile[i * recordsPerCandle + recordsPerCandle - 1][7];
if (candle.open > candle.close) { candle.direction = 'down'; }
if (candle.open < candle.close) { candle.direction = 'up'; }
if (candle.open === candle.close) { candle.direction = 'side'; }
candles.push(candle);
if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) {
candlesticks.currentCandle = candle;
candlesticks.container.eventHandler.raiseEvent("Current Candle Changed", candlesticks.currentCandle);
}
}
}
currentDate.setDate(currentDate.getDate() + 1);
}
}
function recalculateCandlesUsingMarketFiles() {
if (marketFile === undefined) { return;} // Initialization not complete yet.
candles = [];
for (var i = 0; i < marketFile.length; i++) {
var candle = newCandle();
candle.min = marketFile[i][0];
candle.max = marketFile[i][1];
candle.open = marketFile[i][2];
candle.close = marketFile[i][3];
candle.begin = (new Date(marketFile[i][4])).valueOf();
candle.end = (new Date(marketFile[i][5])).valueOf();
if (candle.open > candle.close) { candle.direction = 'down'; }
if (candle.open < candle.close) { candle.direction = 'up'; }
if (candle.open === candle.close) { candle.direction = 'side'; }
candles.push(candle);
}
}
function recalculateScale() {
if (marketFile === undefined) { return; } // Initialization not complete yet.
var minValue = {
x: EARLIEST_DATE.valueOf(),
y: 0
};
var maxValue = {
x: MAX_PLOTABLE_DATE.valueOf(),
y: nextPorwerOf10(getMaxRate())
};
plotArea.initialize(
minValue,
maxValue,
candlesticks.container.frame.width,
candlesticks.container.frame.height
);
function getMaxRate() {
let maxValue = 0;
for (var i = 0; i < marketIndex.length; i++) {
let currentMax = marketIndex[i][1]; // 1 = rates.
if (maxValue < currentMax) {
maxValue = currentMax;
}
}
return maxValue;
}
}
function plotCandleChart() {
if (candles.length > 0) {
/* Now we calculate and plot the candles */
for (var i = 0; i < candles.length; i++) {
candle = candles[i];
var candlePoint1 = {
x: candle.begin + timePeriod / 7 * 1.5,
y: candle.open
};
var candlePoint2 = {
x: candle.begin + timePeriod / 7 * 5.5,
y: candle.open
};
var candlePoint3 = {
x: candle.begin + timePeriod / 7 * 5.5,
y: candle.close
};
var candlePoint4 = {
x: candle.begin + timePeriod / 7 * 1.5,
y: candle.close
};
candlePoint1 = plotArea.inverseTransform(candlePoint1, candlesticks.container.frame.height);
candlePoint2 = plotArea.inverseTransform(candlePoint2, candlesticks.container.frame.height);
candlePoint3 = plotArea.inverseTransform(candlePoint3, candlesticks.container.frame.height);
candlePoint4 = plotArea.inverseTransform(candlePoint4, candlesticks.container.frame.height);
candlePoint1 = transformThisPoint(candlePoint1, candlesticks.container);
candlePoint2 = transformThisPoint(candlePoint2, candlesticks.container);
candlePoint3 = transformThisPoint(candlePoint3, candlesticks.container);
candlePoint4 = transformThisPoint(candlePoint4, candlesticks.container);
if (candlePoint2.x < viewPort.visibleArea.bottomLeft.x || candlePoint1.x > viewPort.visibleArea.bottomRight.x) {
continue;
}
candlePoint1 = viewPort.fitIntoVisibleArea(candlePoint1);
candlePoint2 = viewPort.fitIntoVisibleArea(candlePoint2);
candlePoint3 = viewPort.fitIntoVisibleArea(candlePoint3);
candlePoint4 = viewPort.fitIntoVisibleArea(candlePoint4);
var stickPoint1 = {
x: candle.begin + timePeriod / 7 * 3.2,
y: candle.max
};
var stickPoint2 = {
x: candle.begin + timePeriod / 7 * 3.8,
y: candle.max
};
var stickPoint3 = {
x: candle.begin + timePeriod / 7 * 3.8,
y: candle.min
};
var stickPoint4 = {
x: candle.begin + timePeriod / 7 * 3.2,
y: candle.min
};
stickPoint1 = plotArea.inverseTransform(stickPoint1, candlesticks.container.frame.height);
stickPoint2 = plotArea.inverseTransform(stickPoint2, candlesticks.container.frame.height);
stickPoint3 = plotArea.inverseTransform(stickPoint3, candlesticks.container.frame.height);
stickPoint4 = plotArea.inverseTransform(stickPoint4, candlesticks.container.frame.height);
stickPoint1 = transformThisPoint(stickPoint1, candlesticks.container);
stickPoint2 = transformThisPoint(stickPoint2, candlesticks.container);
stickPoint3 = transformThisPoint(stickPoint3, candlesticks.container);
stickPoint4 = transformThisPoint(stickPoint4, candlesticks.container);
stickPoint1 = viewPort.fitIntoVisibleArea(stickPoint1);
stickPoint2 = viewPort.fitIntoVisibleArea(stickPoint2);
stickPoint3 = viewPort.fitIntoVisibleArea(stickPoint3);
stickPoint4 = viewPort.fitIntoVisibleArea(stickPoint4);
browserCanvasContext.beginPath();
browserCanvasContext.moveTo(stickPoint1.x, stickPoint1.y);
browserCanvasContext.lineTo(stickPoint2.x, stickPoint2.y);
browserCanvasContext.lineTo(stickPoint3.x, stickPoint3.y);
browserCanvasContext.lineTo(stickPoint4.x, stickPoint4.y);
browserCanvasContext.closePath();
browserCanvasContext.fillStyle = 'rgba(54, 54, 54, 1)';
browserCanvasContext.fill();
if (datetime !== undefined) {
let dateValue = datetime.valueOf();
if (dateValue >= candle.begin && dateValue <= candle.end) {
browserCanvasContext.strokeStyle = 'rgba(255, 233, 31, 1)'; // Current candle accroding to time
} else {
browserCanvasContext.strokeStyle = 'rgba(212, 206, 201, 1)';
}
} else {
browserCanvasContext.strokeStyle = 'rgba(212, 206, 201, 1)';
}
browserCanvasContext.lineWidth = 1;
browserCanvasContext.stroke();
browserCanvasContext.beginPath();
browserCanvasContext.moveTo(candlePoint1.x, candlePoint1.y);
browserCanvasContext.lineTo(candlePoint2.x, candlePoint2.y);
browserCanvasContext.lineTo(candlePoint3.x, candlePoint3.y);
browserCanvasContext.lineTo(candlePoint4.x, candlePoint4.y);
browserCanvasContext.closePath();
if (candle.direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, 1)'; }
if (candle.direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, 1)'; }
if (candle.direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(27, 7, 105, 1)'; }
if (datetime !== undefined) {
let dateValue = datetime.valueOf();
if (dateValue >= candle.begin && dateValue <= candle.end) {
/* highlight the current candle */
browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 1)'; // Current candle accroding to time
let currentCandle = {
bodyWidth: candlePoint2.x - candlePoint1.x,
bodyHeight: candlePoint3.y - candlePoint2.y,
stickHeight: stickPoint4.y - stickPoint2.y,
stickWidth: stickPoint2.x - stickPoint1.x,
stickStart: candlePoint2.y - stickPoint2.y,
period: timePeriod,
innerCandle: candle
};
candlesticks.container.eventHandler.raiseEvent("Current Candle Info Changed", currentCandle);
} else {
if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 1)'; }
if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 1)'; }
if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(64, 26, 217, 1)'; }
}
} else {
if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 1)'; }
if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 1)'; }
if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(64, 26, 217, 1)'; }
}
if (
candlePoint1.x < viewPort.visibleArea.topLeft.x + 50
||
candlePoint1.x > viewPort.visibleArea.bottomRight.x - 50
) {
// we leave this candles without fill.
} else {
browserCanvasContext.fill();
}
browserCanvasContext.lineWidth = 1;
browserCanvasContext.stroke();
}
}
}
}
+3 -5
View File
@@ -72,9 +72,6 @@
<Compile Include="FileCache.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="AAMasters\AAOlivia\Candlestick.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="server.js" />
<Compile Include="Displace.js" />
<Compile Include="EventHandler.js" />
@@ -105,6 +102,9 @@
</Compile>
<Compile Include="SpreadChart.js" />
<Compile Include="temp.js" />
<Compile Include="TempExosystem.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="TextButton.js" />
<Compile Include="TimelineChart.js" />
<Compile Include="TimeMachine.js" />
@@ -124,9 +124,7 @@
<Folder Include="CandleTechnicalAnalisys\" />
<Folder Include="ChartLayers\" />
<Folder Include="Indicators\" />
<Folder Include="AAMasters\" />
<Folder Include="Panels\" />
<Folder Include="AAMasters\AAOlivia\" />
<Folder Include="VolumeTechnicalAnalisys\" />
</ItemGroup>
<!-- Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them. -->
+1 -1
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.10
VisualStudioVersion = 15.0.27130.2027
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "AAWebPlatform", "AAWebPlatform.njsproj", "{3EF11619-DE26-4B8B-819D-A413DF220B76}"
EndProject
+2 -1
View File
@@ -3,7 +3,8 @@
var canvas;
var markets;
var ecosystem = newEcosystem();
let ecosystem = newEcosystem();
var viewPort = newViewPort();
+145 -669
View File
@@ -9,69 +9,11 @@ function newEcosystem() {
getExchange: getExchange,
initialize: initialize
}
return ecosystem;
const ECOSYSTEM = {
consortium: {
organization: {
name: "AAConsortium",
type: "Non-For-Profit",
displayName: "Advanced Algos Consortium",
location: "Switzerland",
leader: "Luis Molina",
logo: "AAConsortium.jpg"
},
web: "www.AdvancedAlgos.org",
github: {
org: "Advanced Algos",
repos: {
repo: {
name: "AAWebSite",
description: "AA Consortium Web Site.",
openIssues: 0,
openPullRequests: 0,
contributors: 1
},
repo: {
name: "AAWebPlatform",
description: "The part of the AA Platform that runs on web browsers.",
openIssues: 0,
openPullRequests: 0,
contributors: 1
},
repo: {
name: "AACloudPlatform",
description: "The part of the AA Platform that runs on the cloud.",
openIssues: 0,
openPullRequests: 0,
contributors: 1
}
}
},
members: {
member: {
organizationName: "AAMasters",
type: "devTeam",
delegate: "Luis Molina",
votes: 1
},
member: {
organizationName: "AAOrion LLC",
type: "cloudHosting",
delegate: "Luis Molina",
votes: 5
},
member: {
organizationName: "AAExchange Masters",
type: "exchangeWrapper",
delegate: "Luis Molina",
votes: 1
}
}
},
devTeams: {
team: {
devTeams:
{
team: [{
codeName: "AAMasters",
organization: {
name: "AAMasters",
@@ -81,609 +23,143 @@ function newEcosystem() {
leader: "Luis Molina",
logo: "AAMasters.jpg"
},
teamMembers: {
member: {
displayName: "Luis Molina",
githubUsername: "Luis-Fernando-Molina",
profilePicture: "Luis.jpg",
tokens: {
percentDistribution: 100,
totalCollected: 121.45
}
}
},
bots: {
bot: {
codeName: "AACharly",
displayName: "Charly",
type: "Extract",
version: {
number: "1.0.0",
status: "Mantained", // Discontinued
},
products: {
product: {
codeName: "Trades",
displayName: "Trades",
description: "Each file contains trades records of one market at one exchange in a period of time of one minute.",
storageAccount: "aacharly",
filePath: "@Exchange/Output/Trades/@Year/@Month/@Date/@Hour/@Minute",
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: "Trades",
displayName: "Trades",
exchangeList: ["Poloniex"],
validPeriods: ["01-min"],
plotter: {
devTeam: "AAMasters",
repo: "AACharly-Plotter",
moduleName: "TradeList",
target: "Timeline"
}
}
}
}
},
processes: {
process: {
name: "Poloniex-Live-Trades",
description: "Retrieves the trades done at the current minute and the previous minute and saves them at the storage account."
},
process: {
name: "Poloniex-Historic-Trades",
description: "Retrieves and saves the historical trades in batches going backwards from the current time until reaching the begining of the market."
},
process: {
name: "Poloniex-Hole-Fixing",
description: "Scans the trades saved by the Live Trades and Historic Trades processes searching for missing records. Once a hole is found on the data set, it patches it by retrieving the missing records from the exchange."
}
},
directDependencies: {},
directDependents: {
bot: {
devTeam: "AAMasters",
codeName: "AABruce"
},
bot: {
devTeam: "AAMasters",
codeName: "AAOlivia"
}
},
collaboratorsList: [],
github: {
org: "AAMasters",
repos: {
repo: {
name: "AACharly-Bot",
description: "Produces a data-set of all trades of every market in multiple exchanges.",
openIssues: 0,
openPullRequests: 0,
contributors: 1
},
repo: {
name: "AACharly-Plotter",
description: "Plotters plug-ins to browse trades at the AA Web Platform.",
openIssues: 0,
openPullRequests: 0,
contributors: 1
}
}
},
storage: {
sas: '?sv=2017-04-17&ss=f&srt=sco&sp=rc&se=2018-12-31T02:33:36Z&st=2018-02-01T18:33:36Z&spr=https&sig=xFTcopdKq0f60wl2iuukbtIpcLwxZVKzlw5BzpJfo5g%3D',
fileUri: 'https://' + 'aacharly' + '.file.core.windows.net'
}
},
bot: {
codeName: "AACarol",
displayName: "Carol",
type: "Extract",
version: {
number: "1.0.0",
status: "Mantained", // Discontinued
},
products: {
product: {
codeName: "Order Book",
displayName: "Order Book",
description: "Each file contains the bids and asks positions at each market at a certain moment in time.",
storageAccount: "aacarol",
filePath: "@Exchange/Output/Order-Books/@Year/@Month/@Date/@Hour/@Minute",
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: "Order Book",
displayName: "Order Book",
exchangeList: ["Poloniex"],
validPeriods: ["06-hs", "03-hs", "01-hs", "30-min", "10-min", "05-min", "01-min"],
plotter: {
devTeam: "AAMasters",
repo: "AACarol-Plotter",
moduleName: "OrderBook",
target: "Panel"
}
}
}
},
product: {
codeName: "Order Books",
displayName: "Order Books",
description: "Each file contains the sumarized bids and asks positions at each market at a certain moment in time. Agreggation makes the dataset optimal for different time periods.",
storageAccount: "aacarol",
filePath: "@Exchange/Output/Aggregated-Order-Books/@Period/@Year/@Month/@Date/@Hour/@Minute",
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: "Order Books",
displayName: "Order Books",
exchangeList: ["Poloniex"],
validPeriods: ["06-hs", "03-hs", "01-hs", "30-min", "10-min", "05-min", "01-min"],
plotter: {
devTeam: "AAMasters",
repo: "AACarol-Plotter",
moduleName: "OrderBooks",
target: "Timeline"
}
}
}
}
},
processes: {
process: {
name: "Poloniex-Order-Books",
description: "Retrieves the order books at the current minute and saves them at the storage account."
},
process: {
name: "Aggregated-Order-Books",
description: "Aggregates the order books information to be viewed at different time periods."
},
},
directDependencies: {},
directDependents: {},
collaboratorsList: [],
github: {
org: "AAMasters",
repos: {
repo: {
name: "AACarol",
description: "Produces a data-set with a snapshot of all markets order books every minute.",
openIssues: 0,
openPullRequests: 0,
contributors: 1
}
}
},
storage: {
sas: '?sv=2017-04-17&ss=f&srt=sco&sp=r&se=2018-12-01T00:09:44Z&st=2017-12-01T13:09:44Z&spr=https,http&sig=J60UlQuUqh9Hd1Pm0PqIF6yari3D3TkGEz1fSNQJWks%3D',
fileUri: 'https://' + 'aadata' + '.file.core.windows.net'
}
},
bot: {
codeName: "AABruce",
displayName: "Bruce",
type: "Indicator",
version: {
number: "1.0.0",
status: "Mantained", // Discontinued
},
products: {
product: {
codeName: "Candles",
displayName: "One Minute Candles in Daily Files",
description: "Each file contains the candles of one whole day on a one minute time period.",
storageAccount: "aabruce",
filePath: "@Exchange/Output/Candles/One-Min/@Year/@Month/@Date",
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: "Candles",
displayName: "Candlesticks",
exchangeList: ["Poloniex"],
validPeriods: ["30-min", "10-min", "05-min", "01-min"],
plotter: {
devTeam: "AAMasters",
repo: "AABruce-Plotter",
moduleName: "Candlesticks",
target: "Timeline",
dependencies: {
dependency: {
devTeam: "AAMasters",
repo: "Plotters-Utilities",
moduleName: "Candlesticks"
}
}
}
}
}
},
product: {
codeName: "Volumes",
displayName: "One Minute Volumes in Daily Files",
description: "Each file contains the volumes of one whole day on a one minute time period.",
storageAccount: "aabruce",
filePath: "@Exchange/Output/Volumes/One-Min/@Year/@Month/@Date",
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: "Volumes",
displayName: "Sell and Buy Volumes",
exchangeList: ["Poloniex"],
validPeriods: ["06-hs", "03-hs", "01-hs", "30-min", "10-min", "05-min", "01-min"],
plotter: {
devTeam: "AAMasters",
repo: "AABruce-Plotter",
moduleName: "Volumes",
target: "Timeline",
dependencies: {
dependency: {
devTeam: "AAMasters",
repo: "Plotters-Utilities",
moduleName: "Volumes"
}
}
}
}
}
}
},
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-31T02:32:04Z&st=2018-02-01T18:32:04Z&spr=https&sig=SbZI6bvAE1MBxna2NOvfgMroPFZNjAyaHUsAPvh11hg%3D',
fileUri: 'https://' + 'aabruce' + '.file.core.windows.net'
}
},
bot: {
codeName: "AAOlivia",
displayName: "Olivia",
type: "Indicator",
version: {
number: "1.0.0",
status: "Mantained", // Discontinued
},
products: {
product: {
codeName: "Candles",
displayName: "Market Candles per Period",
description: "A set of files per period that contains all candles of one whole market.",
storageAccount: "aaolivia",
filePath: "@Exchange/Output/Candles/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: "Candlesticks",
displayName: "Candlesticks",
exchangeList: ["Poloniex"],
validPeriods: ["24-hs", "12-hs", "06-hs", "03-hs", "01-hs"],
plotter: {
devTeam: "AAMasters",
repo: "AAOlivia-Plotter",
moduleName: "Candlesticks",
target: "Timeline",
dependencies: {
dependency: {
devTeam: "AAMasters",
repo: "Plotters-Utilities",
moduleName: "Candlesticks"
}
}
}
}
}
},
product: {
codeName: "Volumes",
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",
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: "Volumes",
displayName: "Volumes",
exchangeList: ["Poloniex"],
validPeriods: ["24-hs", "12-hs", "06-hs", "03-hs", "01-hs"],
plotter: {
devTeam: "AAMasters",
repo: "AAOlivia-Plotter",
moduleName: "Volumes",
target: "Timeline",
dependencies: {
dependency: {
devTeam: "AAMasters",
repo: "Plotters-Utilities",
moduleName: "Volumes"
}
}
}
}
}
}
},
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=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'
}
}
}
}
},
clouds: {
cloudHosting: {
codeName: "AAOrion",
organization: {
name: "AAOrion LLC",
type: "Company",
displayName: "Orion",
location: "USA",
leader: "Luis Molina",
logo: "AAOrion.jpg"
},
github: {
org: "AAOrion",
repos: {
repo: {
name: "AzureAAHosting",
description: "AA Azure Hosting Web Site",
openIssues: 0,
openPullRequests: 0,
contributors: 1
}
}
},
underlayingCloud: "Azure",
botsRunning: {
bot: {
devTeam: "AAMasters",
codeName: "AACharly",
version: "1.0.0",
status: "Alive",
stats: {
teamMembers:
[{
member: {
displayName: "Luis Molina",
githubUsername: "Luis-Fernando-Molina",
profilePicture: "Luis.jpg",
tokens: {
totalCollected: 532.2442,
totalSpent: 323.455,
currentBalance: 142,
expensesPerHour: 1.44,
maxBalance: 177,
minBalance: 22.44
percentDistribution: 100,
totalCollected: 121.45
}
}
}]
,
bots:
{
bot: [
{
codeName: "AAOlivia",
displayName: "Olivia",
type: "Indicator",
version: {
number: "1.0.0",
status: "Mantained", // Discontinued
},
life: {
born: "2015-02-19 19:15:00.000 GMT+0000",
died: undefined,
expectedToRetire: "2019-02-19 19:15:00.000 GMT+0000",
expectedToDie: "2019-03-19 19:15:00.000 GMT+0000"
}
}
},
bot: {
devTeam: "AAMasters",
codeName: "AACarol",
version: "1.0.0",
status: "Alive",
stats: {
tokens: {
totalCollected: 532.2442,
totalSpent: 323.455,
currentBalance: 142,
expensesPerHour: 1.44,
maxBalance: 177,
minBalance: 22.44
products: {
product: [{
codeName: "Candles",
displayName: "Market Candles per Period",
description: "A set of files per period that contains all candles of one whole market.",
storageAccount: "aaolivia",
filePath: "@Exchange/Output/Candles/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: "Candlesticks",
displayName: "Candlesticks",
exchangeList: ["Poloniex"],
validPeriods: ["24-hs", "12-hs", "06-hs", "03-hs", "01-hs"],
plotter: {
devTeam: "AAMasters",
repo: "AAOlivia-Plotter",
moduleName: "Candlesticks",
target: "Timeline",
dependencies: {
dependency: {
devTeam: "AAMasters",
repo: "Plotters-Utilities",
moduleName: "Candlesticks"
}
}
}
}]
}
}, {
codeName: "Volumes",
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",
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: "Volumes",
displayName: "Volumes",
exchangeList: ["Poloniex"],
validPeriods: ["24-hs", "12-hs", "06-hs", "03-hs", "01-hs"],
plotter: {
devTeam: "AAMasters",
repo: "AAOlivia-Plotter",
moduleName: "Volumes",
target: "Timeline",
dependencies: {
dependency: {
devTeam: "AAMasters",
repo: "Plotters-Utilities",
moduleName: "Volumes"
}
}
}
}]
}
}]
},
life: {
born: "2015-02-19 19:15:00.000 GMT+0000",
died: undefined,
expectedToRetire: "2019-02-19 19:15:00.000 GMT+0000",
expectedToDie: "2019-03-19 19:15:00.000 GMT+0000"
}
}
}
},
stats: {
extractionBots: 2,
indicatorsBots: 24,
tradingBots: 12,
suscribers: 230,
apps: 1
}
}
},
exchanges: {
exchangeWrapper: {
codeName: "AAExchange-Masters",
organization: {
name: "AAExchange Masters",
type: "Open Source Project",
displayName: "Exchange Masters",
location: "Global",
leader: "Luis Molina",
logo: "AAExchange-Masters.jpg"
},
exchangesServed: {
exchange: {
name: "Poloniex",
github: {
org: "AAExchange Masters",
repo: {
name: "AAPoloniexWrapper",
description: "Wrapps Poloniex Exchange to be acceced from within the Advanced Algos Ecosystem.",
openIssues: 0,
openPullRequests: 0,
contributors: 1
}
}
},
exchange: {
name: "Binance",
github: {
org: "AAExchange Masters",
repo: {
name: "AABinanceWrapper",
description: "Wrapps Binance Exchange to be acceced from within the Advanced Algos Ecosystem.",
openIssues: 0,
openPullRequests: 0,
contributors: 1
}
}
}
}
}
},
apps: {
app: {
organization: {
name: "AAApps Masters",
type: "Open Source Project",
displayName: "Global Ranking",
location: "Global",
leader: "Luis Molina",
logo: "AAApps-Masters.jpg"
},
github: {
org: "AAApps Masters",
repo: {
name: "AAGlobalRanking",
description: "Global Ranking Web Site",
openIssues: 0,
openPullRequests: 0,
contributors: 1
}
},
web: "www.AAGlobalRanking.org",
tradingBots: {
bot: {
devTeam: "AAMasters",
codeName: "AAMichael",
version: "1.0.0",
cloudHosting: "AAOrion",
suscribers: {
subscriber: {
userName: "Trader 007",
subscription: {
type: "Trade-For-Me",
tokensPaid: 20,
expirationDatetime: "2019-03-19 19:15:00.000 GMT+0000"
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
}]
}
},
subscriber: {
userName: "EliasYofre1",
subscription: {
type: "Buy-Sell-Signals",
tokensPaid: 1,
expirationDatetime: "2019-03-19 19:15:00.000 GMT+0000"
}
storage: {
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'
}
}
}
]
}
}
}]
}
};
return ecosystem;
function initialize() {
@@ -693,55 +169,55 @@ function newEcosystem() {
function getTeam(pTeamCodeName) {
for (var team in ECOSYSTEM.devTeams) {
for (let i = 0; i < ECOSYSTEM.devTeams.team.length; i++) {
if (team.codeName === pTeamCodeName) {
if (ECOSYSTEM.devTeams.team[i].codeName === pTeamCodeName) {
return team;
return ECOSYSTEM.devTeams.team[i];
}
}
}
function getBot(pTeam, pBotCodeName) {
for (var bot in pTeam.bots) {
for (let i = 0; i < pTeam.bots.bot.length; i++) {
if (bot.codeName === pBotCodeName) {
if (pTeam.bots.bot[i].codeName === pBotCodeName) {
return bot;
return pTeam.bots.bot[i];
}
}
}
function getProduct(pBot, pProductCodeName) {
for (var product in pBot.products) {
for (let i = 0; i < pBot.products.product.length; i++) {
if (bot.codeName === pProductCodeName) {
if (pBot.products.product[i].codeName === pProductCodeName) {
return product;
return pBot.products.product[i];
}
}
}
function getLayer(pProduct, pLayerCodeName) {
for (var layer in pProduct.layers) {
for (let i = 0; i < pProduct.layers.layer.length; i++) {
if (layer.codeName === pLayerCodeName) {
if (pProduct.layers.layer[i].codeName === pLayerCodeName) {
return layer;
return pProduct.layers.layer[i];
}
}
}
function getExchange(pProduct, pName) {
for (var exchange in pProduct.exchangeList) {
for (let i = 0; i < pProduct.exchangeList.exchange.length; i++) {
if (exchange.name === pName) {
if (pProduct.exchangeList.exchange[i].name === pName) {
return exchange;
return pProduct.exchangeList.exchange[i];
}
}
}
+13 -9
View File
@@ -12,6 +12,8 @@ function newFileCache() {
'[' + 2 * 60 * 60 * 1000 + ',' + '"02-hs"' + ']' + ',' +
'[' + 1 * 60 * 60 * 1000 + ',' + '"01-hs"' + ']' + ']';
marketFilesPeriods = JSON.parse(marketFilesPeriods);
let dailyFilePeriods =
'[' +
'[' + 45 * 60 * 1000 + ',' + '"45-min"' + ']' + ',' +
@@ -26,6 +28,8 @@ function newFileCache() {
'[' + 02 * 60 * 1000 + ',' + '"02-min"' + ']' + ',' +
'[' + 01 * 60 * 1000 + ',' + '"01-min"' + ']' + ']';
dailyFilePeriods = JSON.parse(dailyFilePeriods);
let fileCache = {
getMarketFile: getMarketFile,
getFileCursor: getFileCursor,
@@ -44,24 +48,24 @@ function newFileCache() {
if (product === undefined) {
throw "Product not found at this bot of the ecosystem! - pTeamCodeName = " + pTeamCodeName + " pBotCodeName = " + pBotCodeName + " pProductCodeName = " + pProductCodeName;
return;
throw "Product not found at this bot of the ecosystem! - pTeamCodeName = " + pTeamCodeName + ", pBotCodeName = " + pBotCodeName + ", pProductCodeName = " + pProductCodeName;
}
let exchange = ecosystem.getExchange(product, name);
let exchange = ecosystem.getExchange(product, pExchange);
if (exchange === undefined) {
throw "Exchange not supoorted by this product of the ecosystem! - pTeamCodeName = " + pTeamCodeName + " pBotCodeName = " + pBotCodeName + " pProductCodeName = " + pProductCodeName + " pExchange = " + pExchange;
return;
throw "Exchange not supoorted by this product of the ecosystem! - pTeamCodeName = " + pTeamCodeName + ", pBotCodeName = " + pBotCodeName + ", pProductCodeName = " + pProductCodeName + ", pExchange = " + pExchange;
}
let layer = ecosystem.getLayer(product, pLayerCodeName);
if (layer === undefined) {
throw "Layer not found at this product of the ecosystem! - pTeamCodeName = " + pTeamCodeName + " pBotCodeName = " + pBotCodeName + " pProductCodeName = " + pProductCodeName + " pLayerCodeName = " + pLayerCodeName;
return;
throw "Layer not found at this product of the ecosystem! - pTeamCodeName = " + pTeamCodeName + ", pBotCodeName = " + pBotCodeName + ", pProductCodeName = " + pProductCodeName + ", pLayerCodeName = " + pLayerCodeName;
}
fileCloud = newFileCloud();
@@ -69,7 +73,7 @@ function newFileCache() {
let filesReceived = 0;
for (i = 0; i < marketFilesPeriods; i++) {
for (i = 0; i < marketFilesPeriods.length; i++) {
let periodTime = marketFilesPeriods[i][0];
let periodName = marketFilesPeriods[i][1];
@@ -84,7 +88,7 @@ function newFileCache() {
filesReceived++;
if (filesReceived === layer.validPeriods.lenght + 1) {
if (filesReceived === layer.validPeriods.length + 1) {
callBackFunction();
+4 -4
View File
@@ -23,11 +23,11 @@ function newFileCloud() {
let fileName = pProduct.fileName;
let filePath = pProduct.filePath;
fileName.replace("@AssetA", pMarket.assetA);
fileName.replace("@AssetB", pMarket.assetB);
fileName = fileName.replace("@AssetA", pMarket.assetA);
fileName = fileName.replace("@AssetB", pMarket.assetB);
filePath.replace("@Exchange", pExchange.name);
filePath.replace("@Period", pPeriodName);
filePath = filePath.replace("@Exchange", pExchange.name);
filePath = filePath.replace("@Period", pPeriodName);
fileService.getFileToText('data', filePath, fileName, undefined, onFileReceived);
+322
View File
@@ -0,0 +1,322 @@
{
codeName: "AACharly",
displayName: "Charly",
type: "Extract",
version: {
number: "1.0.0",
status: "Mantained", // Discontinued
},
products: [{
product: {
codeName: "Trades",
displayName: "Trades",
description: "Each file contains trades records of one market at one exchange in a period of time of one minute.",
storageAccount: "aacharly",
filePath: "@Exchange/Output/Trades/@Year/@Month/@Date/@Hour/@Minute",
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: "Trades",
displayName: "Trades",
exchangeList: ["Poloniex"],
validPeriods: ["01-min"],
plotter: {
devTeam: "AAMasters",
repo: "AACharly-Plotter",
moduleName: "TradeList",
target: "Timeline"
}
}
}]
}
}]
,
processes:
[{
process: {
name: "Poloniex-Live-Trades",
description: "Retrieves the trades done at the current minute and the previous minute and saves them at the storage account."
}
}, {
process: {
name: "Poloniex-Historic-Trades",
description: "Retrieves and saves the historical trades in batches going backwards from the current time until reaching the begining of the market."
}
}, {
process: {
name: "Poloniex-Hole-Fixing",
description: "Scans the trades saved by the Live Trades and Historic Trades processes searching for missing records. Once a hole is found on the data set, it patches it by retrieving the missing records from the exchange."
}
}]
,
directDependencies: { },
directDependents: [{
bot: {
devTeam: "AAMasters",
codeName: "AABruce"
}
}, {
bot: {
devTeam: "AAMasters",
codeName: "AAOlivia"
}
}]
,
collaboratorsList: [],
github: {
org: "AAMasters",
repos: [{
repo: {
name: "AACharly-Bot",
description: "Produces a data-set of all trades of every market in multiple exchanges.",
openIssues: 0,
openPullRequests: 0,
contributors: 1
}
}, {
repo: {
name: "AACharly-Plotter",
description: "Plotters plug-ins to browse trades at the AA Web Platform.",
openIssues: 0,
openPullRequests: 0,
contributors: 1
}
}]
},
storage: {
sas: '?sv=2017-04-17&ss=f&srt=sco&sp=rc&se=2018-12-31T02:33:36Z&st=2018-02-01T18:33:36Z&spr=https&sig=xFTcopdKq0f60wl2iuukbtIpcLwxZVKzlw5BzpJfo5g%3D',
fileUri: 'https://' + 'aacharly' + '.file.core.windows.net'
}
},
{
codeName: "AACarol",
displayName: "Carol",
type: "Extract",
version: {
number: "1.0.0",
status: "Mantained", // Discontinued
},
products: [
{
product: {
codeName: "Order Book",
displayName: "Order Book",
description: "Each file contains the bids and asks positions at each market at a certain moment in time.",
storageAccount: "aacarol",
filePath: "@Exchange/Output/Order-Books/@Year/@Month/@Date/@Hour/@Minute",
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: "Order Book",
displayName: "Order Book",
exchangeList: ["Poloniex"],
validPeriods: ["06-hs", "03-hs", "01-hs", "30-min", "10-min", "05-min", "01-min"],
plotter: {
devTeam: "AAMasters",
repo: "AACarol-Plotter",
moduleName: "OrderBook",
target: "Panel"
}
}
}
}
},
{
product: {
codeName: "Order Books",
displayName: "Order Books",
description: "Each file contains the sumarized bids and asks positions at each market at a certain moment in time. Agreggation makes the dataset optimal for different time periods.",
storageAccount: "aacarol",
filePath: "@Exchange/Output/Aggregated-Order-Books/@Period/@Year/@Month/@Date/@Hour/@Minute",
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: "Order Books",
displayName: "Order Books",
exchangeList: ["Poloniex"],
validPeriods: ["06-hs", "03-hs", "01-hs", "30-min", "10-min", "05-min", "01-min"],
plotter: {
devTeam: "AAMasters",
repo: "AACarol-Plotter",
moduleName: "OrderBooks",
target: "Timeline"
}
}
}
}
}
],
processes: [{
process: {
name: "Poloniex-Order-Books",
description: "Retrieves the order books at the current minute and saves them at the storage account."
}
}, {
process: {
name: "Aggregated-Order-Books",
description: "Aggregates the order books information to be viewed at different time periods."
}
}
],
directDependencies: [],
directDependents: [],
collaboratorsList: [],
github: {
org: "AAMasters",
repos: [{
repo: {
name: "AACarol",
description: "Produces a data-set with a snapshot of all markets order books every minute.",
openIssues: 0,
openPullRequests: 0,
contributors: 1
}
}
]
},
storage: {
sas: '?sv=2017-04-17&ss=f&srt=sco&sp=r&se=2018-12-01T00:09:44Z&st=2017-12-01T13:09:44Z&spr=https,http&sig=J60UlQuUqh9Hd1Pm0PqIF6yari3D3TkGEz1fSNQJWks%3D',
fileUri: 'https://' + 'aadata' + '.file.core.windows.net'
}
}
{
codeName: "AABruce",
displayName: "Bruce",
type: "Indicator",
version: {
number: "1.0.0",
status: "Mantained", // Discontinued
},
products: {
product: [{
codeName: "Candles",
displayName: "One Minute Candles in Daily Files",
description: "Each file contains the candles of one whole day on a one minute time period.",
storageAccount: "aabruce",
filePath: "@Exchange/Output/Candles/One-Min/@Year/@Month/@Date",
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: "Candles",
displayName: "Candlesticks",
exchangeList: ["Poloniex"],
validPeriods: ["30-min", "10-min", "05-min", "01-min"],
plotter: {
devTeam: "AAMasters",
repo: "AABruce-Plotter",
moduleName: "Candlesticks",
target: "Timeline",
dependencies: {
dependency: {
devTeam: "AAMasters",
repo: "Plotters-Utilities",
moduleName: "Candlesticks"
}
}
}
}
}
}, {
codeName: "Volumes",
displayName: "One Minute Volumes in Daily Files",
description: "Each file contains the volumes of one whole day on a one minute time period.",
storageAccount: "aabruce",
filePath: "@Exchange/Output/Volumes/One-Min/@Year/@Month/@Date",
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: "Volumes",
displayName: "Sell and Buy Volumes",
exchangeList: ["Poloniex"],
validPeriods: ["06-hs", "03-hs", "01-hs", "30-min", "10-min", "05-min", "01-min"],
plotter: {
devTeam: "AAMasters",
repo: "AABruce-Plotter",
moduleName: "Volumes",
target: "Timeline",
dependencies: {
dependency: {
devTeam: "AAMasters",
repo: "Plotters-Utilities",
moduleName: "Volumes"
}
}
}
}
}
}
]
,
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-31T02:32:04Z&st=2018-02-01T18:32:04Z&spr=https&sig=SbZI6bvAE1MBxna2NOvfgMroPFZNjAyaHUsAPvh11hg%3D',
fileUri: 'https://' + 'aabruce' + '.file.core.windows.net'
}
+58 -3
View File
@@ -8,12 +8,12 @@ const octokit = require('@octokit/rest')()
global.atob = require("atob");
let owner = "AAMasters";
let repo = "AABruce-Bot";
let repo = "AABruce-Indicator-Bot";
let branch = "master";
let page = 1;
let per_page = 100;
let ref = "master";
let path = "One-Min-Daily-Candles-Volumes/run.js";
let path = "One-Min-Daily-Candles-Volumes/Interval.js";
octokit.repos.getContent({ owner, repo, path, ref }, onContent);
@@ -21,14 +21,17 @@ function onContent (error, result) {
let decoded = atob(result.data.content);
console.log(decoded);
console.log(decoded.substring(3));
console.log(result);
}
return;
*/
//'use strict';
var http = require('http');
var port = process.env.PORT || 1337;
@@ -43,6 +46,36 @@ function onRequestReceivedFromBrowser(request, response) {
switch (requestParameters[1]) {
case "AAMasters":
{
const octokit = require('@octokit/rest')()
global.atob = require("atob");
let owner = "AAMasters";
let repo = "AAOlivia-Plotter";
let branch = "master";
let page = 1;
let per_page = 100;
let ref = "master";
let path = "Candlestick.js";
octokit.repos.getContent({ owner, repo, path, ref }, onContent);
function onContent(error, result) {
let decoded = atob(result.data.content);
//console.log(decoded);
//console.log(result);
respondWithContent(decoded.substring(3), response); // Eliminate first 2 bytes of noise.
}
}
break;
case "CandleTechnicalAnalisys":
{
respondWithFile('./' + requestParameters[1] + '/' + requestParameters[2], response);
@@ -246,6 +279,28 @@ function onRequestReceivedFromBrowser(request, response) {
}
function respondWithContent(content, response) {
try {
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
response.setHeader("Pragma", "no-cache"); // HTTP 1.0.
response.setHeader("Expires", "0"); // Proxies.
response.setHeader("Access-Control-Allow-Origin", "*"); // Allows to access data from other domains.
response.writeHead(200, { 'Content-Type': 'text/html' });
response.write(content);
response.end("\n");
console.log("Content Sent: " + content);
}
catch (err) {
returnEmptyArray();
}
}
function respondWithFile(fileName, response) {
let fs = require('fs');