diff --git a/Gruntfile.js b/Gruntfile.js index e570d6f842..bd05b38b0e 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -11,10 +11,10 @@ module.exports = function (grunt) { grunt.initConfig({ pkg, - //Executing this task will populate grunt.config.gitinfo with repository data below - gitinfo: { - local: { branch: { current: { SHA: "", name: "", currentUser: "", } } }, - remote: { origin: { url: "" } } + githash: { + main: { + options: {}, + }, }, jshint: { options: { @@ -28,7 +28,7 @@ module.exports = function (grunt) { compressed: ["dist/compressed"], uncompressed: ["dist/uncompressed"], branches:[ "dist/branches"], - current_branch: [ "dist/branches/compressed/<%= gitinfo.local.branch.current.name %>"], + current_branch: [ "dist/branches/compressed/<%= githash.main.branch %>"], dist: ["dist"], }, copy: { @@ -107,7 +107,7 @@ module.exports = function (grunt) { expand: true, cwd: "dist/compressed", src: [ "**"], - dest: "dist/branches/compressed/<%= gitinfo.local.branch.current.name %>" + dest: "dist/branches/compressed/<%= githash.main.branch %>" } ] }, @@ -211,7 +211,7 @@ module.exports = function (grunt) { options: { base: "dist/branches/compressed", add: true, - message: "Grunt deploy-branch v<%=pkg.version%> to $username.github.io/webtrader/<%= gitinfo.local.branch.current.name %>" + message: "Grunt deploy-branch v<%=pkg.version%> to $username.github.io/webtrader/<%= githash.main.branch %>" }, src: ["**/*"] }, @@ -376,7 +376,7 @@ module.exports = function (grunt) { //Meant for local development use ONLY - for pushing to individual forks /* Deploy to a sub-folder of gh-pages with the name of current branch, This is only for developers working on different branches in their forks. */ - grunt.registerTask("deploy-branch", ["default","gitinfo", "clean:current_branch", "copy:copy_current_branch", "gh-pages:deploy-branch"]); + grunt.registerTask("deploy-branch", ["default","githash", "clean:current_branch", "copy:copy_current_branch", "gh-pages:deploy-branch"]); /* clean all the files in gh-pages branch */ grunt.registerTask("gh-pages-clean", ["gh-pages:clean"]); diff --git a/package.json b/package.json index 11c366705a..d29d64375f 100644 --- a/package.json +++ b/package.json @@ -24,14 +24,14 @@ "grunt-contrib-concat": "^0.5.1", "grunt-contrib-connect": "^1.0.2", "grunt-contrib-copy": "^0.8.0", - "grunt-contrib-cssmin": "^0.12.2", + "grunt-contrib-cssmin": "^3.0.0", "grunt-contrib-htmlmin": "^3.0.0", "grunt-contrib-imagemin": "^3.1.0", "grunt-contrib-jshint": "^1.1.0", "grunt-contrib-uglify": "^4.0.0", "grunt-contrib-watch": "^1.0.0", "grunt-gh-pages": "^3.1.0", - "grunt-gitinfo": "^0.1.7", + "grunt-githash": "^0.1.3", "grunt-newer": "^1.2.0", "grunt-po2json": "^0.3.0", "grunt-remove-logging": "ehynds/grunt-remove-logging", diff --git a/src/common/common.es6 b/src/common/common.es6 index 6db35e2608..a0856b45aa 100644 --- a/src/common/common.es6 +++ b/src/common/common.es6 @@ -63,4 +63,14 @@ const trade_types = [{ name: 'Goes Outside' }]; -export { trade_types }; +const SUPPORTED_CONTRACT_TYPES = Object.freeze([ + 'up/down', + 'touch/no touch', + 'in/out', + 'digits', + 'asians', + 'rise/fall equal', + 'lookbacks' +]); + +export { trade_types, SUPPORTED_CONTRACT_TYPES }; diff --git a/src/trade/tradeConf.es6 b/src/trade/tradeConf.es6 index 99e11f8c40..6a100f466b 100644 --- a/src/trade/tradeConf.es6 +++ b/src/trade/tradeConf.es6 @@ -237,7 +237,7 @@ const registerTicks = (state, extra) => { return; } - const has_missing_ticks = (first_tick_epoch > entry_tick_time); + const has_missing_ticks = (+first_tick_epoch > +entry_tick_time); if (has_missing_ticks) { is_getting_history = true; first_tick_epoch = entry_tick_time; diff --git a/src/trade/tradeDialog.es6 b/src/trade/tradeDialog.es6 index 1db83501e0..4b47ac63f3 100644 --- a/src/trade/tradeDialog.es6 +++ b/src/trade/tradeDialog.es6 @@ -3,6 +3,7 @@ import $ from 'jquery'; import moment from 'moment'; import windows from 'windows/windows'; import rv from 'common/rivetsExtra'; +import { SUPPORTED_CONTRACT_TYPES } from 'common/common'; import liveapi from 'websockets/binary_websockets'; import chartingRequestMap from 'charts/chartingRequestMap'; import html from 'text!trade/tradeDialog.html'; @@ -244,7 +245,7 @@ function validateMinute({ hour, minute, today_times, selected_date_unix }) { } function hasIntradayUnit(duration_unit_array) { - return duration_unit_array.some(unit => ['minutes', 'hours'].indexOf(unit) !== -1); + return duration_unit_array.some(unit => ['ticks', 'seconds', 'minutes', 'hours'].indexOf(unit) !== -1); } function init_state(available,root, dialog, symbol, contracts_for_spot) { @@ -585,13 +586,14 @@ function init_state(available,root, dialog, symbol, contracts_for_spot) { /* contracts that are more not today must end at the market close time */ const { value_date } = state.date_expiry; const is_today = !moment.utc(value_date).isAfter(moment.utc(), 'day'); + const is_duration = state.duration.value === 'Duration'; const is_daily_contracts = state.duration_unit.array[0] && !hasIntradayUnit(state.duration_unit.array); if (!is_today) { state.date_expiry.today_times.disabled = true; trading_times_for(value_date, state.proposal.symbol) .then(function(times){ - if (state.duration.value === 'Duration') { + if (is_duration) { state.date_expiry.value_date = moment.utc().format('YYYY-MM-DD'); } @@ -606,7 +608,7 @@ function init_state(available,root, dialog, symbol, contracts_for_spot) { } else { if (date_or_hour !== state.date_expiry.value_hour) { state.date_expiry.update_times(); } - if (is_daily_contracts) { + if (is_daily_contracts && !is_duration) { state.date_expiry.min_date = 1; state.date_expiry.value_date = moment.utc().add(1, 'days').format('YYYY-MM-DD'); } @@ -1014,12 +1016,12 @@ function init_state(available,root, dialog, symbol, contracts_for_spot) { .uniq() .value() // TODO: Remove this filter after implementing reset, high/low, spread, runs contracts. - .filter(f => !/reset|high\/low|spread|run/.test(f.toLowerCase())) + .filter(f => SUPPORTED_CONTRACT_TYPES.includes(f.toLowerCase())) .forEach(x => { let y = {}; y.contract_category_display = x; let contract_object = _.find(available, {contract_category_display: x}); - if(contract_object){ + if (contract_object) { y.contract_category = contract_object.contract_category; state.categories.array.push(y); } diff --git a/yarn.lock b/yarn.lock index db36d6dc5f..27280d1e90 100644 --- a/yarn.lock +++ b/yarn.lock @@ -275,11 +275,6 @@ async@^2.0.0, async@^2.6.0: dependencies: lodash "^4.17.10" -async@~0.9.0: - version "0.9.2" - resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" - integrity sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0= - async@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/async/-/async-1.0.0.tgz#f8fc04ca3a13784ade9e1641af98578cfbd647a9" @@ -1128,6 +1123,11 @@ block-stream@*: dependencies: inherits "~2.0.0" +bluebird@^3.0.5: + version "3.5.3" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" + integrity sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw== + body@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/body/-/body-5.1.0.tgz#e4ba0ce410a46936323367609ecb4e6553125069" @@ -1167,13 +1167,6 @@ braces@^2.3.1: split-string "^3.0.2" to-regex "^3.0.1" -browserify-zlib@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.1.4.tgz#bb35f8a519f600e0fa6b8485241c979d0141fb2d" - integrity sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0= - dependencies: - pako "~0.2.0" - browserslist@^3.2.6: version "3.2.8" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-3.2.8.tgz#b0005361d6471f0f5952797a76fc985f1f978fc6" @@ -1376,21 +1369,13 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" -clean-css@4.2.x: +clean-css@4.2.x, clean-css@~4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.1.tgz#2d411ef76b8569b6d0c84068dabe85b0aa5e5c17" integrity sha512-4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g== dependencies: source-map "~0.6.0" -clean-css@^3.1.0: - version "3.4.28" - resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-3.4.28.tgz#bf1945e82fc808f55695e6ddeaec01400efd03ff" - integrity sha1-vxlF6C/ICPVWlebd6uwBQA79A/8= - dependencies: - commander "2.8.x" - source-map "0.4.x" - cli@~1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/cli/-/cli-1.0.1.tgz#22817534f24bfa4950c34d532d48ecbc621b8c14" @@ -1495,7 +1480,7 @@ commander@2.6.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.6.0.tgz#9df7e52fb2a0cb0fb89058ee80c3104225f37e1d" integrity sha1-nfflL7Kgyw+4kFjugMMQQiXzfh0= -commander@2.8.x, commander@~2.8.1: +commander@~2.8.1: version "2.8.1" resolved "https://registry.yarnpkg.com/commander/-/commander-2.8.1.tgz#06be367febfda0c330aa1e2a072d3dc9762425d4" integrity sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ= @@ -1522,7 +1507,7 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -concat-stream@1.6.2, concat-stream@^1.4.1: +concat-stream@1.6.2: version "1.6.2" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== @@ -2722,6 +2707,11 @@ gifsicle@^4.0.0: execa "^1.0.0" logalot "^2.0.0" +git-rev-2@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/git-rev-2/-/git-rev-2-0.1.0.tgz#748165a8c84fb01ea67467ff15ab3e37ace4064c" + integrity sha1-dIFlqMhPsB6mdGf/Fas+N6zkBkw= + github-from-package@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" @@ -2979,14 +2969,14 @@ grunt-contrib-copy@^0.8.0: chalk "^1.1.1" file-sync-cmp "^0.1.0" -grunt-contrib-cssmin@^0.12.2: - version "0.12.3" - resolved "https://registry.yarnpkg.com/grunt-contrib-cssmin/-/grunt-contrib-cssmin-0.12.3.tgz#4157596096fb7656fc464b4cc7b0746de1f39014" - integrity sha1-QVdZYJb7dlb8RktMx7B0beHzkBQ= +grunt-contrib-cssmin@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/grunt-contrib-cssmin/-/grunt-contrib-cssmin-3.0.0.tgz#1767c0a062f4b7353c5adcadc52dcff7197d4d89" + integrity sha512-eXpooYmVGKMs/xV7DzTLgJFPVOfMuawPD3x0JwhlH0mumq2NtH3xsxaHxp1Y3NKxp0j0tRhFS6kSBRsz6TuTGg== dependencies: - chalk "^1.0.0" - clean-css "^3.1.0" - maxmin "^1.1.0" + chalk "^2.4.1" + clean-css "~4.2.1" + maxmin "^2.1.0" grunt-contrib-htmlmin@^3.0.0: version "3.0.0" @@ -3054,14 +3044,13 @@ grunt-gh-pages@^3.1.0: q-io "^1.13.6" url-safe "^2.0.0" -grunt-gitinfo@^0.1.7: - version "0.1.8" - resolved "https://registry.yarnpkg.com/grunt-gitinfo/-/grunt-gitinfo-0.1.8.tgz#3071215f578a488151c0dfd8d96bf2abce7b50d2" - integrity sha1-MHEhX1eKSIFRwN/Y2Wvyq857UNI= +grunt-githash@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/grunt-githash/-/grunt-githash-0.1.3.tgz#17c7bc75129b678fb187a4fcff83552e40489b56" + integrity sha1-F8e8dRKbZ4+xh6T8/4NVLkBIm1Y= dependencies: - async "~0.9.0" - getobject "~0.1.0" - lodash "~2.4.1" + bluebird "^3.0.5" + git-rev-2 "^0.1.0" grunt-known-options@~1.1.0: version "1.1.1" @@ -3169,14 +3158,6 @@ grunt@^1.0.1: path-is-absolute "~1.0.0" rimraf "~2.6.2" -gzip-size@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-1.0.0.tgz#66cf8b101047227b95bace6ea1da0c177ed5c22f" - integrity sha1-Zs+LEBBHInuVus5uodoMF37Vwi8= - dependencies: - browserify-zlib "^0.1.4" - concat-stream "^1.4.1" - gzip-size@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-3.0.0.tgz#546188e9bdc337f673772f81660464b389dce520" @@ -4097,11 +4078,6 @@ lodash@^4.0.0, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.5.1, l resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== -lodash@~2.4.1: - version "2.4.2" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-2.4.2.tgz#fadd834b9683073da179b3eae6d9c0d15053f73e" - integrity sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4= - logalot@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/logalot/-/logalot-2.1.0.tgz#5f8e8c90d304edf12530951a5554abb8c5e3f552" @@ -4194,16 +4170,6 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" -maxmin@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/maxmin/-/maxmin-1.1.0.tgz#71365e84a99dd8f8b3f7d5fde2f00d1e7f73be61" - integrity sha1-cTZehKmd2Piz99X94vANHn9zvmE= - dependencies: - chalk "^1.0.0" - figures "^1.0.1" - gzip-size "^1.0.0" - pretty-bytes "^1.0.0" - maxmin@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/maxmin/-/maxmin-2.1.0.tgz#4d3b220903d95eee7eb7ac7fa864e72dc09a3166" @@ -4219,7 +4185,7 @@ mdn-data@~1.1.0: resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-1.1.4.tgz#50b5d4ffc4575276573c4eedb8780812a8419f01" integrity sha512-FSYbp3lyKjyj3E7fMl6rYvUdX0FBXaluGqlFoYESWQlyUTq8R+wp0rkFxoYFqZlHCvsUXGjyJmLQSnXToYhOSA== -meow@^3.1.0, meow@^3.3.0, meow@^3.7.0: +meow@^3.3.0, meow@^3.7.0: version "3.7.0" resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" integrity sha1-cstmi0JSKCkKu/qFaJJYcwioAfs= @@ -4760,11 +4726,6 @@ p-timeout@^2.0.1: dependencies: p-finally "^1.0.0" -pako@~0.2.0: - version "0.2.9" - resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75" - integrity sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU= - paralleljs@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/paralleljs/-/paralleljs-0.2.1.tgz#ebca745d3e09c01e2bebcc14858891ff4510e926" @@ -4995,14 +4956,6 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= -pretty-bytes@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-1.0.4.tgz#0a22e8210609ad35542f8c8d5d2159aff0751c84" - integrity sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ= - dependencies: - get-stdin "^4.0.1" - meow "^3.1.0" - pretty-bytes@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-3.0.1.tgz#27d0008d778063a0b4811bb35c79f1bd5d5fbccf" @@ -5692,13 +5645,6 @@ source-map-url@^0.4.0: resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= -source-map@0.4.x, source-map@^0.4.2: - version "0.4.4" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" - integrity sha1-66T12pwNyZneaAMti092FzZSA2s= - dependencies: - amdefine ">=0.0.4" - source-map@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.3.0.tgz#8586fb9a5a005e5b501e21cd18b6f21b457ad1f9" @@ -5706,6 +5652,13 @@ source-map@^0.3.0: dependencies: amdefine ">=0.0.4" +source-map@^0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" + integrity sha1-66T12pwNyZneaAMti092FzZSA2s= + dependencies: + amdefine ">=0.0.4" + source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"