Skip to content
This repository was archived by the owner on Feb 15, 2022. It is now read-only.

Commit a9bd54d

Browse files
kernelsndrsDeviaVir
authored andcommitted
Change markup_pct to new markdown and markup, set commonArgs so it is included in all strategies, fix return. (#1047)
The only other occurrence is in the readme file noting the legacy aspect.
1 parent 7cf1a4c commit a9bd54d

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

scripts/genetic_backtester/darwin.js

+26-14
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ let NEUTRAL_RATE_AUTO = false;
3939
let iterationCount = 0;
4040

4141
let runCommand = (taskStrategyName, phenotype, cb) => {
42-
let commonArgs = `--strategy=${taskStrategyName} --period_length=${phenotype.period_length} --min_periods=${phenotype.min_periods} --markup_pct=${phenotype.markup_pct} --order_type=${phenotype.order_type} --sell_stop_pct=${phenotype.sell_stop_pct} --buy_stop_pct=${phenotype.buy_stop_pct} --profit_stop_enable_pct=${phenotype.profit_stop_enable_pct} --profit_stop_pct=${phenotype.profit_stop_pct}`;
42+
let commonArgs = `--strategy=${taskStrategyName} --periodLength=${phenotype.period_length} --min_periods=${phenotype.min_periods} --markdown_buy_pct=${phenotype.markdown_buy_pct} --markup_sell_pct=${phenotype.markup_sell_pct} --order_type=${phenotype.order_type} --sell_stop_pct=${phenotype.sell_stop_pct} --buy_stop_pct=${phenotype.buy_stop_pct} --profit_stop_enable_pct=${phenotype.profit_stop_enable_pct} --profit_stop_pct=${phenotype.profit_stop_pct}`;
4343
let strategyArgs = {
44-
crossover_vwap: `--emalen1=${phenotype.emalen1} --vwap_length=${phenotype.vwap_length} --vwap_max=${phenotype.vwap_max} --markdown_buy_pct=${phenotype.markdown_buy_pct} --markup_sell_pct=${phenotype.markup_sell_pct}`,
44+
crossover_vwap: `--emalen1=${phenotype.emalen1} --vwap_length=${phenotype.vwap_length} --vwap_max=${phenotype.vwap_max}`,
4545
trendline: `--lastpoints=${phenotype.lastpoints} --avgpoints=${phenotype.avgpoints} --lastpoints2=${phenotype.lastpoints2} --avgpoints2=${phenotype.avgpoints2} --markdown_buy_pct=${phenotype.markdown_buy_pct} --markup_sell_pct=${phenotype.markup_sell_pct}`,
4646
cci_srsi: `--cci_periods=${phenotype.rsi_periods} --rsi_periods=${phenotype.srsi_periods} --srsi_periods=${phenotype.srsi_periods} --srsi_k=${phenotype.srsi_k} --srsi_d=${phenotype.srsi_d} --oversold_rsi=${phenotype.oversold_rsi} --overbought_rsi=${phenotype.overbought_rsi} --oversold_cci=${phenotype.oversold_cci} --overbought_cci=${phenotype.overbought_cci} --constant=${phenotype.constant}`,
4747
srsi_macd: `--rsi_periods=${phenotype.rsi_periods} --srsi_periods=${phenotype.srsi_periods} --srsi_k=${phenotype.srsi_k} --srsi_d=${phenotype.srsi_d} --oversold_rsi=${phenotype.oversold_rsi} --overbought_rsi=${phenotype.overbought_rsi} --ema_short_period=${phenotype.ema_short_period} --ema_long_period=${phenotype.ema_long_period} --signal_period=${phenotype.signal_period} --up_trend_threshold=${phenotype.up_trend_threshold} --down_trend_threshold=${phenotype.down_trend_threshold}`,
@@ -164,7 +164,8 @@ let processOutput = output => {
164164
days: days,
165165
period_length: params.period_length,
166166
min_periods: params.min_periods,
167-
markup_pct: params.markup_pct,
167+
markdown_buy_pct: params.markdown_buy_pct,
168+
markup_sell_pct: params.markup_sell_pct,
168169
order_type: params.order_type,
169170
roi: roi,
170171
wlRatio: losses > 0 ? roundp(wins / losses, 3) : 'Infinity',
@@ -258,7 +259,8 @@ let strategies = {
258259
// -- common
259260
period_length: RangePeriod(1, 120, 'm'),
260261
min_periods: Range(1, 200),
261-
markup_pct: RangeFloat(0, 5),
262+
markdown_buy_pct: RangeFloat(-1, 5),
263+
markup_sell_pct: RangeFloat(-1, 5),
262264
order_type: RangeMakerTaker(),
263265
sell_stop_pct: Range0(1, 50),
264266
buy_stop_pct: Range0(1, 50),
@@ -281,7 +283,8 @@ let strategies = {
281283
// -- common
282284
period_length: RangePeriod(1, 120, 'm'),
283285
min_periods: Range(1, 200),
284-
markup_pct: RangeFloat(0, 5),
286+
markdown_buy_pct: RangeFloat(-1, 5),
287+
markup_sell_pct: RangeFloat(-1, 5),
285288
order_type: RangeMakerTaker(),
286289
sell_stop_pct: Range0(1, 50),
287290
buy_stop_pct: Range0(1, 50),
@@ -305,7 +308,8 @@ let strategies = {
305308
// -- common
306309
period_length: RangePeriod(1, 120, 'm'),
307310
min_periods: Range(1, 200),
308-
markup_pct: RangeFloat(0, 5),
311+
markdown_buy_pct: RangeFloat(-1, 5),
312+
markup_sell_pct: RangeFloat(-1, 5),
309313
order_type: RangeMakerTaker(),
310314
sell_stop_pct: Range0(1, 50),
311315
buy_stop_pct: Range0(1, 50),
@@ -325,7 +329,8 @@ let strategies = {
325329
// -- common
326330
period_length: RangePeriod(1, 120, 'm'),
327331
min_periods: Range(1, 200),
328-
markup_pct: RangeFloat(0, 5),
332+
markdown_buy_pct: RangeFloat(-1, 5),
333+
markup_sell_pct: RangeFloat(-1, 5),
329334
order_type: RangeMakerTaker(),
330335
sell_stop_pct: Range0(1, 50),
331336
buy_stop_pct: Range0(1, 50),
@@ -344,7 +349,8 @@ let strategies = {
344349
// -- common
345350
period_length: RangePeriod(1, 120, 'm'),
346351
min_periods: Range(1, 200),
347-
markup_pct: RangeFloat(0, 5),
352+
markdown_buy_pct: RangeFloat(-1, 5),
353+
markup_sell_pct: RangeFloat(-1, 5),
348354
order_type: RangeMakerTaker(),
349355
sell_stop_pct: Range0(1, 50),
350356
buy_stop_pct: Range0(1, 50),
@@ -363,7 +369,8 @@ let strategies = {
363369
// -- common
364370
period_length: RangePeriod(1, 120, 'm'),
365371
min_periods: Range(2, 100),
366-
markup_pct: RangeFloat(0, 5),
372+
markdown_buy_pct: RangeFloat(-1, 5),
373+
markup_sell_pct: RangeFloat(-1, 5),
367374
order_type: RangeMakerTaker(),
368375
sell_stop_pct: Range0(1, 50),
369376
buy_stop_pct: Range0(1, 50),
@@ -378,7 +385,8 @@ let strategies = {
378385
// -- common
379386
period_length: RangePeriod(1, 120, 'm'),
380387
min_periods: Range(1, 100),
381-
markup_pct: RangeFloat(0, 5),
388+
markdown_buy_pct: RangeFloat(-1, 5),
389+
markup_sell_pct: RangeFloat(-1, 5),
382390
order_type: RangeMakerTaker(),
383391
sell_stop_pct: Range0(1, 50),
384392
buy_stop_pct: Range0(1, 50),
@@ -393,7 +401,8 @@ let strategies = {
393401
// -- common
394402
period_length: RangePeriod(1, 120, 'm'),
395403
min_periods: Range(1, 100),
396-
markup_pct: RangeFloat(0, 5),
404+
markdown_buy_pct: RangeFloat(-1, 5),
405+
markup_sell_pct: RangeFloat(-1, 5),
397406
order_type: RangeMakerTaker(),
398407
sell_stop_pct: Range0(1, 50),
399408
buy_stop_pct: Range0(1, 50),
@@ -409,7 +418,8 @@ let strategies = {
409418
// -- common
410419
period_length: RangePeriod(1, 120, 'm'),
411420
min_periods: Range(1, 100),
412-
markup_pct: RangeFloat(0, 5),
421+
markdown_buy_pct: RangeFloat(-1, 5),
422+
markup_sell_pct: RangeFloat(-1, 5),
413423
order_type: RangeMakerTaker(),
414424
sell_stop_pct: Range0(1, 50),
415425
buy_stop_pct: Range0(1, 50),
@@ -428,7 +438,8 @@ let strategies = {
428438
// -- common
429439
period_length: RangePeriod(1, 120, 'm'),
430440
min_periods: Range(1, 200),
431-
markup_pct: RangeFloat(0, 5),
441+
markdown_buy_pct: RangeFloat(-1, 5),
442+
markup_sell_pct: RangeFloat(-1, 5),
432443
order_type: RangeMakerTaker(),
433444
sell_stop_pct: Range0(1, 50),
434445
buy_stop_pct: Range0(1, 50),
@@ -467,7 +478,8 @@ let strategies = {
467478
// -- common
468479
period_length: RangePeriod(1, 120, 'm'),
469480
min_periods: Range(1, 100),
470-
markup_pct: RangeFloat(0, 5),
481+
markdown_buy_pct: RangeFloat(-1, 5),
482+
markup_sell_pct: RangeFloat(-1, 5),
471483
order_type: RangeMakerTaker(),
472484
sell_stop_pct: Range0(1, 50),
473485
buy_stop_pct: Range0(1, 50),

0 commit comments

Comments
 (0)