-
Notifications
You must be signed in to change notification settings - Fork 4
/
bollinger_bands.clj
313 lines (293 loc) · 18.4 KB
/
bollinger_bands.clj
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
;; gorilla-repl.fileformat = 1
;; **
;;; ## Bollinger Bands
;; **
;; @@
(ns clojure-backtesting.examples.bollinger
(:require [clojure-backtesting.data :refer :all]
[clojure-backtesting.data-management :refer :all]
[clojure-backtesting.portfolio :refer :all]
[clojure-backtesting.order :refer :all]
[clojure-backtesting.evaluate :refer :all]
[clojure-backtesting.plot :refer :all]
[clojure-backtesting.counter :refer :all]
[clojure-backtesting.automation :refer :all]
[clojure-backtesting.parameters :refer :all]
[clojure-backtesting.indicators :refer :all]
[clojure-backtesting.direct :refer :all]
[clojure.string :as str]
[clojure.java.io :as io]
[clojure.pprint :as pprint]
) ;; require all libriaries from core
)
;; @@
;; =>
;;; {"type":"html","content":"<span class='clj-nil'>nil</span>","value":"nil"}
;; <=
;; **
;;; ### Import dataset
;; **
;; @@
; path to dataset = "/Volumes/T7/CRSP"
; change it to the relative path to your own dataset
;
(load-dataset "./Volumes/T7/CRSP" "main" add-aprc)
;; @@
;; ->
;;; The dataset is already furnished by add-aprc. No more modification is needed.
;;;
;; <-
;; =>
;;; {"type":"html","content":"<span class='clj-string'>"Date range: 1972-01-03 ~ 2017-02-10"</span>","value":"\"Date range: 1972-01-03 ~ 2017-02-10\""}
;; <=
;; **
;;; ### Initialise portfolio (Go back here everytime you want to restart.)
;; **
;; @@
;; initialise with current date and initial capital (= $1000)
(init-portfolio "1990-12-23" 1000);
;; @@
;; =>
;;; {"type":"html","content":"<span class='clj-string'>"Date: 1990-12-21 Cash: $1000"</span>","value":"\"Date: 1990-12-21 Cash: $1000\""}
;; <=
;; @@
(get-date)
;; @@
;; =>
;;; {"type":"html","content":"<span class='clj-string'>"1990-12-21"</span>","value":"\"1990-12-21\""}
;; <=
;; **
;;; ### Write a strategy
;;;
;;; The Bollinger Bands indicator is used to measure the “highness” or “lowness” of the price, relative to previous trades.
;;; The Bollinger Bands consist of a middle band with two outer bands:
;;;
;;; Middle Band=20-day simple moving average (SMA)
;;;
;;; Upper Band=20-day SMA+(20-day standard deviation of price×2)
;;;
;;; Lower Band=20-day SMA−(20-day standard deviation of price×2)
;;;
;;; Buy signal: when price goes below lower band
;;;
;;; Sell signal: when price goes above upper band
;;;
;; **
;; @@
(defn bollinger-bands
[tic]
"The strategy"
(let [price (or (get-permno-price tic) 0)
SMA (or (moving-avg tic 20) 0)
SD20 (or (moving-sd tic 20) 0)
[upper lower] [(+ SMA (* SD20 2)) (- SMA (* SD20 2))]]
(if (< price lower)
(order tic 1 :print false))
(if (> price upper)
(order tic 0 :remaining true))))
;; @@
;; =>
;;; {"type":"html","content":"<span class='clj-var'>#'clojure-backtesting.updated_examples.goldencross/bollinger-bands</span>","value":"#'clojure-backtesting.updated_examples.goldencross/bollinger-bands"}
;; <=
;; @@
(while (< (compare (get-date) "1991-10-17") 0)
(do
(bollinger-bands "28636")
(bollinger-bands "12546"))
(update-eval-report)
(next-date))
(end-order)
;; @@
;; =>
;;; {"type":"html","content":"<span class='clj-unkown'>true</span>","value":"true"}
;; <=
;; **
;;; ### Check portfolio record
;; **
;; @@
;; view final portfolio
(print-portfolio)
;; @@
;; ->
;;;
;;; | :asset | :price | :aprc | :quantity | :tot-val |
;;; |--------+--------+-------+-----------+----------|
;;; | cash | N/A | N/A | N/A | 1013.65 |
;;;
;; <-
;; =>
;;; {"type":"html","content":"<span class='clj-nil'>nil</span>","value":"nil"}
;; <=
;; @@
;; view portfolio value and return
(print-portfolio-record 10)
;; @@
;; ->
;;;
;;; | :date | :tot-value | :daily-ret | :tot-ret | :loan | :leverage | :margin |
;;; |------------+------------+------------+----------+-------+-----------+---------|
;;; | 1990-12-21 | $1000.00 | 0.00% | 0.00% | $0.00 | 0.00 | 0.00% |
;;; | 1991-01-08 | $1000.00 | 0.00% | 0.00% | $0.00 | 0.00 | 0.00% |
;;; | 1991-01-09 | $999.62 | -0.02% | -0.02% | $0.00 | 0.00 | 0.00% |
;;; | 1991-01-10 | $1000.10 | 0.00% | 0.00% | $0.00 | 0.00 | 0.00% |
;;; | 1991-01-11 | $1000.29 | 0.01% | 0.01% | $0.00 | 0.00 | 0.00% |
;;; | 1991-01-14 | $1000.29 | 0.00% | 0.01% | $0.00 | 0.00 | 0.00% |
;;; | 1991-01-15 | $1000.29 | 0.00% | 0.01% | $0.00 | 0.00 | 0.00% |
;;; | 1991-01-16 | $1000.29 | 0.00% | 0.01% | $0.00 | 0.00 | 0.00% |
;;; | 1991-01-17 | $1001.41 | 0.05% | 0.06% | $0.00 | 0.00 | 0.00% |
;;; | 1991-01-18 | $1002.34 | 0.04% | 0.10% | $0.00 | 0.00 | 0.00% |
;;;
;; <-
;; =>
;;; {"type":"html","content":"<span class='clj-nil'>nil</span>","value":"nil"}
;; <=
;; **
;;; ### Generate evaluation report
;; **
;; @@
(print-eval-report 100)
;; @@
;; ->
;;;
;;; | :date | :tot-value | :vol | :r-vol | :sharpe | :r-sharpe | :pnl-pt | :max-drawdown |
;;; |------------+------------+---------+---------+----------+-----------+---------+---------------|
;;; | 1991-01-08 | $1000 | 0.0000% | 0.0000% | 0.0000% | 0.0000% | $0 | 0.0000 |
;;; | 1991-01-09 | $999 | 0.0096% | 0.0096% | -1.7321% | -1.7321% | $0 | 0.0000 |
;;; | 1991-01-10 | $1000 | 0.0083% | 0.0083% | 0.4962% | 0.4962% | $0 | 0.0000 |
;;; | 1991-01-11 | $1000 | 0.0091% | 0.0091% | 1.3598% | 1.3598% | $0 | 302.1275 |
;;; | 1991-01-14 | $1000 | 0.0082% | 0.0082% | 1.5149% | 1.5149% | $0 | 302.1275 |
;;; | 1991-01-15 | $1000 | 0.0075% | 0.0075% | 1.6553% | 1.6553% | $0 | 302.1275 |
;;; | 1991-01-16 | $1000 | 0.0069% | 0.0069% | 1.7846% | 1.7846% | $0 | 302.1275 |
;;; | 1991-01-17 | $1001 | 0.0179% | 0.0179% | 3.4289% | 3.4289% | $0 | 134.0470 |
;;; | 1991-01-18 | $1002 | 0.0203% | 0.0203% | 5.0029% | 5.0029% | $1 | 134.0470 |
;;; | 1991-01-21 | $1002 | 0.0194% | 0.0194% | 6.0539% | 6.0539% | $1 | 134.0470 |
;;; | 1991-01-22 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-01-23 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-01-24 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-01-25 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-01-28 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-01-29 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-01-30 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-01-31 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-01 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-04 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-05 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-06 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-07 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-08 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-11 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-12 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-13 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-14 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-15 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-19 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-20 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-21 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-22 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-25 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-26 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-27 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-02-28 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-01 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-04 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-05 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-06 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-07 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-08 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-11 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-12 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-13 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-14 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-15 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-18 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-19 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-20 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-21 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-22 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-25 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-26 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-27 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-03-28 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-01 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-02 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-03 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-04 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-05 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-08 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-09 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-10 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-11 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-12 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-15 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-16 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-17 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-18 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-19 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-22 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-23 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-24 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-25 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-26 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-29 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-04-30 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-05-01 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-05-02 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-05-03 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-05-06 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-05-07 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-05-08 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-05-09 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-05-10 | $1001 | 0.0187% | 0.0187% | 4.5822% | 4.5822% | $0 | 134.0470 |
;;; | 1991-05-13 | $1001 | 0.0180% | 0.0180% | 4.7490% | 4.7490% | $0 | 134.0470 |
;;; | 1991-05-14 | $1001 | 0.0193% | 0.0193% | 3.1685% | 3.1685% | $0 | 149.8705 |
;;; | 1991-05-15 | $1001 | 0.0186% | 0.0186% | 3.2797% | 3.2797% | $0 | 149.8705 |
;;; | 1991-05-16 | $1001 | 0.0180% | 0.0180% | 3.7766% | 3.7766% | $0 | 149.8705 |
;;; | 1991-05-17 | $1001 | 0.0175% | 0.0175% | 3.8928% | 3.8928% | $0 | 149.8705 |
;;; | 1991-05-20 | $1001 | 0.0171% | 0.0171% | 4.6144% | 4.6144% | $0 | 149.8705 |
;;; | 1991-05-21 | $1001 | 0.0166% | 0.0166% | 4.7386% | 4.7386% | $0 | 149.8705 |
;;; | 1991-05-22 | $1000 | 0.0239% | 0.0239% | 0.1894% | 0.1894% | $0 | 251.3330 |
;;; | 1991-05-23 | $1000 | 0.0233% | 0.0233% | 0.1944% | 0.1944% | $0 | 251.3330 |
;;; | 1991-05-24 | $1000 | 0.0237% | 0.0237% | 1.5401% | 1.5401% | $0 | 251.3330 |
;;; | 1991-05-28 | $1003 | 0.0331% | 0.0331% | 4.5856% | 4.5856% | $0 | 164.3964 |
;;; | 1991-05-29 | $1002 | 0.0338% | 0.0338% | 3.2564% | 3.2564% | $0 | 164.3964 |
;;; | 1991-05-30 | $1002 | 0.0332% | 0.0332% | 2.9982% | 2.9982% | $0 | 164.3964 |
;;;
;; <-
;; =>
;;; {"type":"html","content":"<span class='clj-nil'>nil</span>","value":"nil"}
;; <=
;; **
;;; ### Plot variables
;; **
;; @@
(def data (deref portfolio-value))
;; @@
;; =>
;;; {"type":"html","content":"<span class='clj-var'>#'clojure-backtesting.updated_examples.goldencross/data</span>","value":"#'clojure-backtesting.updated_examples.goldencross/data"}
;; <=
;; @@
; Add legend name to series
(def data-to-plot
(map #(assoc % :plot "portfolio")
data))
;; @@
;; =>
;;; {"type":"html","content":"<span class='clj-var'>#'clojure-backtesting.updated_examples.goldencross/data-to-plot</span>","value":"#'clojure-backtesting.updated_examples.goldencross/data-to-plot"}
;; <=
;; @@
(first data-to-plot)
;; @@
;; =>
;;; {"type":"list-like","open":"<span class='clj-map'>{</span>","close":"<span class='clj-map'>}</span>","separator":", ","items":[{"type":"list-like","open":"","close":"","separator":" ","items":[{"type":"html","content":"<span class='clj-keyword'>:date</span>","value":":date"},{"type":"html","content":"<span class='clj-string'>"1990-12-21"</span>","value":"\"1990-12-21\""}],"value":"[:date \"1990-12-21\"]"},{"type":"list-like","open":"","close":"","separator":" ","items":[{"type":"html","content":"<span class='clj-keyword'>:tot-value</span>","value":":tot-value"},{"type":"html","content":"<span class='clj-long'>1000</span>","value":"1000"}],"value":"[:tot-value 1000]"},{"type":"list-like","open":"","close":"","separator":" ","items":[{"type":"html","content":"<span class='clj-keyword'>:daily-ret</span>","value":":daily-ret"},{"type":"html","content":"<span class='clj-double'>0.0</span>","value":"0.0"}],"value":"[:daily-ret 0.0]"},{"type":"list-like","open":"","close":"","separator":" ","items":[{"type":"html","content":"<span class='clj-keyword'>:tot-ret</span>","value":":tot-ret"},{"type":"html","content":"<span class='clj-double'>0.0</span>","value":"0.0"}],"value":"[:tot-ret 0.0]"},{"type":"list-like","open":"","close":"","separator":" ","items":[{"type":"html","content":"<span class='clj-keyword'>:loan</span>","value":":loan"},{"type":"html","content":"<span class='clj-double'>0.0</span>","value":"0.0"}],"value":"[:loan 0.0]"},{"type":"list-like","open":"","close":"","separator":" ","items":[{"type":"html","content":"<span class='clj-keyword'>:leverage</span>","value":":leverage"},{"type":"html","content":"<span class='clj-double'>0.0</span>","value":"0.0"}],"value":"[:leverage 0.0]"},{"type":"list-like","open":"","close":"","separator":" ","items":[{"type":"html","content":"<span class='clj-keyword'>:margin</span>","value":":margin"},{"type":"html","content":"<span class='clj-double'>0.0</span>","value":"0.0"}],"value":"[:margin 0.0]"},{"type":"list-like","open":"","close":"","separator":" ","items":[{"type":"html","content":"<span class='clj-keyword'>:plot</span>","value":":plot"},{"type":"html","content":"<span class='clj-string'>"portfolio"</span>","value":"\"portfolio\""}],"value":"[:plot \"portfolio\"]"}],"value":"{:date \"1990-12-21\", :tot-value 1000, :daily-ret 0.0, :tot-ret 0.0, :loan 0.0, :leverage 0.0, :margin 0.0, :plot \"portfolio\"}"}
;; <=
;; @@
(plot data-to-plot :plot :date :daily-ret true)
;; @@
;; ->
;;; [I 07:49:21.251 Clojupyter] oz.core:273 -- Starting up server on port 10666
;;; [I 07:49:21.554 Clojupyter] oz.server:142 -- Web server is running at `http://localhost:10666/`
;;;
;; <-
;; =>
;;; {"type":"html","content":"<span class='clj-nil'>nil</span>","value":"nil"}
;; <=