Skip to content

Commit

Permalink
add remaining toml method configs
Browse files Browse the repository at this point in the history
  • Loading branch information
askmike committed Nov 1, 2016
1 parent 74b1369 commit ce4ff40
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 17 deletions.
10 changes: 10 additions & 0 deletions config/strategies/CCI.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# constant multiplier. 0.015 gets to around 70% fit
constant = 0.015

# history size, make same or smaller than history
history = 90

[thresholds]
up = 100
down = -100
persistence = 0
6 changes: 6 additions & 0 deletions config/strategies/DEMA.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
short = 10
long = 21

[thresholds]
down = -0.025
up = 0.025
8 changes: 8 additions & 0 deletions config/strategies/PPO.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
short = 12
long = 26
signal = 9

[thresholds]
down = -0.025
up = 0.025
persistence = 2
6 changes: 6 additions & 0 deletions config/strategies/StochRSI.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interval = 3

[thresholds]
low = 20
high = 80
persistence = 3
7 changes: 7 additions & 0 deletions config/strategies/TSI.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
short = 13
long = 25

[thresholds]
low = -25
high = 25
persistence = 1
16 changes: 16 additions & 0 deletions config/strategies/UO.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[first]
weight = 4
period = 7

[second]
weight = 2
period = 14

[third]
weight = 1
period = 28

[thresholds]
low = 30
hight = 70
persistence = 1
8 changes: 8 additions & 0 deletions config/strategies/talib-macd.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[parameters]
optInFastPeriod = 10
optInSlowPeriod = 21
optInSignalPeriod = 9

[thresholds]
down = -0.025
up = 0.025
9 changes: 9 additions & 0 deletions config/strategies/varPPO.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
momentum = TSI # RSI, TSI or UO

[thresholds]
weightLow = 120
weightHigh = -120

# How many candle intervals should a trend persist
# before we consider it real?
persistence = 0
2 changes: 1 addition & 1 deletion core/markets/importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var from = moment.utc(daterange.from);

if(daterange.to) {
var to = moment.utc(daterange.to);
} else{
} else {
var to = moment().utc();
log.debug(
'No end date specified for importing, setting to',
Expand Down
3 changes: 1 addition & 2 deletions importers/exchanges/poloniex.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var done = false;
var fetcher = new Fetcher(config.watch);

var fetch = () => {
log.debug(
log.info(
'Requesting data from',
iterator.from.format('YYYY-MM-DD HH:mm:ss') + ',',
'to',
Expand All @@ -71,7 +71,6 @@ var fetch = () => {
}

var handleFetch = trades => {

iterator.from.add(batchSize, 'minutes').subtract(overlapSize, 'minutes');
iterator.to.add(batchSize, 'minutes').subtract(overlapSize, 'minutes');

Expand Down
18 changes: 5 additions & 13 deletions methods/CCI.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@ var config = require('../core/util.js').getConfig();
var settings = config.CCI;
var pposettings = config.PPO;


// let's create our own method
var method = {};

// teach our trading method events
var Util = require('util');
//var EventEmitter = require('events').EventEmitter;
//Util.inherits(TradingMethod, EventEmitter);


// prepare everything our method needs
method.init = function() {
this.currentTrend;
Expand All @@ -31,13 +24,13 @@ method.init = function() {
};
this.historySize = config.tradingAdvisor.historySize;
this.ppoadv = 'none';
this.uplevel = config.CCI.thresholds.up;
this.downlevel = config.CCI.thresholds.down;
this.persisted = config.CCI.thresholds.persistence;
this.uplevel = settings.thresholds.up;
this.downlevel = settings.thresholds.down;
this.persisted = settings.thresholds.persistence;

// log.debug("CCI started with:\nup:\t", this.uplevel, "\ndown:\t", this.downlevel, "\npersistence:\t", this.persisted);
// define the indicators we need
this.addIndicator('cci', 'CCI', config.CCI);
this.addIndicator('cci', 'CCI', settings);
}

// what happens on every new candle?
Expand Down Expand Up @@ -70,10 +63,8 @@ method.log = function() {
*/
method.check = function() {


var price = this.lastPrice;


this.age++;
var cci = this.indicators.cci;

Expand All @@ -91,6 +82,7 @@ method.check = function() {
this.trend.adviced = false;
if (this.persisted == 0) {
this.trend.adviced = true;
console.log(2);
this.advice('short');
}
} else if (cci.result >= this.uplevel) {
Expand Down
2 changes: 1 addition & 1 deletion methods/indicators/CCI.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var Indicator = function(settings) {
this.tp = 0.0;
this.TP = new LRC(settings.history);
this.result = false;
this.hist = Array(); // needed for mean?
this.hist = []; // needed for mean?
this.mean = 0.0;
this.size = 0;
this.constant = settings.constant;
Expand Down

0 comments on commit ce4ff40

Please sign in to comment.