10 files changed
+388
-344
No files matched your search
@@ -58,6 +58,10 @@ const ecosystemSchema = new Schema({
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
cloneId: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
products: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
|
||||
@@ -7,7 +7,7 @@ import { getFileContentRemote } from '../../storage/providers/AzureStorage'
|
||||
export const args = { file: { type: FileInputType } }
|
||||
|
||||
const resolve = async (parent, { file }, context) => {
|
||||
logger.debug('getFileContent -> Entering Function: ' + file.filePath)
|
||||
logger.debug('getFileContent -> Entering Function: ' + file.container + '/' + file.filePath)
|
||||
|
||||
try {
|
||||
|
||||
@@ -22,6 +22,9 @@ const resolve = async (parent, { file }, context) => {
|
||||
return fileContent
|
||||
|
||||
} catch (err) {
|
||||
if(err.message === 'The specified key does not exist.')
|
||||
logger.warn('getFileContent -> Error: %s', err.message)
|
||||
else
|
||||
logger.error('getFileContent -> Error: %s', err.message)
|
||||
throw err
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { getFileContentRemote } from '../../storage/providers/AzureStorage'
|
||||
export const args = { file: { type: FileInputType } }
|
||||
|
||||
const resolve = async (parent, { file }, context) => {
|
||||
logger.debug('getPlotterCode -> Entering Function: ' + file.filePath)
|
||||
logger.debug('getPlotterCode -> Entering Function: ' + file.container + '/' + file.filePath)
|
||||
|
||||
try {
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ const BotType = new GraphQLObjectType({
|
||||
profilePicture: { type: GraphQLString },
|
||||
repo: { type: GraphQLString },
|
||||
configFile: { type: GraphQLString },
|
||||
cloneId: { type: GraphQLString },
|
||||
products: {
|
||||
type: new GraphQLList(ProductType),
|
||||
resolve(parent) {
|
||||
|
||||
@@ -11,7 +11,8 @@ const Type = new GraphQLInputObjectType({
|
||||
codeName: { type: new GraphQLNonNull(GraphQLString) },
|
||||
displayName: { type: new GraphQLNonNull(GraphQLString) },
|
||||
repo: { type: GraphQLString },
|
||||
configFile: { type: GraphQLString }
|
||||
configFile: { type: GraphQLString },
|
||||
cloneId: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -51,13 +51,13 @@
|
||||
let market = global.MARKET;
|
||||
let dataFile;
|
||||
|
||||
let recordsArray = [];
|
||||
let conditionsArray = [];
|
||||
let strategiesArray = [];
|
||||
let tradesArray = [];
|
||||
let recordsArray
|
||||
let conditionsArray
|
||||
let strategiesArray
|
||||
let tradesArray
|
||||
let lastObjectsArray
|
||||
|
||||
let tradingSystem = {};
|
||||
let lastObjectsArray = [];
|
||||
|
||||
commons.initializeData();
|
||||
|
||||
@@ -96,20 +96,23 @@
|
||||
}
|
||||
|
||||
commons.runSimulation(
|
||||
recordsArray,
|
||||
conditionsArray,
|
||||
strategiesArray,
|
||||
tradesArray,
|
||||
lastObjectsArray,
|
||||
timePeriod,
|
||||
currentDay,
|
||||
startDate,
|
||||
endDate,
|
||||
interExecutionMemory,
|
||||
writeFiles)
|
||||
writeFiles,
|
||||
callBackFunction)
|
||||
|
||||
function writeFiles(pTradingSystem, pRecordsArray, pConditionsArray, pStrategiesArray, pTradesArray, pLastObjectsArray) {
|
||||
|
||||
function writeFiles(pTradingSystem) {
|
||||
tradingSystem = pTradingSystem
|
||||
recordsArray = pRecordsArray
|
||||
conditionsArray = pConditionsArray
|
||||
strategiesArray = pStrategiesArray
|
||||
tradesArray = pTradesArray
|
||||
lastObjectsArray = pLastObjectsArray
|
||||
|
||||
writeRecordsFile()
|
||||
}
|
||||
|
||||
@@ -141,7 +144,7 @@
|
||||
record.balanceA + "," +
|
||||
record.balanceB + "," +
|
||||
record.profit + "," +
|
||||
record.lastProfit + "," +
|
||||
record.lastTradeProfitLoss + "," +
|
||||
record.stopLoss + "," +
|
||||
record.roundtrips + "," +
|
||||
record.hits + "," +
|
||||
@@ -152,7 +155,7 @@
|
||||
record.days + "," +
|
||||
record.anualizedRateOfReturn + "," +
|
||||
record.positionRate + "," +
|
||||
record.lastProfitPercent + "," +
|
||||
record.lastTradeROI + "," +
|
||||
record.strategy + "," +
|
||||
record.strategyStageNumber + "," +
|
||||
record.takeProfit + "," +
|
||||
@@ -161,11 +164,11 @@
|
||||
JSON.stringify(record.orderRecord) + "," +
|
||||
record.positionSize + "," +
|
||||
record.initialBalanceA + "," +
|
||||
record.minimunBalanceA + "," +
|
||||
record.maximunBalanceA + "," +
|
||||
record.minimumBalanceA + "," +
|
||||
record.maximumBalanceA + "," +
|
||||
record.initialBalanceB + "," +
|
||||
record.minimunBalanceB + "," +
|
||||
record.maximunBalanceB + "]";
|
||||
record.minimumBalanceB + "," +
|
||||
record.maximumBalanceB + "]";
|
||||
|
||||
if (separator === "") { separator = ","; }
|
||||
|
||||
@@ -401,12 +404,13 @@
|
||||
at the current date. */
|
||||
|
||||
if (record.end < currentDay.valueOf()) { continue; }
|
||||
if (record.stopRate === undefined) { record.stopRate = 0}
|
||||
|
||||
fileContent = fileContent + separator + '[' +
|
||||
record.begin + "," +
|
||||
record.end + "," +
|
||||
record.status + "," +
|
||||
record.lastProfitPercent + "," +
|
||||
record.lastTradeROI + "," +
|
||||
record.beginRate + "," +
|
||||
record.endRate + "," +
|
||||
record.exitType + "," +
|
||||
|
||||
@@ -49,11 +49,11 @@
|
||||
let market = global.MARKET;
|
||||
let dataFile;
|
||||
|
||||
let recordsArray = [];
|
||||
let conditionsArray = [];
|
||||
let strategiesArray = [];
|
||||
let tradesArray = [];
|
||||
let lastObjectsArray = [];
|
||||
let recordsArray
|
||||
let conditionsArray
|
||||
let strategiesArray
|
||||
let tradesArray
|
||||
let lastObjectsArray
|
||||
|
||||
let tradingSystem = {};
|
||||
let interExecutionMemory = {};
|
||||
@@ -96,20 +96,23 @@
|
||||
}
|
||||
|
||||
commons.runSimulation(
|
||||
recordsArray,
|
||||
conditionsArray,
|
||||
strategiesArray,
|
||||
tradesArray,
|
||||
lastObjectsArray,
|
||||
timePeriod,
|
||||
currentDay,
|
||||
startDate,
|
||||
endDate,
|
||||
interExecutionMemory,
|
||||
writeFiles)
|
||||
writeFiles,
|
||||
callBackFunction)
|
||||
|
||||
function writeFiles(pTradingSystem, pRecordsArray, pConditionsArray, pStrategiesArray, pTradesArray, pLastObjectsArray) {
|
||||
|
||||
function writeFiles(pTradingSystem) {
|
||||
tradingSystem = pTradingSystem
|
||||
recordsArray = pRecordsArray
|
||||
conditionsArray = pConditionsArray
|
||||
strategiesArray = pStrategiesArray
|
||||
tradesArray = pTradesArray
|
||||
lastObjectsArray = pLastObjectsArray
|
||||
|
||||
writeRecordsFile()
|
||||
}
|
||||
|
||||
@@ -137,7 +140,7 @@
|
||||
record.balanceA + "," +
|
||||
record.balanceB + "," +
|
||||
record.profit + "," +
|
||||
record.lastProfit + "," +
|
||||
record.lastTradeProfitLoss + "," +
|
||||
record.stopLoss + "," +
|
||||
record.roundtrips + "," +
|
||||
record.hits + "," +
|
||||
@@ -148,7 +151,7 @@
|
||||
record.days + "," +
|
||||
record.anualizedRateOfReturn + "," +
|
||||
record.positionRate + "," +
|
||||
record.lastProfitPercent + "," +
|
||||
record.lastTradeROI + "," +
|
||||
record.strategy + "," +
|
||||
record.strategyStageNumber + "," +
|
||||
record.takeProfit + "," +
|
||||
@@ -157,11 +160,11 @@
|
||||
JSON.stringify(record.orderRecord) + "," +
|
||||
record.positionSize + "," +
|
||||
record.initialBalanceA + "," +
|
||||
record.minimunBalanceA + "," +
|
||||
record.maximunBalanceA + "," +
|
||||
record.minimumBalanceA + "," +
|
||||
record.maximumBalanceA + "," +
|
||||
record.initialBalanceB + "," +
|
||||
record.minimunBalanceB + "," +
|
||||
record.maximunBalanceB + "]";
|
||||
record.minimumBalanceB + "," +
|
||||
record.maximumBalanceB + "]";
|
||||
|
||||
if (separator === "") { separator = ","; }
|
||||
|
||||
@@ -374,12 +377,13 @@
|
||||
for (let i = 0; i < tradesArray.length; i++) {
|
||||
|
||||
let record = tradesArray[i];
|
||||
if (record.stopRate === undefined) { record.stopRate = 0 }
|
||||
|
||||
fileContent = fileContent + separator + '[' +
|
||||
record.begin + "," +
|
||||
record.end + "," +
|
||||
record.status + "," +
|
||||
record.lastProfitPercent + "," +
|
||||
record.lastTradeROI + "," +
|
||||
record.beginRate + "," +
|
||||
record.endRate + "," +
|
||||
record.exitType + "," +
|
||||
@@ -440,3 +444,4 @@
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -264,8 +264,7 @@
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersTradingSimulation",
|
||||
"moduleName": "TradingSimulation"
|
||||
},
|
||||
"relatedToTradingEngine": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"codeName": "Simulation-Conditions",
|
||||
@@ -304,8 +303,7 @@
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersTradingSimulation",
|
||||
"moduleName": "Conditions"
|
||||
},
|
||||
"relatedToTradingEngine": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"codeName": "Simulation-Strategies",
|
||||
@@ -344,8 +342,7 @@
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersTradingSimulation",
|
||||
"moduleName": "Strategies"
|
||||
},
|
||||
"relatedToTradingEngine": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"codeName": "Simulation-Trades",
|
||||
@@ -384,8 +381,7 @@
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersTradingSimulation",
|
||||
"moduleName": "Trades"
|
||||
},
|
||||
"relatedToTradingEngine": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -573,7 +573,7 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS_MODULE) {
|
||||
async function getSignalsByCloneId(orderStatus) {
|
||||
try {
|
||||
const cockPit = await axios({
|
||||
url: process.env.GATEWAY_ENDPOINT,
|
||||
url: process.env.GATEWAY_ENDPOINT_K8S,
|
||||
method: 'post',
|
||||
data: {
|
||||
query: `
|
||||
@@ -594,7 +594,7 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS_MODULE) {
|
||||
},
|
||||
},
|
||||
headers: {
|
||||
authorization: 'Bearer ' + global.ACCESS_TOKEN
|
||||
authorization: process.env.AUTHORIZATION
|
||||
}
|
||||
})
|
||||
|
||||
@@ -610,7 +610,7 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS_MODULE) {
|
||||
async function updateSignal(signalId, message) {
|
||||
try {
|
||||
const cockPit = await axios({
|
||||
url: process.env.GATEWAY_ENDPOINT,
|
||||
url: process.env.GATEWAY_ENDPOINT_K8S,
|
||||
method: 'post',
|
||||
data: {
|
||||
query: `
|
||||
@@ -631,7 +631,7 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS_MODULE) {
|
||||
},
|
||||
},
|
||||
headers: {
|
||||
authorization: 'Bearer ' + global.ACCESS_TOKEN
|
||||
authorization: process.env.AUTHORIZATION
|
||||
}
|
||||
})
|
||||
|
||||
@@ -646,7 +646,7 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS_MODULE) {
|
||||
async function createSignal(message) {
|
||||
try {
|
||||
const cockPit = await axios({
|
||||
url: process.env.GATEWAY_ENDPOINT,
|
||||
url: process.env.GATEWAY_ENDPOINT_K8S,
|
||||
method: 'post',
|
||||
data: {
|
||||
query: `
|
||||
@@ -667,7 +667,7 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS_MODULE) {
|
||||
},
|
||||
},
|
||||
headers: {
|
||||
authorization: 'Bearer ' + global.ACCESS_TOKEN
|
||||
authorization: process.env.AUTHORIZATION
|
||||
}
|
||||
})
|
||||
|
||||
@@ -682,7 +682,7 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS_MODULE) {
|
||||
async function getAutopilot() {
|
||||
try {
|
||||
const cockPit = await axios({
|
||||
url: process.env.GATEWAY_ENDPOINT,
|
||||
url: process.env.GATEWAY_ENDPOINT_K8S,
|
||||
method: 'post',
|
||||
data: {
|
||||
query: `
|
||||
@@ -699,7 +699,7 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS_MODULE) {
|
||||
},
|
||||
},
|
||||
headers: {
|
||||
authorization: 'Bearer ' + global.ACCESS_TOKEN
|
||||
authorization: process.env.AUTHORIZATION
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user