Merge branch 'develop'

This commit is contained in:
Matias committed 2019-06-27 23:06:04 -03:00
commit dc69f69670
12 files changed
+46 -21

No files matched your search

+3 -1
View File
@@ -236,7 +236,8 @@ function newCanvas () {
try {
let point = {
x: event.pageX,
y: event.pageY - CURRENT_TOP_MARGIN
y: event.pageY - CURRENT_TOP_MARGIN,
button: event.button
}
dragVector.downX = point.x
@@ -706,3 +707,4 @@ function newCanvas () {
}
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ async function graphQlRestartSimulation (simulationParams) {
})
if (graphQLServer.data.errors) {
console.log(err.stack)
console.log(graphQLServer.data.errors)
throw new Error(graphQLServer.data.errors[0].message)
}
} catch (err) {
+5 -3
View File
@@ -113,7 +113,7 @@ function newRestartSimulation () {
thisObject.status = 'Restarting'
await graphQlRestartSimulation(simulationParams)
thisObject.status = 'Calculating'
counterTillNextState = 2000
counterTillNextState = 50
} else {
thisObject.status = 'Error'
counterTillNextState = 500
@@ -125,12 +125,13 @@ function newRestartSimulation () {
}
function turnOffProductCards () {
let productCardsToTurnOff = ['Trading-Simulation', 'Simulation-Conditions', 'Simulation-Strategies', 'Simulation-Trades']
for (let i = 0; i < canvas.panelsSpace.panels.length; i++) {
let panel = canvas.panelsSpace.panels[i]
if (panel.name === 'Products Panel') {
for (j = 0; j < panel.productCards.length; j++) {
let productCard = panel.productCards[j]
if (productCard.product.relatedToTradingEngine === true && productCard.status !== PRODUCT_CARD_STATUS.OFF) {
if (productCardsToTurnOff.includes(productCard.product.codeName) && productCard.status !== PRODUCT_CARD_STATUS.OFF) {
productCard.turnOff()
productCardsToTurnOn.push(productCard)
}
@@ -165,7 +166,7 @@ function newRestartSimulation () {
case 'Calculating':
thisObject.status = 'Refreshing'
turnOffProductCards()
counterTillNextState = 250
counterTillNextState = 10
break
case 'Refreshing':
thisObject.status = 'Ready'
@@ -276,3 +277,4 @@ function newRestartSimulation () {
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y)
}
}
+1 -1
View File
@@ -153,7 +153,7 @@ function newDashboard () {
})
.then(response => {
teams = response.data.teams_Teams
window.localStorage.setItem('Teams', JSON.stringify(response.data.teams_Teams))
//window.localStorage.setItem('Teams', JSON.stringify(response.data.teams_Teams))
resolve({ teams: response.data.teams_Teams })
})
.catch(err => {
+1 -1
View File
@@ -114,7 +114,7 @@ function newCircularMenu () {
function onNotFocus () {
for (let i = 0; i < menuItems.length; i++) {
let menutItem = menuItems[i]
menutItem.targetRadius = menutItem.rawRadius * 0 - i * 5
menutItem.targetRadius = menutItem.rawRadius * 0 - i * 4
menutItem.isDeployed = false
}
thisObject.isDeployed = false
+1 -1
View File
@@ -106,7 +106,7 @@ function newCircularMenuItem () {
function physics () {
if (thisObject.dontShowAtFullscreen === true && CURRENT_TOP_MARGIN === 0) { return }
const INCREASE_STEP = 1
const INCREASE_STEP = 2
if (Math.abs(thisObject.currentRadius - thisObject.targetRadius) >= INCREASE_STEP) {
if (thisObject.currentRadius < thisObject.targetRadius) {
+9
View File
@@ -79,6 +79,7 @@ function newStrategyPart () {
let errorMessage = ''
let formulaValue = 0
let detachingEnabled = false
return thisObject
@@ -373,6 +374,7 @@ function newStrategyPart () {
function detachingPhysics () {
if (isDragging !== true) { return }
if (thisObject.isFrozen === true) { return }
if (detachingEnabled === false) { return }
let distanceToChainParent = Math.sqrt(Math.pow(thisObject.payload.position.x - thisObject.payload.targetPosition.x, 2) + Math.pow(thisObject.payload.position.y - thisObject.payload.targetPosition.y, 2))
let ratio = distanceToChainParent / previousDistance
@@ -495,11 +497,18 @@ function newStrategyPart () {
thisObject.codeEditor.deactivate()
}
isDragging = true
if (event.button === 2) {
detachingEnabled = true
} else {
detachingEnabled = false
}
}
function onDragFinished (event) {
if (isAttaching === true) {
canvas.strategySpace.workspace.attachNode(thisObject.payload.node, attachToNode)
attachToNode = undefined
isAttaching = false
}
isDragging = false
}
+3 -3
View File
@@ -223,7 +223,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Parameters',
actionFunction: payload.onMenuItemClick,
label: 'Delete Trading System',
label: 'Delete Parameters',
visible: false,
iconPathOn: 'trash',
iconPathOff: 'trash',
@@ -1596,7 +1596,7 @@ function newStrategyPartConstructor () {
}
function setFloatingObjectBasicProperties (floatingObject, payload) {
const FRICTION = 0.94
const FRICTION = 0.95
const INITIAL_FRICTION = 0.99
switch (payload.node.type) {
@@ -1730,7 +1730,7 @@ function newStrategyPartConstructor () {
floatingObject.targetFriction = FRICTION
floatingObject.friction = INITIAL_FRICTION
floatingObject.initializeMass(20)
floatingObject.initializeMass(50)
floatingObject.initializeRadius(35)
floatingObject.initializeImageSize(60)
floatingObject.initializeFontSize(10)
+9 -8
View File
@@ -47,7 +47,7 @@ function newStrategizerGateway () {
}
user = JSON.parse(user)
let fbSlug = 'simulator' + '-' + user.alias
let fbSlug = 'simulator' + '-' + 'bot' + '-' + user.alias.replace('.','')
/* See if we need to update or create a new record at the strategizer */
@@ -86,8 +86,8 @@ function newStrategizerGateway () {
throw 'Error getting events: ' + JSON.stringify(response.data.errors)
} else {
canvas.strategySpace.workspace.idAtStrategizer = response.data.data.strategizer_CreateTradingSystem.id
}
} else {
}
} else {
const graphQLServer = await axios({
url: window.canvasApp.graphQL.masterAppApiUrl,
method: 'post',
@@ -112,7 +112,7 @@ function newStrategizerGateway () {
headers: {
authorization: 'Bearer ' + accessToken
}
})
})
}
return true
@@ -132,7 +132,7 @@ function newStrategizerGateway () {
}
user = JSON.parse(user)
let fbSlug = 'simulator' + '-' + 'bot' + '-' + user.alias
let fbSlug = 'simulator' + '-' + 'bot' + '-' + user.alias.replace('.','')
let response = await axios({
url: window.canvasApp.graphQL.masterAppApiUrl,
@@ -147,7 +147,8 @@ function newStrategizerGateway () {
data
}
}
`,␍
`,
variables: {
fbSlug: fbSlug
}
@@ -163,13 +164,13 @@ function newStrategizerGateway () {
} else {
logger.write('[ERROR] Error while getting Trading System from Strategizer: ' + JSON.stringify(response.data.errors))
return false
}
}
} else {
window.localStorage.setItem('userStrategies', JSON.stringify(response.data.data.strategizer_TradingSystemByFb.data))
thisObject.strategizerData = JSON.parse(JSON.stringify(response.data.data.strategizer_TradingSystemByFb.data))
canvas.strategySpace.workspace.idAtStrategizer = response.data.data.strategizer_TradingSystemByFb.id
return true
}
}
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] loadFromStrategyzer -> err = ' + err.stack) }
}
@@ -44,6 +44,10 @@ function newNodeDeleter () {
deleteStrategy(node.strategies[0], rootNodes)
}
if (node.parameters !== undefined) {
deleteParameters(node.parameters, rootNodes)
}
completeDeletion(node, rootNodes)
destroyPart(node)
cleanNode(node)
@@ -121,6 +125,9 @@ function newNodeDeleter () {
if (node.takePosition !== undefined) {
deleteEvent(node.takePosition, rootNodes)
}
if (node.positionSize !== undefined) {
deletePositionSize(node.positionSize, rootNodes)
}
destroyPart(node)
cleanNode(node)
}
@@ -504,6 +504,11 @@ function newPartsFromNodes () {
}
let phaseParent = parentNode
let m = phaseParent.phases.length
if (phaseParent.payload.parentNode !== undefined) {
if (phaseParent.payload.parentNode.type === 'Initial Definition' && m > 0) { return }
}
let phase = {
name: 'New Phase',
formula: {
+1 -2
View File
@@ -33,7 +33,7 @@ function newLogin() {
if (accessToken) {
await getEvents(accessToken, sharedStatus)
await getClones(accessToken)
// await getClones(accessToken)
}
thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick)
@@ -120,7 +120,6 @@ function newLogin() {
stateDatetime
createDatetime
lastLogs
runAsTeam
summaryDate
buyAverage
sellAverage