Merge remote-tracking branch 'Superalgos/develop'
This commit is contained in:
commit
68e2eecf32
7 files changed
+2101
-1
No files matched your search
+10
@@ -1,2 +1,12 @@
|
||||
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||
.scannerwork
|
||||
|
||||
\.env
|
||||
|
||||
\.nyc_output/
|
||||
|
||||
coverage/
|
||||
|
||||
node_modules/**
|
||||
|
||||
test/activeCloneList\.js
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@superalgos/operations-client",
|
||||
"version": "0.0.27",
|
||||
"version": "0.0.28",
|
||||
"description": "Superalgos Operations client-side web app",
|
||||
"main": "src/index.js",
|
||||
"dependencies": {
|
||||
|
||||
@@ -38,6 +38,7 @@ const sensorProcessNames = {
|
||||
}
|
||||
|
||||
const indicatorProcessNames = {
|
||||
Single: 'Single-Period-Daily',
|
||||
Daily: 'Multi-Period-Daily',
|
||||
Market: 'Multi-Period-Market'
|
||||
}
|
||||
|
||||
Generated
+1903
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "operations-test",
|
||||
"version": "1.0.0",
|
||||
"description": "Superalgos Operations backend API",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"test": "./node_modules/.bin/mocha --reporter spec"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"axios": "0.18.0",
|
||||
"chai": "^4.2.0",
|
||||
"dotenv": "^7.0.0",
|
||||
"mocha": "^6.0.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
NODE_ENV=production
|
||||
|
||||
VIRTUAL_HOST=VIRTUAL_HOST
|
||||
LETSENCRYPT_HOST=LETSENCRYPT_HOST
|
||||
LETSENCRYPT_EMAIL=LETSENCRYPT_EMAIL
|
||||
VIRTUAL_PORT=4003
|
||||
|
||||
PORT=4003
|
||||
|
||||
DB_USERNAME=DB_USERNAME
|
||||
DB_PASSWORD=DB_PASSWORD
|
||||
DB_DOMAIN=DB_DOMAIN
|
||||
|
||||
GATEWAY_ENDPOINT=GATEWAY_ENDPOINT
|
||||
OPERATIONS_API_PRESHARED=OPERATIONS_API_PRESHARED
|
||||
|
||||
# Clone Executor Integration
|
||||
PLATFORM_ENVIRONMENT=PLATFORM_ENVIRONMENT
|
||||
STORAGE_BASE_URL=STORAGE_BASE_URL
|
||||
STORAGE_CONNECTION_STRING=STORAGE_CONNECTION_STRING
|
||||
|
||||
# Auth Config
|
||||
AUTH_URL=AUTH_URL
|
||||
AUTH_CLIENT_ID=AUTH_CLIENT_ID
|
||||
AUTH_CLIENT_SECRET=AUTH_CLIENT_SECRET
|
||||
AUTH_AUDIENCE=AUTH_AUDIENCE
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
var assert = require('chai').assert
|
||||
const axios = require('axios')
|
||||
const { activeCloneList } = require('./activeCloneList')
|
||||
require('dotenv').config()
|
||||
|
||||
describe('Admin clones Clones', function () {
|
||||
it('Remove clones', async function () {
|
||||
this.timeout(300000)
|
||||
var error
|
||||
try {
|
||||
var clones = await getClones()
|
||||
for (let clone of clones) {
|
||||
await removeClone(clone.id, clone.botName)
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('Error: ' + err)
|
||||
error = err
|
||||
}
|
||||
assert.equal(error, undefined)
|
||||
})
|
||||
it('Add COSS Live Indicator Clones', async function () {
|
||||
this.timeout(300000)
|
||||
var error
|
||||
var clones = activeCloneList("Coss")
|
||||
try {
|
||||
for (let clone of clones) {
|
||||
await removeClone(clone.id, clone.botName)
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('Error: ' + err)
|
||||
error = err
|
||||
}
|
||||
assert.equal(error, undefined)
|
||||
})
|
||||
it('Add POLONIEX Live Indicator Clones', async function () {
|
||||
this.timeout(300000)
|
||||
var error
|
||||
var clones = activeCloneList("Poloniex")
|
||||
try {
|
||||
for (let clone of clones) {
|
||||
await removeClone(clone.id, clone.botName)
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('Error: ' + err)
|
||||
error = err
|
||||
}
|
||||
assert.equal(error, undefined)
|
||||
})
|
||||
})
|
||||
|
||||
async function getClones() {
|
||||
try {
|
||||
const clones = await axios({
|
||||
url: process.env.GATEWAY_ENDPOINT,
|
||||
method: 'post',
|
||||
data: {
|
||||
query: `
|
||||
query {
|
||||
operations_Clones(queryLogs: false) {
|
||||
id
|
||||
botName
|
||||
}
|
||||
}
|
||||
`,
|
||||
},
|
||||
headers: {
|
||||
authorization: 'Bearer ' + process.env.ACCESS_TOKEN
|
||||
}
|
||||
})
|
||||
|
||||
console.log('getClones ok ')
|
||||
return clones.data.data.operations_Clones
|
||||
} catch (error) {
|
||||
console.log('getClones error: ' + error.response.data.errors[0])
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
async function removeClone(cloneId, botName) {
|
||||
try {
|
||||
await axios({
|
||||
url: process.env.GATEWAY_ENDPOINT,
|
||||
method: 'post',
|
||||
data: {
|
||||
query: `
|
||||
mutation ($id: ID!){
|
||||
operations_RemoveClone(
|
||||
id: $id
|
||||
)
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
id: cloneId
|
||||
},
|
||||
},
|
||||
headers: {
|
||||
authorization: 'Bearer ' + process.env.ACCESS_TOKEN
|
||||
}
|
||||
})
|
||||
|
||||
console.log('removeClone ok: ' + botName)
|
||||
return true
|
||||
} catch (error) {
|
||||
console.log('removeClone error: ' + error.response.data.errors[0])
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
async function createClone(clone) {
|
||||
try {
|
||||
const clones = await axios({
|
||||
url: process.env.GATEWAY_ENDPOINT,
|
||||
method: 'post',
|
||||
data: {
|
||||
query: `
|
||||
mutation ($clone: operations_CloneInput){
|
||||
operations_AddClone(
|
||||
clone: $clone
|
||||
) {
|
||||
id
|
||||
teamName
|
||||
botName
|
||||
processName
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
clone: clone
|
||||
},
|
||||
},
|
||||
headers: {
|
||||
authorization: 'Bearer ' + process.env.ACCESS_TOKEN
|
||||
}
|
||||
})
|
||||
|
||||
console.log('createClone id: ' + clones.data.data.operations_AddClone.id + ', botId: ' + clone.botId)
|
||||
return clones.data.data.operations_AddClone
|
||||
} catch (error) {
|
||||
console.log('createClone error: ' + error.response.data.errors[0])
|
||||
throw error
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user