Adding stable version
This commit is contained in:
1 parent
7f5b093de0
commit
2c588cba71
15 files changed
+1005
-67
No files matched your search
@@ -35,7 +35,7 @@ export const copyBot = async (storage, teamCodeName, botCodeName, botDisplayName
|
||||
await storage.writeFileContent(teamCodeName, newBotPath + '/Trading-Bot/User.Bot.js', code)
|
||||
|
||||
logger.debug('copyBot completed for bot %s', botCodeName)
|
||||
|
||||
return parsedConfig
|
||||
} catch (err) {
|
||||
logger.error('copyBot error for bot: %s. %s', botCodeName, err)
|
||||
throw err
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import logger from '../utils/logger'
|
||||
import { copyBot } from './CopyBot'
|
||||
import { copySimulator } from './CopySimulator'
|
||||
|
||||
export const copyBots = async (storage, team) => {
|
||||
try {
|
||||
logger.debug('copyBots started for team %s', team.codeName)
|
||||
let bots = []
|
||||
|
||||
let tradingBot = await copyBot(storage, team.codeName, team.bot.codeName, team.bot.displayName)
|
||||
bots.push(tradingBot)
|
||||
|
||||
let simulatorBot = await copySimulator(storage, team.codeName, team.bot.codeName, team.bot.displayName)
|
||||
bots.push(simulatorBot)
|
||||
|
||||
return bots
|
||||
|
||||
} catch (err) {
|
||||
logger.error('copyBots error for teamCodeName: %s, error: %s', team.bot.codeName, err.stack)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ export const copySimulator = async (storage, teamCodeName, botCodeName, botDispl
|
||||
await storage.writeFileContent(teamCodeName, newSimulatorPath + '/Multi-Period-Market/User.Bot.js', codeMarket)
|
||||
|
||||
logger.debug('copySimulator completed for bot %s', newBotCodeName)
|
||||
|
||||
return parsedConfig
|
||||
} catch (err) {
|
||||
logger.error('copySimulator error for bot: %s. %s', botCodeName, err)
|
||||
throw err
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
import logger from '../utils/logger'
|
||||
import { copyBot } from './CopyBot'
|
||||
import { copySimulator } from './CopySimulator'
|
||||
|
||||
export const createTeam = async (team) => {
|
||||
try {
|
||||
logger.debug('createTeam started for team %s', team.codeName)
|
||||
|
||||
let storage = require ('./providers/AzureStorage') // Default value
|
||||
if (process.env.STORAGE_PROVIDER === 'Minio') {
|
||||
storage = require ('./providers/MinioStorage')
|
||||
}
|
||||
|
||||
let containerName = team.codeName
|
||||
await storage.createContainer(containerName)
|
||||
let accessKey = storage.createPrivateAccessKey(containerName, "WRITE", 365)
|
||||
|
||||
await copyBot(storage, team.codeName, team.bot.codeName, team.bot.displayName)
|
||||
await copySimulator(storage, team.codeName, team.bot.codeName, team.bot.displayName)
|
||||
|
||||
return accessKey
|
||||
|
||||
} catch (err) {
|
||||
logger.error('createTeam error for teamCodeName: %s, error: %s', team.bot.codeName, err.stack)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user