Skip to content

Commit

Permalink
Cleaning up todos, adding tests, removing key functions that are not …
Browse files Browse the repository at this point in the history
…necessary
  • Loading branch information
andredumas committed Sep 6, 2016
1 parent 46eca40 commit 7df638f
Show file tree
Hide file tree
Showing 29 changed files with 38 additions and 47 deletions.
2 changes: 0 additions & 2 deletions src/accessor/adx.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = function() {
return accessor.r(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand All @@ -36,7 +35,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.adx = adx;
accessor.plusDi = plusDi;
Expand Down
2 changes: 0 additions & 2 deletions src/accessor/aroon.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ module.exports = function() {
return accessor.r(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand Down Expand Up @@ -57,7 +56,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.up = up;
accessor.down = down;
Expand Down
2 changes: 0 additions & 2 deletions src/accessor/atrtrailingstop.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module.exports = function() {
return accessor.up(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand All @@ -29,7 +28,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.up = up;
accessor.dn = down;
Expand Down
2 changes: 0 additions & 2 deletions src/accessor/bollinger.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = function() {
return accessor.r(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand All @@ -36,7 +35,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.middle = middle;
accessor.upper = upper;
Expand Down
2 changes: 0 additions & 2 deletions src/accessor/ichimoku.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ module.exports = function() {
return accessor.ts(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand Down Expand Up @@ -72,7 +71,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.ts = tenkanSen;
accessor.ks = kijunSen;
Expand Down
3 changes: 1 addition & 2 deletions src/accessor/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

// TODO Could these be singletons? Generally will be accessing the same data and data structures at the same time
// TODO Provide IDs for all accessors. Default to date, but at least provide an option
// Provide IDs for all accessors. Default to date, but at least provide an option
module.exports = function() {
return {
atrtrailingstop: require('./atrtrailingstop'),
Expand Down
2 changes: 0 additions & 2 deletions src/accessor/macd.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = function() {
return accessor.m(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand All @@ -37,7 +36,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.m = macd;
accessor.s = signal;
Expand Down
2 changes: 0 additions & 2 deletions src/accessor/ohlc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = function() {
return accessor.c(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand Down Expand Up @@ -50,7 +49,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.o = open;
accessor.h = high;
Expand Down
2 changes: 0 additions & 2 deletions src/accessor/rsi.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = function() {
return accessor.r(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand Down Expand Up @@ -43,7 +42,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.r = rsi;
accessor.ob = overbought;
Expand Down
2 changes: 0 additions & 2 deletions src/accessor/stochastic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = function() {
return accessor.r(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand Down Expand Up @@ -49,7 +48,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.k = stochasticK;
accessor.sd = stochasticD;
Expand Down
1 change: 0 additions & 1 deletion src/accessor/tick.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = function() {
bind();
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand Down
2 changes: 0 additions & 2 deletions src/accessor/trade.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module.exports = function() {
return accessor.p(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand All @@ -33,7 +32,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.t = type;
accessor.p = price;
Expand Down
1 change: 0 additions & 1 deletion src/accessor/trendline.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.sd = startDate;
accessor.sv = startValue;
accessor.ed = endDate;
Expand Down
2 changes: 0 additions & 2 deletions src/accessor/value.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module.exports = function() {
return accessor.v(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand All @@ -39,7 +38,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.v = value;
accessor.z = zero;
Expand Down
2 changes: 0 additions & 2 deletions src/accessor/volume.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module.exports = function() {
return accessor.v(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand All @@ -22,7 +21,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.v = volume;

Expand Down
2 changes: 0 additions & 2 deletions src/accessor/williams.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module.exports = function() {
return accessor.r(d);
}

// TODO use d3.rebind to obtain this from 'super class'
accessor.date = function(_) {
if (!arguments.length) return date;
date = _;
Expand All @@ -22,7 +21,6 @@ module.exports = function() {
};

function bind() {
// TODO These methods will need to know if the variables are functions or values and execute as such
accessor.d = date;
accessor.w = williams;

Expand Down
2 changes: 1 addition & 1 deletion src/plot/adx.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = function(accessor_adx, plot, plotMixin) { // Injected dependen
}

// Mixin 'superclass' methods and variables
plotMixin(adx, p).plot(accessor_adx(), binder).dataSelector(plotMixin.dataMapper.array, p.accessor.d);
plotMixin(adx, p).plot(accessor_adx(), binder).dataSelector(plotMixin.dataMapper.array);
binder();

return adx;
Expand Down
2 changes: 1 addition & 1 deletion src/plot/aroon.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = function(accessor_aroon, plot, plotMixin) { // Injected depend
}

// Mixin 'superclass' methods and variables
plotMixin(aroon, p).plot(accessor_aroon(), binder).dataSelector(plotMixin.dataMapper.array, p.accessor.d);
plotMixin(aroon, p).plot(accessor_aroon(), binder).dataSelector(plotMixin.dataMapper.array);
binder();

return aroon;
Expand Down
2 changes: 1 addition & 1 deletion src/plot/bollinger.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = function(accessor_bollinger, plot, plotMixin) { // Injected de
}

// Mixin 'superclass' methods and variables
plotMixin(bollinger, p).plot(accessor_bollinger(), binder).dataSelector(plotMixin.dataMapper.array, p.accessor.d);
plotMixin(bollinger, p).plot(accessor_bollinger(), binder).dataSelector(plotMixin.dataMapper.array);
binder();

return bollinger;
Expand Down
2 changes: 1 addition & 1 deletion src/plot/candlestick.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module.exports = function(d3_scale_linear, d3_extent, accessor_ohlc, plot, plotM
}

// Mixin 'superclass' methods and variables
plotMixin(candlestick, p).plot(accessor_ohlc(), binder).width(binder).dataSelector(plotMixin.dataMapper.array, p.accessor.d);
plotMixin(candlestick, p).plot(accessor_ohlc(), binder).width(binder).dataSelector(plotMixin.dataMapper.array);
binder();

return candlestick;
Expand Down
2 changes: 1 addition & 1 deletion src/plot/macd.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = function(accessor_macd, plot, plotMixin) { // Injected depende
}

// Mixin 'superclass' methods and variables
plotMixin(macd, p).plot(accessor_macd(), binder).width(binder).dataSelector(plotMixin.dataMapper.array, p.accessor.d);
plotMixin(macd, p).plot(accessor_macd(), binder).width(binder).dataSelector(plotMixin.dataMapper.array);
binder();

return macd;
Expand Down
2 changes: 1 addition & 1 deletion src/plot/ohlc.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = function(d3_scale_linear, d3_extent, accessor_ohlc, plot, plotM
}

// Mixin 'superclass' methods and variables
plotMixin(ohlc, p).plot(accessor_ohlc(), binder).width(binder).dataSelector(plotMixin.dataMapper.array, p.accessor.d);
plotMixin(ohlc, p).plot(accessor_ohlc(), binder).width(binder).dataSelector(plotMixin.dataMapper.array);
binder();

return ohlc;
Expand Down
2 changes: 1 addition & 1 deletion src/plot/rsi.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = function(accessor_rsi, plot, plotMixin) { // Injected dependen
}

// Mixin 'superclass' methods and variables
plotMixin(rsi, p).plot(accessor_rsi(), binder).dataSelector(plotMixin.dataMapper.array, p.accessor.d);
plotMixin(rsi, p).plot(accessor_rsi(), binder).dataSelector(plotMixin.dataMapper.array);
binder();

return rsi;
Expand Down
2 changes: 1 addition & 1 deletion src/plot/stochastic.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = function(accessor_stochastic, plot, plotMixin) { // Injected d
}

// Mixin 'superclass' methods and variables
plotMixin(stochastic, p).plot(accessor_stochastic(), binder).dataSelector(plotMixin.dataMapper.array, p.accessor.d);
plotMixin(stochastic, p).plot(accessor_stochastic(), binder).dataSelector(plotMixin.dataMapper.array);
binder();

return stochastic;
Expand Down
2 changes: 1 addition & 1 deletion src/plot/tick.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = function(d3_scale_linear, d3_extent, accessor_tick, plot, plotM
}

// Mixin 'superclass' methods and variables
plotMixin(tick, p).plot(accessor_tick(), binder).width(binder).dataSelector(plotMixin.dataMapper.array, p.accessor.d);
plotMixin(tick, p).plot(accessor_tick(), binder).width(binder).dataSelector(plotMixin.dataMapper.array);
binder();

return tick;
Expand Down
2 changes: 1 addition & 1 deletion src/plot/volume.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = function(accessor_volume, plot, plotMixin) { // Injected depen
}

// Mixin 'superclass' methods and variables
plotMixin(volume, p).plot(accessor_volume(), binder).width(binder).dataSelector(plotMixin.dataMapper.array, p.accessor.d);
plotMixin(volume, p).plot(accessor_volume(), binder).width(binder).dataSelector(plotMixin.dataMapper.array);
binder();

return volume;
Expand Down
2 changes: 1 addition & 1 deletion src/plot/williams.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = function(accessor_williams, plot, plotMixin) { // Injected dep
}

// Mixin 'superclass' methods and variables
plotMixin(williams, p).plot(accessor_williams(), binder).dataSelector(plotMixin.dataMapper.array, p.accessor.d);
plotMixin(williams, p).plot(accessor_williams(), binder).dataSelector(plotMixin.dataMapper.array);
binder();

return williams;
Expand Down
32 changes: 26 additions & 6 deletions test/spec/bundle/accessor/indexSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,22 @@ techanModule('accessor', function(specBuilder) {

specBuilder.require(require('../../../../src/accessor'), function(instanceBuilder) {
instanceBuilder.index('actual', actualInit, function(scope) {
it('Then accessor.adx should be defined', function() {
expect(scope.accessor.adx).toBeDefined();
});

it('Then accessor.aroon should be defined', function() {
expect(scope.accessor.aroon).toBeDefined();
});

it('Then accessor.atrtrailingstop should be defined', function() {
expect(scope.accessor.atrtrailingstop).toBeDefined();
});

it('Then accessor.bollinger should be defined', function() {
expect(scope.accessor.bollinger).toBeDefined();
});

it('Then accessor.crosshair should be defined', function() {
expect(scope.accessor.crosshair).toBeDefined();
});
Expand All @@ -31,6 +43,18 @@ techanModule('accessor', function(specBuilder) {
expect(scope.accessor.rsi).toBeDefined();
});

it('Then accessor.stochastic should be defined', function() {
expect(scope.accessor.stochastic).toBeDefined();
});

it('Then accessor.tick should be defined', function() {
expect(scope.accessor.tick).toBeDefined();
});

it('Then accessor.trade should be defined', function() {
expect(scope.accessor.trade).toBeDefined();
});

it('Then accessor.trendline should be defined', function() {
expect(scope.accessor.trendline).toBeDefined();
});
Expand All @@ -43,12 +67,8 @@ techanModule('accessor', function(specBuilder) {
expect(scope.accessor.volume).toBeDefined();
});

it('Then accessor.tick should be defined', function() {
expect(scope.accessor.tick).toBeDefined();
});

it('Then accessor.aroon should be defined', function() {
expect(scope.accessor.aroon).toBeDefined();
it('Then accessor.williams should be defined', function() {
expect(scope.accessor.williams).toBeDefined();
});
});
});
Expand Down
Empty file removed test/spec/bundle/accessor/ohlc.js
Empty file.

0 comments on commit 7df638f

Please sign in to comment.