Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop

This commit is contained in:
Luis Fernando Molina committed 2021-05-02 18:22:07 +02:00
commit 81c20d148e
7 files changed
+204 -31

No files matched your search

+5 -2
View File
@@ -12,7 +12,7 @@ jobs:
- id: repository
uses: ASzc/change-string-case-action@v1
with:
string: "${{ github.repository }}/${{ github.event.repository.name }}"
string: "${{ github.repository }}"
- uses: actions/checkout@v2
- name: Preparation
id: prep
@@ -20,9 +20,12 @@ jobs:
REGISTRY="ghcr.io"
IMAGE="${REGISTRY}/${{ steps.repository.outputs.lowercase }}"
TAGS="${IMAGE}:${{ github.sha }}"
if [[ $GITHUB_REF == ref/head/master ]]; then
if [[ $GITHUB_REF == refs/heads/master ]]; then
TAGS="${TAGS},${IMAGE}:latest"
fi
if [[ $GITHUB_REF == refs/heads/develop ]]; then
TAGS="${TAGS},${IMAGE}:develop"
fi
echo ::set-output name=tags::${TAGS}
- name: Login in to registry
uses: docker/login-action@v1
@@ -0,0 +1 @@
{"type":"Data Mine","name":"PLUVTECH-DM","config":"{\n \"codeName\": \"PLUVTECH-DM\"\n}","project":"Superalgos","sensorBots":[],"apiDataFetcherBots":[],"indicatorBots":[{"type":"Indicator Bot","name":"Fisher Transform","config":"{\n \"codeName\": \"Fisher\"\n}","project":"Superalgos","processes":[{"type":"Process Definition","name":"Multi-Period-Market","config":"{\n \"codeName\": \"Multi-Period-Market\",\n \"description\": \"Produces Fisher Transform\",\n \"deadWaitTime\": 0,\n \"normalWaitTime\": 0,\n \"retryWaitTime\": 10000,\n \"sleepWaitTime\": 3600000,\n \"comaWaitTime\": 86400000,\n \"framework\": {\n \"name\": \"Multi-Period-Market\"\n }\n}","project":"Superalgos","processOutput":{"type":"Process Output","name":"New Process Output","project":"Superalgos","outputDatasets":[{"type":"Output Dataset","name":"Multi-Period-Market FisherTransform","project":"Superalgos","id":"417d48b6-505e-44da-819c-9bae7ef27be1","savedPayload":{"position":{"x":21544.760606413663,"y":17851.908855440484},"targetPosition":{"x":21570.642510923917,"y":17948.50143806939},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":1,"distanceToParent":2,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"9323c88c-d610-4539-b736-cbb8653cef13"}}}],"outputDatasetFolders":[],"id":"8e54b923-f47a-44c4-9463-0ad427cad349","savedPayload":{"position":{"x":21570.642510923917,"y":17948.50143806939},"targetPosition":{"x":21609.465367689296,"y":18093.39031201275},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":2,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"processDependencies":{"type":"Process Dependencies","name":"New Process Dependencies","project":"Superalgos","statusDependencies":[{"type":"Status Dependency","name":"Fisher Transform Multi-Period-Market","config":"{\n \"mainUtility\": \"Self Reference\"\n}","project":"Superalgos","id":"6a19b7ec-c85e-4acd-aa3d-476d56899896","savedPayload":{"position":{"x":21612.111081220053,"y":17673.708753558363},"targetPosition":{"x":21687.111081220053,"y":17803.61256412603},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":2,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Status Report","name":"New Status Report","id":"6d52d241-dc08-45b6-af54-d4a3d3884211"}}},{"type":"Status Dependency","name":"Candles Volumes Multi-Period-Market","config":"{\n \"mainUtility\": \"Market Ending Point\"\n}","project":"Superalgos","id":"2f8cefb9-94ad-4126-b666-cfb9744a90c6","savedPayload":{"position":{"x":21725.933937985432,"y":17658.72369018267},"targetPosition":{"x":21687.111081220053,"y":17803.61256412603},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":2,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Status Report","name":"New Status Report","id":"a0a61ba9-91cb-4ec7-92fe-134ff079de2d"}}}],"dataDependencies":[{"type":"Data Dependency","name":"Candles Multi-Period-Market","project":"Superalgos","id":"e246ec47-4cad-43e5-a2ec-4a9a12f41ea2","savedPayload":{"position":{"x":21817.01489178772,"y":17728.61256412603},"targetPosition":{"x":21687.111081220053,"y":17803.61256412603},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":2,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"2b03494a-67d6-47f1-89b6-53fc4c9116a8"}}}],"dataMineDataDependencies":[],"id":"6827047a-9e5f-463f-bceb-e832686975a9","savedPayload":{"position":{"x":21687.111081220053,"y":17803.61256412603},"targetPosition":{"x":21609.465367689296,"y":18093.39031201275},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"statusReport":{"type":"Status Report","name":"New Status Report","project":"Superalgos","id":"6d52d241-dc08-45b6-af54-d4a3d3884211","savedPayload":{"position":{"x":21715.531384867278,"y":17987.32429483477},"targetPosition":{"x":21609.465367689296,"y":18093.39031201275},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":2,"arrangementStyle":0},"uiObject":{}}},"executionStartedEvent":{"type":"Execution Started Event","name":"Candles Volumes Multi-Period-Market","project":"Superalgos","id":"bfafbb28-81d6-42c9-bc1e-9711318c8192","savedPayload":{"position":{"x":21899.243115576017,"y":18015.744598481993},"targetPosition":{"x":21609.465367689296,"y":18093.39031201275},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Execution Finished Event","name":"New Execution Finished Event","id":"18Line truncated
@@ -0,0 +1 @@
{"type":"Data Mine","name":"Turtles","config":"{\n \"codeName\": \"Turtles\"\n}","project":"Superalgos","sensorBots":[],"apiDataFetcherBots":[],"indicatorBots":[{"type":"Indicator Bot","name":"Turtle","config":"{\n \"codeName\": \"Turtle\"\n}","project":"Superalgos","processes":[{"type":"Process Definition","name":"Multi-Period-Market","config":"{\n \"codeName\": \"Multi-Period-Market\",\n \"normalWaitTime\": 0,\n \"retryWaitTime\": 10000,\n \"framework\": {\n \"name\": \"Multi-Period-Market\"\n }\n}","project":"Superalgos","processOutput":{"type":"Process Output","name":"New Process Output","project":"Superalgos","outputDatasets":[{"type":"Output Dataset","name":"Multi-Period-Market Turtle S1","project":"Superalgos","id":"4006ddaa-a950-4e6e-b433-ae597d79e45a","savedPayload":{"position":{"x":17719.26080472765,"y":18326.909330436712},"targetPosition":{"x":17796.90651825841,"y":18616.687078323434},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"5ed808a7-f462-4971-a076-cb025f42b0e0"}}}],"outputDatasetFolders":[],"id":"8be5b8b5-9717-4904-b32a-0bc45cc0c1c5","savedPayload":{"position":{"x":17796.90651825841,"y":18616.687078323434},"targetPosition":{"x":17874.552231789166,"y":18906.464826210155},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"processDependencies":{"type":"Process Dependencies","name":"New Process Dependencies","project":"Superalgos","statusDependencies":[{"type":"Status Dependency","name":"Turtle Multi-Period-Market","config":"{\n \"mainUtility\": \"Self Reference\"\n}","project":"Superalgos","id":"258a1248-8455-4c12-8b8d-05f2f7173620","savedPayload":{"position":{"x":17877.197945319924,"y":18486.783267755767},"targetPosition":{"x":17952.197945319924,"y":18616.687078323434},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":2,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Status Report","name":"New Status Report","id":"04a3b949-4c9f-4fd1-b1db-09e8de1c42fd"}}},{"type":"Status Dependency","name":"Candles Volumes Multi-Period-Market","config":"{\n \"mainUtility\": \"Market Ending Point\"\n}","project":"Superalgos","id":"650ab610-b02a-4f75-9ef5-250d290805b8","savedPayload":{"position":{"x":17991.020802085302,"y":18471.798204380073},"targetPosition":{"x":17952.197945319924,"y":18616.687078323434},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":2,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Status Report","name":"New Status Report","id":"a0a61ba9-91cb-4ec7-92fe-134ff079de2d"}}}],"dataDependencies":[{"type":"Data Dependency","name":"Candles Multi-Period-Market","project":"Superalgos","id":"89c2879f-d45f-4b64-85be-7a531fc71c71","savedPayload":{"position":{"x":18082.10175588759,"y":18541.687078323434},"targetPosition":{"x":17952.197945319924,"y":18616.687078323434},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":2,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"2b03494a-67d6-47f1-89b6-53fc4c9116a8"}}}],"dataMineDataDependencies":[],"id":"b5af90bc-fc96-4ece-8fd4-59381bb2993b","savedPayload":{"position":{"x":17952.197945319924,"y":18616.687078323434},"targetPosition":{"x":17874.552231789166,"y":18906.464826210155},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"statusReport":{"type":"Status Report","name":"New Status Report","project":"Superalgos","id":"04a3b949-4c9f-4fd1-b1db-09e8de1c42fd","savedPayload":{"position":{"x":18086.68426614513,"y":18694.33279185419},"targetPosition":{"x":17874.552231789166,"y":18906.464826210155},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"executionStartedEvent":{"type":"Execution Started Event","name":"Candles Volumes Multi-Period-Market","project":"Superalgos","id":"98c59689-1fd7-4229-a674-fc2e20a0edfa","savedPayload":{"position":{"x":18164.329979675887,"y":18828.819112679397},"targetPosition":{"x":17874.552231789166,"y":18906.464826210155},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Execution Finished Event","name":"New Execution Finished Event","id":"1824fa00-dd30-4cdc-acc0-01c2f29056c5"}}},"executionFinishedEvent":{"type":"Execution Finished Event","name":"New Execution Finished Event","project":"Superalgos","id":"de9413Line truncated
@@ -68,7 +68,7 @@
},
{
"style": "Table",
"text": "| Variable Value | RGB Value | Color Sample |\n| DARK | 48, 48, 54 | RGB(48, 48, 54) |\n| LIGHT | 234, 226, 222 | RGB(234, 226, 222) |\n| GREY | 150, 150, 150 | RGB(150, 150, 150) |\n| LIGHT_GREY | 247, 247, 247 | RGB(247, 247, 247) |\n| WHITE | 255, 255, 255 | RGB(255, 255, 255) |\n| BLACK | 0, 0, 0 | RGB(0, 0, 0) |\n| GOLDEN_ORANGE | 240, 162, 2 | RGB(240, 162, 2) |\n| RUSTED_RED | 204, 88, 53 | RGB(204, 88, 53) |\n| GREEN | 188, 214, 67 | RGB(188, 214, 67) |\n| RED | 223, 70, 60 | RGB(223, 70, 60) |\n| PATINATED_TURQUOISE | 27, 153, 139 | RGB(27, 153, 139) |\n| TITANIUM_YELLOW | 244, 228, 9 | RGB(244, 228, 9) |\n| MANGANESE_PURPLE | 91,80, 122 | RGB(91,80, 122) |\n| TURQUOISE | 74, 207, 217 | RGB(74, 207, 217) |\n| DARK_TURQUOISE | 2, 149, 170 | RGB(2, 149, 170) |",
"text": "| Variable Value | RGB Value | Color Sample |\n| DARK | 48, 48, 54 | RGB(48, 48, 54) |\n| LIGHT | 234, 226, 222 | RGB(234, 226, 222) |\n| GREY | 150, 150, 150 | RGB(150, 150, 150) |\n| LIGHT_GREY | 247, 247, 247 | RGB(247, 247, 247) |\n| WHITE | 255, 255, 255 | RGB(255, 255, 255) |\n| BLACK | 0, 0, 0 | RGB(0, 0, 0) |\n| GOLDEN_ORANGE | 240, 162, 2 | RGB(240, 162, 2) |\n| RUSTED_RED | 204, 88, 53 | RGB(204, 88, 53) |\n| GREEN | 188, 214, 67 | RGB(188, 214, 67) |\n| RED | 223, 70, 60 | RGB(223, 70, 60) |\n| PATINATED_TURQUOISE | 27, 153, 139 | RGB(27, 153, 139) |\n| TITANIUM_YELLOW | 244, 228, 9 | RGB(244, 228, 9) |\n| MANGANESE_PURPLE | 91,80, 122 | RGB(91,80, 122) |\n| TURQUOISE | 74, 207, 217 | RGB(74, 207, 217) |\n| DARK_TURQUOISE | 2, 149, 170 | RGB(2, 149, 170) |\n| SILVER | 191, 192, 192 | RGB(191,192,192) |\n| TRUE_GREEN | 0, 225, 0 | RGB(0,255,0) |\n| TRUE_RED | 255, 0, 0 | RGB(255,0,0) |\n| TRUE_YELLOW | 255, 255, 0 | RGB(255,255,0) |\n| TRUE_BLUE | 0, 0, 255 | RGB(0,0,255) |\n| BROWN | 121, 58, 21 | RGB(121,58,21) |\n| TRUE_ORANGE | 255, 160, 10 | RGB(255,160,10) |\n| JUNGLE_GREEN | 50, 175, 162 | RGB(50,175,162) |\n| JUNGLE_LIGHT | 165, 223, 210 | RGB(165,223,210) |\n| LIGHT_PINK | 254, 180, 200 | RGB(254,180,200) |\n| NEON_GREEN | 15, 252, 31 | RGB(15,252,31) |\n| PINK | 255, 77, 78 | RGB(255,77,78) |\n| TENKAN_GREEN | 43, 117, 55 | RGB(43,117,55) |\n| TENKAN_ORANGE | 233, 100, 34 | RGB(233,100,34) |\n| SKY_BLUE | 133, 206, 255 | RGB(133,206,255) |\n| MDA_PURPLE | 126, 71, 255 | RGB(126,71,255) |\n| PERSIAN_GREEN | 27, 153, 139 | RGB(27,153,139) |\n| ORANGE_WEB | 252, 163, 17 | RGB(252,163,17) |\n| OXFORD_BLUE | 20, 33, 61 | RGB(20,33,61) |\n| BYZANTINE_PINK | 181, 23, 158 | RGB(181,23,158) |\n| TRUE_PURPLE | 114, 9, 183 | RGB(114,9,183) |\n| ULTRAMARINE_BLUE | 67, 97, 238 | RGB(67,97,238) |\n| OCEAN_GREEN | 116, 198, 157 | RGB(116,198,157) |\n| BOTTLE_GREEN | 45, 106, 79 | RGB(45,106,79) |\n| WINDSOR_TAN | 153, 88, 42 | RGB(153,88,42) |\n| PERSIAN_PLUM | 111, 29, 27 | RGB(111,29,27) |\n| APPLE_GREEN | 128, 185, 24 | RGB(128,185,24) |\n| MIDNIGHT_GREEN | 6, 90, 96 | RGB(6,90,96) |\n| RED_ORANGE | 255, 72, 0 | RGB(255,72,0) |\n| CARIBBEAN_GREEN | 59, 206, 172 | RGB(59,206,172) |\n| CAMEL_TAN | 187, 148, 87 | RGB(187,148,87) |\n| CYBER_GRAPE | 98, 84, 160 | RGB(98,84,160) |",
"updated": 1609854356242
},
{
@@ -80,4 +80,4 @@
"text": "lineDash is used to turn the border into a dashed-line; the first value corresponds to the length of the dash while the second value defines the length of the space."
}
]
}
}
@@ -1,5 +1,4 @@
exports.newSuperalgosBotModulesHistoricOHLCVs = function (processIndex) {
exports.newSuperalgosBotModulesHistoricOHLCVs = function (processIndex) {
const MODULE_NAME = "Historic OHLCVs";
const CANDLES_FOLDER_NAME = "Candles/One-Min";
@@ -57,8 +56,8 @@ exports.newSuperalgosBotModulesHistoricOHLCVs = function (processIndex) {
maxTradesPerFetch - this is set to a number that indicates the maximum number of trades the exchange will return in
the fetchTrades method (e.g. for the Luno exchange, this number is 100).
*/
let useFetchTradesForFetchOHLCVs = false
let maxTradesPerFetch = 100
let useFetchTradesForFetchOHLCVs = false
let maxTradesPerFetch = 100
return thisObject;
@@ -94,15 +93,15 @@ exports.newSuperalgosBotModulesHistoricOHLCVs = function (processIndex) {
if (API.rateLimit !== undefined) {
rateLimit = API.rateLimit
}
if (API.limit !== undefined) {
limit = API.limit
}
if (API.hostname !== undefined) {
hostname = API.hostname
}
if (API.fetchType !== undefined) {
fetchType = API.fetchType
}
if (API.limit !== undefined) {
limit = API.limit
}
if (API.useFetchTradesForFetchOHLCVs !== undefined) {
useFetchTradesForFetchOHLCVs = API.useFetchTradesForFetchOHLCVs
if (API.maxTradesPerFetch !== undefined) {
@@ -200,6 +199,11 @@ exports.newSuperalgosBotModulesHistoricOHLCVs = function (processIndex) {
return;
}
/* Check if the uiStartDate is Invalid, if so lets set it to the Epoch and let the getMarketStart function later take care of it */
if(isNaN(uiStartDate)) {
uiStartDate = new Date(0)
}
thisReport = statusDependencies.statusReports.get(reportKey)
if (thisReport.file.beginingOfMarket !== undefined) { // This means this is not the first time this process has run.
@@ -294,7 +298,7 @@ exports.newSuperalgosBotModulesHistoricOHLCVs = function (processIndex) {
}
}
}
}
}
} catch (err) {
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).UNEXPECTED_ERROR = err
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
@@ -345,9 +349,12 @@ exports.newSuperalgosBotModulesHistoricOHLCVs = function (processIndex) {
let previousSince
let fromDate = new Date(since)
let lastDate = new Date()
let changeToMarketStart = false
while (true) {
let invalidSince = false
/* Reporting we are doing well */
function heartBeat(noNewInternalLoop) {
let processingDate = new Date(since)
@@ -365,8 +372,6 @@ exports.newSuperalgosBotModulesHistoricOHLCVs = function (processIndex) {
}
}
heartBeat()
/* Defining if we will query the exchange by Date or Id */
if (fetchType === "by Id") {
/*
@@ -377,11 +382,120 @@ exports.newSuperalgosBotModulesHistoricOHLCVs = function (processIndex) {
since = lastId
}
/*
If this is the first time the process has run, check if to see if the start date the user
has entered is before the start of the Market on the Exchange. If this is the case, jump
forward to the start date of the Market.
*/
if(firstTimeThisProcessRun && changeToMarketStart === false && useFetchTradesForFetchOHLCVs === false) {
let marketStartSince
marketStartSince = await findMarketStart()
if (initialProcessTimestamp < marketStartSince) {
since = marketStartSince
fromDate = new Date(since)
changeToMarketStart = true
}
}
heartBeat()
/* Fetching the OHLCVs from the exchange.*/
await new Promise(resolve => setTimeout(resolve, rateLimit)) // rate limit
const OHLCVs = useFetchTradesForFetchOHLCVs ?
await fetchTradesForOHLCV(symbol, '1m', since, limit, params) :
await exchange.fetchOHLCV(symbol, '1m', since, limit, params)
await fetchTradesForOHLCV(symbol, '1m', since, limit, params) :
await exchange.fetchOHLCV(symbol, '1m', since, limit, params)
if (OHLCVs.length === 0) {
/*
If OHLCVs is empty we might be dealing with extended maintenance longer than our OHLCV limit.
If this is the case jump forward to the next valid OHLCV record.
*/
since = await findNextValidOHLCV()
}
/*
CCXT for certain Exchanges will return an empty or partial array if the since date is too
far in the past if this occurs this function will recursively step backwards in the Exchange
and Market in 1D intervals until it finds the earliest date with values.
*/
async function findMarketStart() {
let earliestMarketSince = undefined
let foundDate = false
let searchSize = limit
let previousMarketSince = undefined
while (foundDate !== true) {
await new Promise(resolve => setTimeout(resolve, rateLimit)) // rate limit
const earlyOHLCVs = useFetchTradesForFetchOHLCVs ?
await fetchTradesForOHLCV(symbol, '1d', earliestMarketSince, searchSize, params) :
await exchange.fetchOHLCV(symbol, '1d', earliestMarketSince, searchSize, params)
if (earlyOHLCVs.length === searchSize && previousMarketSince !== earlyOHLCVs[0][0]) { // If array is full, and the date returned isn't the same then we are still working in valid data, search further back
earliestMarketSince = (earlyOHLCVs[0][0] - (TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS * searchSize))
previousMarketSince = earlyOHLCVs[0][0]
} else if (earlyOHLCVs.length === searchSize && previousMarketSince === earlyOHLCVs[0][0]) { // If array is full, but the first OHLCV date is the same as last time then we've found our Market Start
foundDate = true
invalidSince = true
return earlyOHLCVs[0][0]
} else if (earlyOHLCVs.length < searchSize && earlyOHLCVs.length > 0) { // If the array is partially filled then, take the earliest data and we've found our Market Start
foundDate = true
invalidSince = true
return earlyOHLCVs[0][0]
} else if ((earlyOHLCVs.length === 0 && searchSize !== 1)) { // If array is empty, we've gone too far, half the search size and retry
earliestMarketSince = (earliestMarketSince + (TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS * searchSize))
if (searchSize > 1) {
searchSize = Math.floor(searchSize / 2)
}
} else { // Otherwise, the array is empty and we're at the lowest searchSize then we've found our Market Start
foundDate = true
invalidSince = true
return earliestMarketSince
}
let processingDate = new Date(earliestMarketSince)
processingDate = processingDate.getUTCFullYear() + '-' + TS.projects.superalgos.utilities.miscellaneousFunctions.pad(processingDate.getUTCMonth() + 1, 2) + '-' + TS.projects.superalgos.utilities.miscellaneousFunctions.pad(processingDate.getUTCDate(), 2);
TS.projects.superalgos.functionLibraries.processFunctions.processHeartBeat(processIndex, "Invalid or No Start Date. Finding Market Start @ " + processingDate, 0)
}
}
/*
CCXT will return an empty array if there are no OHLCVs for the limit.
This can happen when the Exchange has extended maintenance i.e. over
1,000 minutes (example see Binance on 2018-02-08). This function will
return the next valid returned OHLCV.
*/
async function findNextValidOHLCV() {
let foundDate = false
while (foundDate !== true) {
await new Promise(resolve => setTimeout(resolve, rateLimit)) // rate limit
const nextValidOHLCVs = useFetchTradesForFetchOHLCVs ?
await fetchTradesForOHLCV(symbol, '1m', since, limit, params) :
await exchange.fetchOHLCV(symbol, '1m', since, limit, params)
if (nextValidOHLCVs.length === 0) {
since = (since + (TS.projects.superalgos.globals.timeConstants.ONE_MIN_IN_MILISECONDS * limit))
} else {
foundDate = true
invalidSince = true
return nextValidOHLCVs[0][0]
}
}
}
/*
OHLCV Structure
@@ -418,16 +532,13 @@ exports.newSuperalgosBotModulesHistoricOHLCVs = function (processIndex) {
fromDate = new Date(beginingOfMarket.valueOf())
firstTimeThisProcessRun = false
}
}
if (OHLCVs.length > 1) {
previousSince = since
since = OHLCVs[OHLCVs.length - 1][0] // 'timestamp'
if (since === previousSince) {
since++ // this prevents requesting in a loop OHLCVs with the same timestamp, that can happen when all the records fetched come with exactly the same timestamp.
}
lastId = OHLCVs[OHLCVs.length - 1]['id']
for (let i = 0; i < OHLCVs.length; i++) {
@@ -444,8 +555,19 @@ exports.newSuperalgosBotModulesHistoricOHLCVs = function (processIndex) {
heartBeat(true)
}
let currentDate = new Date(since)
/*
If we've pulled less OHLCVs than the limit, this either means:
(1) we reached the current date and are now pulling the latest
(2) there was exchange maintenance on the date being processed
(3) we've found zero records as the start date was way in the past
If (1) is the case, or if we're stopping the task or have hit the max
limit. then break and stop till the next loop.
*/
if (
OHLCVs.length < limit - 1 ||
(OHLCVs.length < limit - 1 && invalidSince === false && TS.projects.superalgos.utilities.dateTimeFunctions.areTheseDatesEqual(currentDate, new Date())) ||
TS.projects.superalgos.globals.taskVariables.IS_TASK_STOPPING === true ||
rawDataArray.length >= MAX_OHLCVs_PER_EXECUTION
) {
@@ -868,7 +990,7 @@ exports.newSuperalgosBotModulesHistoricOHLCVs = function (processIndex) {
if (dataLength > 0) {
// first get the start of the day after this day we are checking
let timestamp = (day * TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS) +
TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS
TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS
if (rawDataArray[dataLength - 1][0] < timestamp) {
// there is no data for the next day, so now trim this day's data to remove anything before it
timestamp -= TS.projects.superalgos.globals.timeConstants.ONE_DAY_IN_MILISECONDS
+20 -6
View File
@@ -218,22 +218,36 @@ Once the app finishes loading, an interactive tutorial takes you by the hand and
# Docker Deployments
Docker container images can be found at https://github.com/users/Superalgos/packages/container/package/superalgos
If you wish to run Superalgos over docker platform, follow these steps.
## 1. Install Docker
Follow the link to [install docker](https://docs.docker.com/engine/install/).
## 2. Login and Run
## 2. Run
You will need to create local storage directories beforehand, by example with `mkdir Data-Storage Log-Files My-Workspaces`
```
docker login ghcr.io --username your-github-username --password-stdin
```
```
docker run -p 18041:18041 -p 34248 superalgos/superalgos
docker run \
-d \
--rm \
--name superalgos \
-p 18041:18041 \
-p 34248:34248 \
-v $(pwd)/Data-Storage:/app/Data-Storage \
-v $(pwd)/Log-Files:/app/Log-Files \
-v $(pwd)/My-Workspaces:/app/My-Workspaces \
ghcr.io/superalgos/superalgos:latest
```
Now you can access to the Superalgos UI.
Now you can access to the Superalgos UI at http://127.0.0.1:34248
To see console logs you can use `docker logs superalgos -f`
When you're done just exec `docker kill superalgos`
**Note:** This has not been extensively tested yet. If you run into troubles, please contact us at the [Superalgos Support Group](https://t.me/superalgossupport).
+36 -4
View File
@@ -1,12 +1,12 @@
let canvas
let PROJECTS_ARRAY
let canvas
let PROJECTS_ARRAY
let PROJECTS_SCHEMA
let SCHEMAS_BY_PROJECT = new Map()
/* New Root object*/
let UI = {
projects: {}
}
}
/* User Interface Colors */
const UI_COLOR = {
@@ -24,7 +24,39 @@ const UI_COLOR = {
TITANIUM_YELLOW: "244,228,9",
MANGANESE_PURPLE: "91,80,122",
TURQUOISE: "74,207,217",
DARK_TURQUOISE: "2,149,170"
DARK_TURQUOISE: "2,149,170",
ORANGE_WEB: "252,163,17",
OXFORD_BLUE: "20,33,61",
BYZANTINE_PINK: "181,23,158",
TRUE_PURPLE: "114,9,183",
ULTRAMARINE_BLUE: "67,97,238",
OCEAN_GREEN: "116,198,157",
BOTTLE_GREEN: "45,106,79",
WINDSOR_TAN: "153,88,42",
CAMEL_TAN: "187,148,87",
PERSIAN_PLUM: "111,29,27",
APPLE_GREEN: "128,185,24",
MIDNIGHT_GREEN: "6,90,96",
RED_ORANGE: "255,72,0",
CARIBBEAN_GREEN: "59,206,172",
SILVER: "191,192,192",
NEON_GREEN: "15,252,31",
PINK: "255,77,78",
TENKAN_GREEN: "43,117,55",
TENKAN_ORANGE: "233,100,34",
SKY_BLUE: "133,206,255",
MDA_PURPLE: "126,71,255",
PERSIAN_GREEN: "27,153,139",
CYBER_GRAPE: "98,84,160",
TRUE_GREEN: "0,225,0",
TRUE_RED: "255,0,0",
TRUE_YELLOW: "255,255,0",
TRUE_BLUE: "0,0,255",
BROWN: "121,58,21",
JUNGLE_GREEN: "50,175,162",
LIGHT_PINK: "254,180,200",
JUNGLE_LIGHT: "165,223,210",
TRUE_ORANGE: "255,160,10"
};
/* User Interface Fonts */