Adding support for multiple bot execution

This commit is contained in:
mati108@gmail.com committed 2019-02-06 17:03:36 -03:00
1 parent 709a6cb770
commit 2cda4ad606
14 files changed
+74 -81

No files matched your search

+1
View File
@@ -29,5 +29,6 @@ export const clone = gql`
botName
botAvatar
teamAvatar
processName
}
`;
+13 -16
View File
@@ -1,21 +1,18 @@
const types = [ 'Live', 'Competition', 'Backtest' ]
const availableMonths = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"]
const startModes = [
{
name: 'All Months',
value: 'allMonths'
},
{
name: 'One Month',
value: 'oneMonth'
},
{
name: 'No Time',
value: 'noTime'
}
]
const tradingStartModes ={
live: "Live",
competition: "Competition",
backtest: "Backtest"
}
const indicatorStartModes = {
allMonths: "All Months",
oneMonth: "One Month",
noTime: "No Time"
}
const exchanges = [
{
id: '1',
@@ -25,4 +22,4 @@ const exchanges = [
export { types, exchanges, startModes, availableMonths }
export { tradingStartModes, exchanges, indicatorStartModes, availableMonths }
+11 -8
View File
@@ -9,7 +9,7 @@ import { withStyles } from '@material-ui/core/styles'
import classNames from 'classnames'
import styles from './styles'
import { types, startModes, availableMonths, processNames } from '../../../GraphQL/models'
import { tradingStartModes, indicatorStartModes, availableMonths, processNames } from '../../../GraphQL/models'
import { isDefined, getIndicatorYears } from '../../../utils'
import {
@@ -176,9 +176,9 @@ class AddClone extends Component {
error={this.state.modeError}
fullWidth
>
{types.map(option => (
{Object.keys(tradingStartModes).map(option => (
<MenuItem key={option} value={option}>
{option}
{tradingStartModes[option]}
</MenuItem>
))}
</TextField>
@@ -290,9 +290,9 @@ class AddClone extends Component {
error={this.state.modeError}
fullWidth
>
{startModes.map(option => (
<MenuItem key={option.value} value={option.value}>
{option.name}
{Object.keys(indicatorStartModes).map(option => (
<MenuItem key={option} value={option}>
{indicatorStartModes[option]}
</MenuItem>
))}
</TextField>
@@ -449,7 +449,6 @@ class AddClone extends Component {
botId: this.state.selectedBot.id,
mode: this.state.mode,
resumeExecution: this.state.resumeExecution,
runAsTeam: this.state.runAsTeam,
botType: this.getBotTypeFromKind(this.state.selectedBot.kind)
}
}
@@ -460,11 +459,15 @@ class AddClone extends Component {
variables.clone.waitTime = this.state.waitTime
}
if(this.state.selectedBot.kind !== "TRADER"){
if(this.state.selectedBot.kind === "TRADER"){
variables.clone.runAsTeam = this.state.runAsTeam
variables.clone.processName = 'Trading-Process'
} else {
variables.clone.processName = this.state.processName
variables.clone.startYear = this.state.startYear
variables.clone.endYear = this.state.endYear
variables.clone.month = this.state.month
variables.clone.runAsTeam = true
}
return this.props.addCloneMutation({
+4 -1
View File
@@ -14,6 +14,7 @@ import {
import Avatar from '@material-ui/core/Avatar';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { tradingStartModes, indicatorStartModes } from '../../../GraphQL/models'
import { isDefined, toLocalTime } from '../../../utils'
import classNames from 'classnames'
import { withStyles } from '@material-ui/core/styles'
@@ -45,7 +46,9 @@ class ListClones extends Component {
<Typography className={classes.heading}>{clone.botName}</Typography>
</div>
<div className={classes.heading}>
<Typography className={classes.heading}>{clone.mode}</Typography>
<Typography className={classes.heading}>
{ clone.processName } / { clone.botType === 'TRADER' ? tradingStartModes[clone.mode] : indicatorStartModes[clone.mode] }
</Typography>
</div>
</ExpansionPanelSummary>
<Divider />