diff --git a/src/schema/types/input/SubStrategy.js b/src/schema/types/input/SubStrategy.js index 80269ea42..de29669a8 100644 --- a/src/schema/types/input/SubStrategy.js +++ b/src/schema/types/input/SubStrategy.js @@ -1,37 +1,29 @@ import { GraphQLString, GraphQLInputObjectType, - GraphQLList, } from 'graphql'; -import InputSituationType from './Situation'; -import InputPhaseType from './Phase'; +import { + EntryPointInputType, + ExitPointInputType, + SellPointInputType, + BuyPointInputType, + StopLossInputType, + BuyOrderInputType, + SellOrderInputType, +} from './TheSevenMonolitics'; const Type = new GraphQLInputObjectType({ name: 'SubStrategyInput', description: 'Payload for subStrategy input', fields: () => ({ name: { type: GraphQLString }, - entryPoint: { - situations: { type: new GraphQLList(InputSituationType) }, - }, - exitPoint: { - situations: { type: new GraphQLList(InputSituationType) }, - }, - sellPoint: { - situations: { type: new GraphQLList(InputSituationType) }, - }, - buyPoint: { - situations: { type: new GraphQLList(InputSituationType) }, - }, - stopLoss: { - phases: { type: new GraphQLList(InputPhaseType) }, - }, - buyOrder: { - phases: { type: new GraphQLList(InputPhaseType) }, - }, - sellOrder: { - phases: { type: new GraphQLList(InputPhaseType) }, - }, + entryPoint: { type: EntryPointInputType }, + exitPoint: { type: ExitPointInputType }, + sellPoint: { type: SellPointInputType }, + buyPoint: { type: BuyPointInputType }, + stopLoss: { type: StopLossInputType }, + buyOrder: { type: BuyOrderInputType }, + sellOrder: { type: SellOrderInputType }, }), }); diff --git a/src/schema/types/input/TheSevenMonolitics.js b/src/schema/types/input/TheSevenMonolitics.js new file mode 100644 index 000000000..bc1c7929a --- /dev/null +++ b/src/schema/types/input/TheSevenMonolitics.js @@ -0,0 +1,76 @@ +import { + GraphQLInputObjectType, + GraphQLList, +} from 'graphql'; +import InputSituationType from './Situation'; +import InputPhaseType from './Phase'; + +// SituationBased + +const EntryPointInputType = new GraphQLInputObjectType({ + name: 'EntryPointInput', + description: 'Payload for entryPoint input', + fields: () => ({ + situations: { type: new GraphQLList(InputSituationType) }, + }), +}); + +const ExitPointInputType = new GraphQLInputObjectType({ + name: 'ExitPointInput', + description: 'Payload for exitPoint input', + fields: () => ({ + situations: { type: new GraphQLList(InputSituationType) }, + }), +}); + +const SellPointInputType = new GraphQLInputObjectType({ + name: 'SellPointInput', + description: 'Payload for sellPoint input', + fields: () => ({ + situations: { type: new GraphQLList(InputSituationType) }, + }), +}); + +const BuyPointInputType = new GraphQLInputObjectType({ + name: 'BuyPointInput', + description: 'Payload for buyPoint input', + fields: () => ({ + situations: { type: new GraphQLList(InputSituationType) }, + }), +}); + +// PhaseBased + +const StopLossInputType = new GraphQLInputObjectType({ + name: 'StopLossTypeInput', + description: 'Payload for stopLossType input', + fields: () => ({ + situations: { type: new GraphQLList(InputPhaseType) }, + }), +}); + +const BuyOrderInputType = new GraphQLInputObjectType({ + name: 'BuyOrderTypeInput', + description: 'Payload for buyOrderType input', + fields: () => ({ + situations: { type: new GraphQLList(InputPhaseType) }, + }), +}); + +const SellOrderInputType = new GraphQLInputObjectType({ + name: 'SellOrderTypeInput', + description: 'Payload for sellOrderType input', + fields: () => ({ + situations: { type: new GraphQLList(InputPhaseType) }, + }), +}); + +export { + EntryPointInputType, + ExitPointInputType, + SellPointInputType, + BuyPointInputType, + StopLossInputType, + BuyOrderInputType, + SellOrderInputType, +}; diff --git a/src/schema/types/input/index.js b/src/schema/types/input/index.js index c00687bd6..8472b9cfd 100644 --- a/src/schema/types/input/index.js +++ b/src/schema/types/input/index.js @@ -3,6 +3,15 @@ import SubStrategyInputType from './SubStrategy'; import ConditionInputType from './Condition'; import SituationInputType from './Situation'; import PhaseInputType from './Phase'; +import { + EntryPointInputType, + ExitPointInputType, + SellPointInputType, + BuyPointInputType, + StopLossInputType, + BuyOrderInputType, + SellOrderInputType, +} from './TheSevenMonolitics'; export { StrategyInputType, @@ -10,4 +19,11 @@ export { ConditionInputType, SituationInputType, PhaseInputType, + EntryPointInputType, + ExitPointInputType, + SellPointInputType, + BuyPointInputType, + StopLossInputType, + BuyOrderInputType, + SellOrderInputType, };