-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdash.coffee
2600 lines (1949 loc) · 83.7 KB
/
dash.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
wait_for_bus ->
bus.render_when_loading = false
focus = fetch 'focus'
focus.highlighted = null
focus.params = []
save focus
# bus.honk = false
# bus.dev_with_single_client = false
font = 'Bebas Neue'
mono = 'Roboto Mono'
special = 'Railway'
fonts = []
for f in [font, mono, special] when !(f in ['Courier new'])
fonts.push f if fonts.indexOf(f) == -1
fetch '/balances'
dom.BODY = ->
price_data = fetch '/price_data'
balances = fetch '/balances'
time = fetch '/time'
operation = fetch '/operation'
config = fetch '/config'
for name, strategy of operation when name != 'key'
for dealer in strategy.dealers
fetch(dealer)
DIV
style:
fontFamily: font
minHeight: window.innerHeight
padding: 0
margin: 0
minWidth: 1400
backgroundColor: 'black'
#width: '100%'
color: 'white'
for f in fonts
LINK
key: f
href: "http://fonts.googleapis.com/css?family=#{f}:200,300,400,500,700"
rel: 'stylesheet'
type: 'text/css'
LOADING_METH
status: if [email protected]_loaded
'downloading deals'
else if [email protected]
'sorting it out'
else
'presenting the books'
else
DIV
key: 'main'
style:
padding: "20px 40px"
SECTION
key: 'bank'
name: 'Account Overview'
show_by_default: true
render: -> BANK key: 'bank'
SECTION
key: 'performance'
name: 'Dealer performance'
show_by_default: true
render: -> PERFORMANCE key: 'performance'
SECTION
key: 'graphs' + md5(JSON.stringify(dealers_in_focus()))
name: 'Time series'
show_by_default: false
render: -> TIME_SERIES() #GRAPHS key: 'graphs'
SECTION
key: 'parameter selection'
name: "Performance by variable"
show_by_default: false
render: -> PARAMETER_SELECTOR key: 'PARAMETER_SELECTOR'
SECTION
key: 'threevars'
name: 'Variable Interactions'
show_by_default: false
render: -> PLOT_THREE_VAR_RELATIONS()
SECTION
key: 'activity'
name: 'All activity'
show_by_default: false
render: -> ACTIVITY key: 'table'
# SECTION
# key: 'misc_analysis'
# name: "Misc. Analysis"
# show_by_default: false
# render: -> PRICE_TRAJECTORY_OF_OPEN_POSITIONS()
dom.BODY.refresh = ->
if [email protected] && !compute_stats?
all_dealers_fetched = true
for d in get_dealers()
all_dealers_fetched &&= Object.keys( from_cache(d) ).length > 1
if all_dealers_fetched && !@loading()
if [email protected]_loaded
@local.data_loaded = true
save @local
local = @local
window.compute_stats = bus.reactive ->
price_data = fetch '/price_data'
balances = fetch '/balances'
time = fetch '/time'
return if Object.keys(price_data).length == 1 || Object.keys(balances).length == 1 || Object.keys(time).length == 1
try
if Date.now() - started_computing_at < 100000 && last_time == JSON.stringify(time)
return
last_time = JSON.stringify(time)
started_computing_at = Date.now()
KPI (stats) ->
console.log "COMPUTED in #{Date.now() - started_computing_at}"
stats.key = 'stats'
save stats
if !local.ready
local.ready = true
save local
catch error
console.error error
setTimeout compute_stats, 500
started_computing_at = 0
last_time = null
dom.SECTION = ->
tw = if [email protected] then 15 else 20
th = if [email protected] then 20 else 15
@local.show ?= @props.show_by_default
DIV null,
DIV
style:
fontSize: 44
color: '#555'
cursor: 'pointer'
position: 'relative'
onClick: =>
@local.show = [email protected]
save @local
SPAN
style: cssTriangle (if [email protected] then 'right' else 'bottom'), '#777', tw, th,
position: 'absolute'
left: -tw - 12
bottom: 23
width: tw
height: th
display: 'inline-block'
opacity: if @local.show then .5
H1
style:
fontSize: 44
marginBottom: 6
@props.name
if @local.show
@props.render()
dom.PRICE_CANDLESTICKS = ->
price_data = fetch '/price_data'
toggle = =>
@local.showing = [email protected]
save @local
DIV null,
BUTTON
onClick: toggle
style:
backgroundColor: 'transparent'
border: 'none'
color: attention_magenta
cursor: 'pointer'
"#{@props.name}"
DIV
style:
display: if [email protected] then 'none'
margin: '40px 0'
DIV
id: "candlestick"
style:
position: 'relative'
dom.PRICE_CANDLESTICKS.refresh = ->
price_data = fetch '/price_data'
config = fetch '/config'
return if @local.initialized || [email protected] || Object.keys(price_data).length == 1
converted = config.c1 not in ['USD', 'USDT']
@local.initialized = true
data = []
layout = {}
num_candles = if converted then Object.keys(price_data).length - 1 else 1
candles = if converted then ['c1xc2', 'c1', 'c2'] else ['c1xc2']
for pair in candles
OHLC = price_data[pair]
idx = data.length
if idx > 0
num = idx + 1
else
num = ""
datum =
type: 'candlestick'
x: KPI.dates #(o.date * 1000 for o in OHLC)
close: (o.close for o in OHLC when o.date * 1000 >= KPI.dates[0])
high: (o.high for o in OHLC when o.date * 1000 >= KPI.dates[0])
low: (o.low for o in OHLC when o.date * 1000 >= KPI.dates[0])
open: (o.open for o in OHLC when o.date * 1000 >= KPI.dates[0])
yaxis: "y#{num}"
decreasing:
line:
color: bright_red
increasing:
line:
color: ecto_green
line:
color: 'rgba(31,119,180,1)'
name: pair
layout = extend layout,
"yaxis#{num}":
#autorange: true
domain: [(if idx == 0 then 0 else idx / num_candles + .02), (if idx == num_candles - 1 then 1 else (idx + 1) / num_candles - .02)]
type: 'linear'
gridcolor: '#222'
data.push datum
layout = extend layout,
dragmode: 'zoom'
margin:
r: 10
t: 25
b: 40
l: 60
showlegend: false
height: 700
paper_bgcolor: 'rgba(0,0,0,0)'
plot_bgcolor: 'rgba(0,0,0,0)'
font:
family: mono
size: 12
color: '#888'
xaxis:
#autorange: true
domain: [0, 1]
gridcolor: '#222'
rangeselector:
activecolor: '#333'
bgcolor: '#111'
bordercolor: '#333'
buttons: [{
step: 'month'
stepmode: 'backward'
count: 1
label: '1m'
}, {
step: 'month'
stepmode: 'backward'
count: 6
label: '6m'
}, {
step: 'year'
stepmode: 'todate'
count: 1
label: 'YTD'
}, {
step: 'year'
stepmode: 'backward'
count: 1
label: '1y'
}, {
step: 'all'
}]
rangeslider: {}
title: 'Date'
type: 'date'
Plotly.plot("candlestick", data, layout)
feature_settings =
'/price-dealer':
name: 'Price'
'/last_price-dealer':
name: 'Last Price'
'/USD_volume-dealer':
name: 'USD volume traded'
tickformat: "+$,.0f"
plot_settings =
trades:
name: 'Trades'
equity:
name: 'Profit & Losses'
metric: 'profit_index'
tickformat: "+$,.0f"
unit_profits:
name: 'Unit Profit & Losses'
metric: 'unit_profits'
tickformat: "+,.4f"
ratio:
name: 'Pair Ratio'
metric: 'ratio_compared_to_deposit'
tickformat: ',.4%'
trade_profit:
name: 'Position Profit'
metric: 'trade_profit'
tickformat: ',.4f'
fees:
name: 'Fees'
metric: 'fees'
tickformat: ',.4f'
volume:
name: 'Volume'
metric: 'volume'
tickformat: ',.4f'
fee_rate:
name: 'Fee rate'
metric: 'fee_rate'
tickformat: ',.2%'
returns:
name: 'Return %'
metric: 'returns'
tickformat: ',.2%'
y: (series) -> (p[1]/100 for p in series)
open:
name: 'Open Positions'
metric: 'open'
tickformat: ','
dom.TIME_SERIES = ->
features = get_series()
plots = Object.keys plot_settings
diff = get_differentiating_parameters()
diff_params = Object.keys(diff)
if diff_params.length > 0
params = Object.keys diff[diff_params[0]].variables
else
params = []
if [email protected]_features?
@local.enabled_features = {}
@local.enabled_features[features[0]] = true
@local.show_trades = false
@local.enabled_plots = {}
@local.enabled_plots[plots[0]] = true
@local.enabled_params = {}
option_label_style =
fontFamily: special
fontSize: 18
color: '#414141'
marginBottom: 12
choice_style =
fontSize: 18
display: 'inline-block'
padding: '0px 8px'
fontFamily: font
cursor: 'pointer'
DIV
style:
minHeight: 800
DIV
style: option_label_style
'features'
UL
style:
listStyle: 'none'
display: 'inline'
for feature in features
do (feature) =>
LI
style: extend {}, choice_style,
color: if @local.enabled_features[feature] then ecto_green else '#616161'
onClick: (e) =>
@local.enabled_features[feature] = [email protected]_features[feature]
@local.initialized = false
save @local
feature_settings[feature]?.name or feature.replace('-dealer', '').substring(1)
DIV
style: option_label_style
'plots'
UL
style:
listStyle: 'none'
display: 'inline'
for plot in plots
do (plot) =>
LI
style: extend {}, choice_style,
color: if @local.enabled_plots[plot] then ecto_green else '#616161'
onClick: (e) =>
@local.enabled_plots[plot] = [email protected]_plots[plot]
@local.initialized = false
save @local
plot_settings[plot].name or plot
DIV
style: option_label_style
'params'
UL
style:
listStyle: 'none'
display: 'inline'
for param in params
do (param) =>
LI
style: extend {}, choice_style,
color: if @local.enabled_params[param] then ecto_green else '#616161'
onClick: (e) =>
@local.enabled_params[param] = [email protected]_params[param]
@local.initialized = false
save @local
param
DIV
style:
position: 'relative'
DIV
id: "time-series"
ref: 'plotly'
key: md5(JSON.stringify({plots: @local.enabled_plots, features: @local.enabled_features, params: @local.params}))
style:
position: 'relative'
dom.TIME_SERIES.refresh = ->
price_data = fetch '/price_data'
balances = fetch '/balances'
all_stats = fetch 'stats'
all_trades = fetch('/all_trades').trades
return if @local.initialized || Object.keys(price_data).length == 1 || \
dealers_in_focus().length == 0 || \
Object.keys(balances).length == 1 || Object.keys(all_stats).length == 1
@local.initialized = true
active_params = []
for param, active of @local.enabled_params when active
active_params.push param
if active_params.length == 0
if get_dealers().length == dealers_in_focus().length
name = 'all'
else
name = md5 JSON.stringify(dealers_in_focus())
lines = [ {name: name, dealers: dealers_in_focus()} ]
else
lines = []
##################
# iteratively build up dealer sets based from conjunctive params
dealers_by_param_val = {}
for param in active_params
dealers_by_param_val[param] = {}
for dealer in dealers_in_focus()
for part,idx in dealer_params(dealer)
continue if idx == 0
p = param_value(part)
if p.var of dealers_by_param_val
dealers_by_param_val[p.var][p.val] ?= []
dealers_by_param_val[p.var][p.val].push dealer
while active_params.length > 0
param = active_params.pop()
# get all of the different values + dealers for this param
perms = dealers_by_param_val[param]
# expand dealer_sets with each value of current param
if lines.length > 0
expanded_dealer_sets = []
for dealer_set in lines
for val, dealers of perms
dealers_for_val = (d for d in dealers when d in dealer_set.dealers)
if dealers_for_val.length > 0
expanded_dealer_sets.push
name: "#{dealer_set.name} #{param}:#{val}"
dealers: dealers_for_val
lines = expanded_dealer_sets
else
for val, dealers of perms
lines.push
name: "#{val}:#{param}"
dealers: dealers
################
plots = []
for k,v of @local.enabled_plots
if v && k != 'trades'
plots.push k
if @local.enabled_plots.trades
plots.push 'trades'
data = []
layout = {}
axis_counter = 1
axis_map = {}
dates = undefined
for feature, enabled of @local.enabled_features
continue if !enabled
pnts = cached_positions[feature] or []
dates = (p.created * 1000 for p in pnts)
series_dat = (p.entry.rate for p in pnts)
axdef = "yaxis#{axis_counter}"
anchor = "y#{axis_counter}"
axis_map[feature] = {axdef, anchor}
data.push
name: feature
type: 'scattergl'
x: dates
y: series_dat
mode: 'markers'
yaxis: anchor
xaxis: 'x'
# hoverinfo: "y+name"
hoverformat: feature_settings[feature]?.tickformat
line:
width: 1
marker:
size: 4
layout[axdef] =
tickformat: feature_settings[feature]?.tickformat or ',.4r'
hoverformat: feature_settings[feature]?.tickformat or ',.4r'
anchor: 'x'
overlaying: 'y'
side: 'right'
autorange: true
showgrid: false
zeroline: true
showline: false
autotick: true
ticks: ''
showticklabels: false
axis_counter += 1
if all_trades?.length > 0
dates = (p.date * 1000 for p in all_trades)
series_dat = (p.rate for p in all_trades)
if (axis_map['/last_price-dealer'] or axis_map['/price-dealer'])
axdef = (axis_map['/last_price-dealer'] or axis_map['/price-dealer']).axdef
anchor = (axis_map['/last_price-dealer'] or axis_map['/price-dealer']).anchor
else
console.assert false
axis_map[feature] = {axdef, anchor}
data.push
name: 'all trades'
type: 'scattergl'
x: dates
y: series_dat
mode: 'markers'
yaxis: anchor
xaxis: 'x'
# hoverinfo: "y+name"
# hoverformat: feature_settings[feature]?.tickformat
line:
width: 1
marker:
size: 1
for plot in plots
series_settings = plot_settings[plot]
if axis_counter == 1
axdef = 'yaxis'
anchor = null
else if plot == 'trades' && (axis_map['/last_price-dealer'] or axis_map['/price-dealer'])
axdef = (axis_map['/last_price-dealer'] or axis_map['/price-dealer']).axdef
anchor = (axis_map['/last_price-dealer'] or axis_map['/price-dealer']).anchor
else
axdef = "yaxis#{axis_counter}"
anchor = "y#{axis_counter}"
axis_map[plot] = {axdef, anchor}
if !(axdef of layout)
layout[axdef] =
tickformat: series_settings.tickformat or ''
hoverformat: series_settings.hoverformat or series_settings.tickformat or ''
gridcolor: '#555'
showgrid: false
anchor: 'x'
if axis_counter > 1
extend layout[axdef],
overlaying: 'y'
side: 'right'
autorange: true
showgrid: false
zeroline: true
showline: false
autotick: true
if axis_counter > 2
extend layout[axdef],
ticks: ''
showticklabels: false
if plot == 'trades'
x = []
y = []
colors = []
size = []
borderwidths = []
opacities = []
linesx =
buy: []
sell: []
linesy =
buy: []
sell: []
plot_fills = false
for dealer in dealers_in_focus()
for p in cached_positions[dealer]
for trade in [p.entry, p.exit] when trade
if plot_fills && trade.fills?.length > 0
for fill in trade.fills
x.push 1000 * fill.date
y.push fill.rate
if trade.type == 'sell'
colors.push 0
else
colors.push 1
size.push 8
opacities.push fill.amount / trade.amount
borderwidths.push 0
else if !plot_fills
x.push 1000 * (trade.closed or trade.created)
y.push trade.rate
if trade.type == 'sell'
colors.push 0
else
colors.push 1
if p.closed
size.push 8
opacities.push .5
borderwidths.push 0
else
opacities.push .9
size.push 12
if !trade.closed
borderwidths.push 1
else
borderwidths.push 0
if p.entry && p.exit && !plot_fills
if Math.abs((p.entry.closed or p.entry.created) - (p.exit.closed or p.exit.created)) > 5 * 60
linesx[p.entry.type].push 1000 * (p.entry.closed or p.entry.created)
linesy[p.entry.type].push p.entry.rate
linesx[p.entry.type].push 1000 * (p.exit.closed or p.exit.created)
linesy[p.entry.type].push p.exit.rate
linesx[p.entry.type].push null
linesy[p.entry.type].push null
data.push
name: "Trades plot"
type: 'scattergl'
mode: 'markers'
x: x
y: y
yaxis: anchor
xaxis: 'x'
showlegend: false
# hoverinfo: 'skip'
marker:
size: size
color: colors
opacity: opacities
colorscale: [[0, attention_magenta], [.5, "#ffff00"], [1, ecto_green]]
line:
width: borderwidths
color: 'white'
data.push
name: "Trades buy line"
type: 'scattergl'
mode: 'lines'
x: linesx.buy
y: linesy.buy
yaxis: anchor
xaxis: 'x'
showlegend: false
hoverinfo: 'skip'
opacity: .3
line:
width: 1
color: ecto_green
data.push
name: "Trades sell line"
type: 'scattergl'
mode: 'lines'
x: linesx.sell
y: linesy.sell
yaxis: anchor
xaxis: 'x'
showlegend: false
hoverinfo: 'skip'
opacity: .3
line:
width: 1
color: attention_magenta
else
for line in lines
name = line.name
dealers = line.dealers
compute_KPI dealers, name
series = all_stats[name].metrics[series_settings.metric]
data.push
name: "#{name} ##{plot_settings[plot].name or plot}"
type: 'scattergl'
x: KPI.dates
y: series_settings.y?(series) or (p[1] for p in series)
yaxis: anchor
xaxis: 'x'
showlegend: false
hoverinfo: "y+name"
hoverlabel:
namelength: 100
line:
shape: 'linear' #'spline'
width: 1
# color: 'rgba(31,119,180,1)'
axis_counter += 1
layout = extend layout,
dragmode: 'zoom'
margin:
r: 10
t: 25
b: 40
l: 60
pad: 0
showlegend: false #data.length < 25
height: 700
paper_bgcolor: 'rgba(0,0,0,0)'
plot_bgcolor: 'rgba(0,0,0,0)'
font:
family: mono
size: 12
color: '#888'
xaxis:
gridcolor: '#333'
showgrid: false
zeroline: true
rangeselector:
activecolor: '#333'
bgcolor: '#111'
bordercolor: '#333'
buttons: [{
step: 'month'
stepmode: 'backward'
count: 1
label: '1m'
}, {
step: 'month'
stepmode: 'backward'
count: 6
label: '6m'
}, {
step: 'year'
stepmode: 'todate'
count: 1
label: 'YTD'
}, {
step: 'year'
stepmode: 'backward'
count: 1
label: '1y'
}, {
step: 'all'
}]
rangeslider: {}
#type: 'date'
try
Plotly.purge(@refs.plotly.getDOMNode())
catch e
console.log "Couldn't delete plotly trace before plotting"
Plotly.plot(@refs.plotly.getDOMNode(), data, layout)
scalar_variables = ->
diff = get_differentiating_parameters()
variables = {}
for name, pieces of diff
for param in pieces.params
variable = param_value(param).var
variables[variable] ?= []
variables[variable].push param_value(param).val
variables
window.get_differentiating_parameters = (opts) ->
focus = fetch 'focus'
stats = fetch 'stats'
instances = dealers_in_focus include_strategies: false
strategies = {}
opts ?= {}
for dealer in instances
params = {}
#continue if stats[dealer].status.completed + stats[dealer].status.open == 0
for part, idx in dealer_params(dealer)
if idx == 0
name = part
strategies[name] ||=
instances: []
params: []
strategies[name].instances.push dealer
else if strategies[name]?.params.indexOf(part) == -1
strategies[name].params.push part
# count instances of each parameter. we'll later filter out variables
# that aren't actually variable
for name, pieces of strategies
variables = {}
for param in pieces.params
variable = param_value(param).var
variables[variable] ?= 0
variables[variable] += 1
strategies[name].variables = variables