From 5c127fb8774d531d74205ff52b81b313326d1bcf Mon Sep 17 00:00:00 2001 From: Aaron Imming Date: Mon, 25 Mar 2019 11:43:23 +0800 Subject: [PATCH 1/2] Add Only Ups/Only Downs contract type --- src/botPage/common/const.js | 12 +++++++++++- src/botPage/view/blockly/blocks/shared.js | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/botPage/common/const.js b/src/botPage/common/const.js index bd4b246509..dce8ceaeba 100644 --- a/src/botPage/common/const.js +++ b/src/botPage/common/const.js @@ -141,6 +141,14 @@ const config = { RESETPUT: translate('Reset Put'), }, ], + RUNS: [ + { + RUNHIGH: translate('Only Ups'), + }, + { + RUNLOW: translate('Only Downs'), + }, + ], }, barrierTypes: [['Offset +', '+'], ['Offset -', '-']], ohlcFields : [ @@ -176,6 +184,7 @@ const config = { digits : ['matchesdiffers', 'evenodd', 'overunder'], highlowticks: ['highlowticks'], reset : ['reset'], + runs : ['runs'], }, conditionsCategoryName: { callput : translate('Up/Down'), @@ -187,6 +196,7 @@ const config = { staysinout : translate('Stays In/Goes Out'), highlowticks: translate('High/Low Ticks'), reset : translate('Reset Call/Reset Put'), + runs : translate('Only Ups/Only Downs'), }, conditions: [ 'risefall', @@ -203,7 +213,7 @@ const config = { barrierCategories: { euro_atm : ['callput', 'risefall', 'risefallequals'], euro_non_atm : ['endsinout', 'higherlower'], - american : ['staysinout', 'touchnotouch', 'highlowticks'], + american : ['staysinout', 'touchnotouch', 'highlowticks', 'runs'], non_financial: ['digits', 'overunder', 'evenodd', 'matchesdiffers'], asian : ['asian'], reset : ['reset'], diff --git a/src/botPage/view/blockly/blocks/shared.js b/src/botPage/view/blockly/blocks/shared.js index a2ed49c817..f0151c106f 100644 --- a/src/botPage/view/blockly/blocks/shared.js +++ b/src/botPage/view/blockly/blocks/shared.js @@ -353,8 +353,8 @@ export const getBarriersForContracts = (contracts, selectedContractType, selecte }) .shift(); } - const barrierlessCategories = ['reset']; - if (contract && !barrierlessCategories.includes(contract.barrier_category)) { + const barrierlessCategories = ['reset', 'runs']; + if (contract && !barrierlessCategories.includes(contract.contract_category)) { const propName = contract.barriers === 1 ? 'barrier' : barrierProps[index]; if (contract[propName]) { const barrierMatch = contract[propName].toString().match(offsetRegex); From 22605d01ad3b2164f49ca3b68ba6f1ba9f76380c Mon Sep 17 00:00:00 2001 From: Aaron Imming Date: Mon, 25 Mar 2019 12:05:03 +0800 Subject: [PATCH 2/2] Update test to accommodate new contract type --- src/botPage/common/symbolApi/__tests__/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/botPage/common/symbolApi/__tests__/index.js b/src/botPage/common/symbolApi/__tests__/index.js index 949f6ceaee..df01c7e08e 100644 --- a/src/botPage/common/symbolApi/__tests__/index.js +++ b/src/botPage/common/symbolApi/__tests__/index.js @@ -25,6 +25,7 @@ describe('symbol', () => { 'Stays In/Goes Out', 'High/Low Ticks', 'Reset Call/Reset Put', + 'Only Ups/Only Downs', ]); expect(symbol.getAllowedCategoryNames('FAKE')).to.be.empty; });