qc 0.5.6 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff30871c8e3cbbc76ca56e8486a54f1ecc6641b1
4
- data.tar.gz: 6d537c573492c6d28283fdfdf781ef2e85b099e1
3
+ metadata.gz: 5c22c9b2e8145ff0e939d3214848341e0782b3b2
4
+ data.tar.gz: 17b4c70a3a44993b71406d0994f45607734e70f4
5
5
  SHA512:
6
- metadata.gz: 7520488335e8ed3ebb1dd726c2721d4f5426b103c419d9e18ff15bb87711a3445dc2bc69de3f67ba09ec0739b70618c68aa935996eb9f9777cd34533e0821d0f
7
- data.tar.gz: 62cd3d02352a350b0258fcd335caa094cf21da8a92295c2b7cacdfcc33511b0eb50e080caeed35587270c4c336efd1de8877e5ecfd451017e59c33aed0dcb1c7
6
+ metadata.gz: 15e0d3601726a5df294eda0a402eec49e4667807e095dd03cfdb54050ed5c17097180dc6b3a90505c974372fd4ed85e32f0b2254c35c1b44f974f81446b6ce1a
7
+ data.tar.gz: c741d944839ae9b3f8d8f6abf86e7c7cc01d7ed9b79d9b6244b5703c142d90a09072d9aa64614111ee01a6cee3e02794f371353b72b6cacb35855e0201fc39fd
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qc (0.5.6)
4
+ qc (0.6.0)
5
5
  rest-client (~> 2.0.2)
6
6
  vcr (~> 3.0.3)
7
7
  webmock (~> 3.1.0)
data/README.md CHANGED
@@ -20,7 +20,20 @@ gem install qc
20
20
 
21
21
  ## Usage
22
22
 
23
+ ### Default (no command provided)
24
+
25
+ When no command is provided, it will push your changes to QuantConnect, compile the project and run a backtest.
26
+
27
+ ```shell
28
+ qc
29
+ qc --open # To open the results in QuantConnect
23
30
  ```
31
+
32
+ This is equivalent to executing `qc push`, `qc compile` and `qc backtest` in sequence.
33
+
34
+ ### Single commands
35
+
36
+ ```shell
24
37
  qc [command]
25
38
  ```
26
39
 
@@ -34,12 +47,18 @@ The supported commands are:
34
47
  | `qc push` | Send your local files to QuantConnect. It will only send the files that changed since the last time you run the command |
35
48
  | `qc compile` | Compile your project in QuantConnect |
36
49
  | `qc backtest` | Run the backtest of your algorithm in QuantConnect |
50
+ | `qc open` | Open the latest results in QuantConnect (only MacOS)|
51
+
52
+ ### Opening the results in QuantConnect (only MacOS)
37
53
 
38
- When no command is provided, it will execute `push`, `compile` and `backtest` in sequence.
54
+ If you pass `--open` when running a backtest, it will open the results in QuantConnect while the backtest is running:
39
55
 
40
- ## Todo
56
+ ```shell
57
+ qc --open
58
+ qc backtest --open
59
+ ```
41
60
 
42
- - Open your backtests after they have finished
61
+ **This option only works on MacOS**. quantconnect.com currently doesn't offer an URL endpoint to open backtest results. In MacOS, it will use an Automator workflow that will open the project and show its latest results by simulating a click on the corresponding option. See [this discussion](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/lean-engine/7AiEl3RVv38/PGnFQzBXAQAJ).
43
62
 
44
63
  ## Development
45
64
 
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleName</key>
6
+ <string>open-qc-results</string>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,435 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>AMApplicationBuild</key>
6
+ <string>444.1</string>
7
+ <key>AMApplicationVersion</key>
8
+ <string>2.8</string>
9
+ <key>AMDocumentVersion</key>
10
+ <string>2</string>
11
+ <key>actions</key>
12
+ <array>
13
+ <dict>
14
+ <key>action</key>
15
+ <dict>
16
+ <key>AMAccepts</key>
17
+ <dict>
18
+ <key>Container</key>
19
+ <string>List</string>
20
+ <key>Optional</key>
21
+ <true/>
22
+ <key>Types</key>
23
+ <array>
24
+ <string>com.apple.cocoa.string</string>
25
+ </array>
26
+ </dict>
27
+ <key>AMActionVersion</key>
28
+ <string>2.0.3</string>
29
+ <key>AMApplication</key>
30
+ <array>
31
+ <string>Automator</string>
32
+ </array>
33
+ <key>AMParameterProperties</key>
34
+ <dict>
35
+ <key>COMMAND_STRING</key>
36
+ <dict/>
37
+ <key>CheckedForUserDefaultShell</key>
38
+ <dict/>
39
+ <key>inputMethod</key>
40
+ <dict/>
41
+ <key>shell</key>
42
+ <dict/>
43
+ <key>source</key>
44
+ <dict/>
45
+ </dict>
46
+ <key>AMProvides</key>
47
+ <dict>
48
+ <key>Container</key>
49
+ <string>List</string>
50
+ <key>Types</key>
51
+ <array>
52
+ <string>com.apple.cocoa.string</string>
53
+ </array>
54
+ </dict>
55
+ <key>ActionBundlePath</key>
56
+ <string>/System/Library/Automator/Run Shell Script.action</string>
57
+ <key>ActionName</key>
58
+ <string>Run Shell Script</string>
59
+ <key>ActionParameters</key>
60
+ <dict>
61
+ <key>COMMAND_STRING</key>
62
+ <string>url = "https://www.quantconnect.com/terminal/#open/#{ARGV[0]}"
63
+ system "open -a Safari '#{url}'"</string>
64
+ <key>CheckedForUserDefaultShell</key>
65
+ <true/>
66
+ <key>inputMethod</key>
67
+ <integer>1</integer>
68
+ <key>shell</key>
69
+ <string>/usr/bin/ruby</string>
70
+ <key>source</key>
71
+ <string></string>
72
+ </dict>
73
+ <key>BundleIdentifier</key>
74
+ <string>com.apple.RunShellScript</string>
75
+ <key>CFBundleVersion</key>
76
+ <string>2.0.3</string>
77
+ <key>CanShowSelectedItemsWhenRun</key>
78
+ <false/>
79
+ <key>CanShowWhenRun</key>
80
+ <true/>
81
+ <key>Category</key>
82
+ <array>
83
+ <string>AMCategoryUtilities</string>
84
+ </array>
85
+ <key>Class Name</key>
86
+ <string>RunShellScriptAction</string>
87
+ <key>InputUUID</key>
88
+ <string>803207A7-9E90-4479-8038-63F8CF7B7B10</string>
89
+ <key>Keywords</key>
90
+ <array>
91
+ <string>Shell</string>
92
+ <string>Script</string>
93
+ <string>Command</string>
94
+ <string>Run</string>
95
+ <string>Unix</string>
96
+ </array>
97
+ <key>OutputUUID</key>
98
+ <string>4E28DFAE-BD6B-4084-833B-27E1A8669878</string>
99
+ <key>UUID</key>
100
+ <string>8EFDAC89-B363-45F0-9074-E09474C526E7</string>
101
+ <key>UnlocalizedApplications</key>
102
+ <array>
103
+ <string>Automator</string>
104
+ </array>
105
+ <key>arguments</key>
106
+ <dict>
107
+ <key>0</key>
108
+ <dict>
109
+ <key>default value</key>
110
+ <integer>0</integer>
111
+ <key>name</key>
112
+ <string>inputMethod</string>
113
+ <key>required</key>
114
+ <string>0</string>
115
+ <key>type</key>
116
+ <string>0</string>
117
+ <key>uuid</key>
118
+ <string>0</string>
119
+ </dict>
120
+ <key>1</key>
121
+ <dict>
122
+ <key>default value</key>
123
+ <string></string>
124
+ <key>name</key>
125
+ <string>source</string>
126
+ <key>required</key>
127
+ <string>0</string>
128
+ <key>type</key>
129
+ <string>0</string>
130
+ <key>uuid</key>
131
+ <string>1</string>
132
+ </dict>
133
+ <key>2</key>
134
+ <dict>
135
+ <key>default value</key>
136
+ <false/>
137
+ <key>name</key>
138
+ <string>CheckedForUserDefaultShell</string>
139
+ <key>required</key>
140
+ <string>0</string>
141
+ <key>type</key>
142
+ <string>0</string>
143
+ <key>uuid</key>
144
+ <string>2</string>
145
+ </dict>
146
+ <key>3</key>
147
+ <dict>
148
+ <key>default value</key>
149
+ <string></string>
150
+ <key>name</key>
151
+ <string>COMMAND_STRING</string>
152
+ <key>required</key>
153
+ <string>0</string>
154
+ <key>type</key>
155
+ <string>0</string>
156
+ <key>uuid</key>
157
+ <string>3</string>
158
+ </dict>
159
+ <key>4</key>
160
+ <dict>
161
+ <key>default value</key>
162
+ <string>/bin/sh</string>
163
+ <key>name</key>
164
+ <string>shell</string>
165
+ <key>required</key>
166
+ <string>0</string>
167
+ <key>type</key>
168
+ <string>0</string>
169
+ <key>uuid</key>
170
+ <string>4</string>
171
+ </dict>
172
+ </dict>
173
+ <key>isViewVisible</key>
174
+ <true/>
175
+ <key>location</key>
176
+ <string>1089.000000:185.000000</string>
177
+ <key>nibPath</key>
178
+ <string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/English.lproj/main.nib</string>
179
+ </dict>
180
+ <key>isViewVisible</key>
181
+ <true/>
182
+ </dict>
183
+ <dict>
184
+ <key>action</key>
185
+ <dict>
186
+ <key>AMAccepts</key>
187
+ <dict>
188
+ <key>Container</key>
189
+ <string>List</string>
190
+ <key>Optional</key>
191
+ <true/>
192
+ <key>Types</key>
193
+ <array/>
194
+ </dict>
195
+ <key>AMActionVersion</key>
196
+ <string>2.0.2</string>
197
+ <key>AMApplication</key>
198
+ <array>
199
+ <string>Automator</string>
200
+ </array>
201
+ <key>AMParameterProperties</key>
202
+ <dict>
203
+ <key>pauseDuration</key>
204
+ <dict/>
205
+ <key>pauseUnit</key>
206
+ <dict/>
207
+ </dict>
208
+ <key>AMProvides</key>
209
+ <dict>
210
+ <key>Container</key>
211
+ <string>List</string>
212
+ <key>Types</key>
213
+ <array/>
214
+ </dict>
215
+ <key>ActionBundlePath</key>
216
+ <string>/System/Library/Automator/Pause.action</string>
217
+ <key>ActionName</key>
218
+ <string>Pause</string>
219
+ <key>ActionParameters</key>
220
+ <dict>
221
+ <key>pauseDuration</key>
222
+ <integer>6</integer>
223
+ <key>pauseUnit</key>
224
+ <integer>0</integer>
225
+ </dict>
226
+ <key>BundleIdentifier</key>
227
+ <string>com.apple.Automator.Pause</string>
228
+ <key>CFBundleVersion</key>
229
+ <string>2.0.2</string>
230
+ <key>CanShowSelectedItemsWhenRun</key>
231
+ <true/>
232
+ <key>CanShowWhenRun</key>
233
+ <false/>
234
+ <key>Category</key>
235
+ <array>
236
+ <string>AMCategoryUtilities</string>
237
+ </array>
238
+ <key>Class Name</key>
239
+ <string>PauseAction</string>
240
+ <key>InputUUID</key>
241
+ <string>13F8393F-3AE0-485C-BC50-9947DD89D9A6</string>
242
+ <key>Keywords</key>
243
+ <array>
244
+ <string>Time</string>
245
+ <string>Wait</string>
246
+ </array>
247
+ <key>OutputUUID</key>
248
+ <string>6B821AB3-A83C-4993-AA7A-458495D3BD1C</string>
249
+ <key>UUID</key>
250
+ <string>37995717-CB54-44AC-BBC1-688255F6E471</string>
251
+ <key>UnlocalizedApplications</key>
252
+ <array>
253
+ <string>Automator</string>
254
+ </array>
255
+ <key>arguments</key>
256
+ <dict>
257
+ <key>0</key>
258
+ <dict>
259
+ <key>default value</key>
260
+ <integer>0</integer>
261
+ <key>name</key>
262
+ <string>pauseUnit</string>
263
+ <key>required</key>
264
+ <string>0</string>
265
+ <key>type</key>
266
+ <string>0</string>
267
+ <key>uuid</key>
268
+ <string>0</string>
269
+ </dict>
270
+ <key>1</key>
271
+ <dict>
272
+ <key>default value</key>
273
+ <integer>0</integer>
274
+ <key>name</key>
275
+ <string>pauseDuration</string>
276
+ <key>required</key>
277
+ <string>0</string>
278
+ <key>type</key>
279
+ <string>0</string>
280
+ <key>uuid</key>
281
+ <string>1</string>
282
+ </dict>
283
+ </dict>
284
+ <key>isViewVisible</key>
285
+ <true/>
286
+ <key>location</key>
287
+ <string>1089.000000:290.000000</string>
288
+ <key>nibPath</key>
289
+ <string>/System/Library/Automator/Pause.action/Contents/Resources/Base.lproj/main.nib</string>
290
+ </dict>
291
+ <key>isViewVisible</key>
292
+ <true/>
293
+ </dict>
294
+ <dict>
295
+ <key>action</key>
296
+ <dict>
297
+ <key>AMAccepts</key>
298
+ <dict>
299
+ <key>Container</key>
300
+ <string>List</string>
301
+ <key>Optional</key>
302
+ <true/>
303
+ <key>Types</key>
304
+ <array>
305
+ <string>com.apple.applescript.object</string>
306
+ </array>
307
+ </dict>
308
+ <key>AMActionVersion</key>
309
+ <string>1.0.2</string>
310
+ <key>AMApplication</key>
311
+ <array>
312
+ <string>Automator</string>
313
+ </array>
314
+ <key>AMParameterProperties</key>
315
+ <dict>
316
+ <key>source</key>
317
+ <dict/>
318
+ </dict>
319
+ <key>AMProvides</key>
320
+ <dict>
321
+ <key>Container</key>
322
+ <string>List</string>
323
+ <key>Types</key>
324
+ <array>
325
+ <string>com.apple.applescript.object</string>
326
+ </array>
327
+ </dict>
328
+ <key>ActionBundlePath</key>
329
+ <string>/System/Library/Automator/Run AppleScript.action</string>
330
+ <key>ActionName</key>
331
+ <string>Run AppleScript</string>
332
+ <key>ActionParameters</key>
333
+ <dict>
334
+ <key>source</key>
335
+ <string>tell application "Safari"
336
+ do JavaScript "$('.algorithm-menu-row:first').click()" in document 1
337
+ end tell</string>
338
+ </dict>
339
+ <key>BundleIdentifier</key>
340
+ <string>com.apple.Automator.RunScript</string>
341
+ <key>CFBundleVersion</key>
342
+ <string>1.0.2</string>
343
+ <key>CanShowSelectedItemsWhenRun</key>
344
+ <false/>
345
+ <key>CanShowWhenRun</key>
346
+ <true/>
347
+ <key>Category</key>
348
+ <array>
349
+ <string>AMCategoryUtilities</string>
350
+ </array>
351
+ <key>Class Name</key>
352
+ <string>RunScriptAction</string>
353
+ <key>InputUUID</key>
354
+ <string>4052A4D4-F223-4FB2-96DE-291ADC6AB13F</string>
355
+ <key>Keywords</key>
356
+ <array>
357
+ <string>Run</string>
358
+ </array>
359
+ <key>OutputUUID</key>
360
+ <string>38B7583B-A6D8-4665-84A6-776F0AB2202A</string>
361
+ <key>UUID</key>
362
+ <string>AE4AD43D-277C-4949-88AC-D594E6A469C1</string>
363
+ <key>UnlocalizedApplications</key>
364
+ <array>
365
+ <string>Automator</string>
366
+ </array>
367
+ <key>arguments</key>
368
+ <dict>
369
+ <key>0</key>
370
+ <dict>
371
+ <key>default value</key>
372
+ <string>on run {input, parameters}
373
+
374
+ (* Your script goes here *)
375
+
376
+ return input
377
+ end run</string>
378
+ <key>name</key>
379
+ <string>source</string>
380
+ <key>required</key>
381
+ <string>0</string>
382
+ <key>type</key>
383
+ <string>0</string>
384
+ <key>uuid</key>
385
+ <string>0</string>
386
+ </dict>
387
+ </dict>
388
+ <key>isViewVisible</key>
389
+ <true/>
390
+ <key>location</key>
391
+ <string>1089.000000:536.000000</string>
392
+ <key>nibPath</key>
393
+ <string>/System/Library/Automator/Run AppleScript.action/Contents/Resources/Base.lproj/main.nib</string>
394
+ </dict>
395
+ <key>isViewVisible</key>
396
+ <true/>
397
+ </dict>
398
+ </array>
399
+ <key>connectors</key>
400
+ <dict>
401
+ <key>9CB01A8F-420B-4B46-BE6C-FC0DFBBC4554</key>
402
+ <dict>
403
+ <key>from</key>
404
+ <string>8EFDAC89-B363-45F0-9074-E09474C526E7 - 8EFDAC89-B363-45F0-9074-E09474C526E7</string>
405
+ <key>to</key>
406
+ <string>37995717-CB54-44AC-BBC1-688255F6E471 - 37995717-CB54-44AC-BBC1-688255F6E471</string>
407
+ </dict>
408
+ <key>CF91E606-48EE-4B06-9063-07F6EF82AEE4</key>
409
+ <dict>
410
+ <key>from</key>
411
+ <string>37995717-CB54-44AC-BBC1-688255F6E471 - 37995717-CB54-44AC-BBC1-688255F6E471</string>
412
+ <key>to</key>
413
+ <string>AE4AD43D-277C-4949-88AC-D594E6A469C1 - AE4AD43D-277C-4949-88AC-D594E6A469C1</string>
414
+ </dict>
415
+ </dict>
416
+ <key>variables</key>
417
+ <array>
418
+ <dict>
419
+ <key>UUID</key>
420
+ <string>444BF03B-11E2-45A9-BB12-8F841BFAB582</string>
421
+ <key>identifier</key>
422
+ <string>com.apple.Automator.Variable.Text</string>
423
+ <key>name</key>
424
+ <string>Text</string>
425
+ <key>value</key>
426
+ <string>Text</string>
427
+ </dict>
428
+ </array>
429
+ <key>workflowMetaData</key>
430
+ <dict>
431
+ <key>workflowTypeIdentifier</key>
432
+ <string>com.apple.Automator.workflow</string>
433
+ </dict>
434
+ </dict>
435
+ </plist>
@@ -2,16 +2,17 @@ module Qc
2
2
  class CommandRunner
3
3
  DEFAULT_FILE_EXTENSIONS = 'cs,py'
4
4
 
5
- SUPPORTED_COMMANDS =%i(login logout init push compile backtest)
5
+ SUPPORTED_COMMANDS =%i(login logout init push compile backtest open)
6
6
  COMPILE_POLLING_DELAY_IN_SECONDS = 2
7
7
  BACKTEST_DELAY_IN_SECONDS = 3
8
8
 
9
- attr_reader :quant_connect_proxy
9
+ attr_reader :quant_connect_proxy, :options
10
10
  attr_accessor :project_settings
11
11
 
12
- def initialize(quant_connect_proxy)
12
+ def initialize(quant_connect_proxy, options = OpenStruct.new)
13
13
  @quant_connect_proxy = quant_connect_proxy
14
14
  @project_settings = read_project_settings
15
+ @options = options
15
16
  end
16
17
 
17
18
  def run(command)
@@ -102,7 +103,7 @@ module Qc
102
103
  end
103
104
 
104
105
  def run_push
105
- show_title('Push files')
106
+ show_title 'Push files'
106
107
 
107
108
  return false unless validate_initialized_project!
108
109
 
@@ -112,7 +113,7 @@ module Qc
112
113
  end
113
114
 
114
115
  def run_compile
115
- show_title('Compile')
116
+ show_title 'Compile'
116
117
  return false unless validate_initialized_project!
117
118
 
118
119
  compile = quant_connect_proxy.create_compile project_settings.project_id
@@ -134,7 +135,7 @@ module Qc
134
135
  end
135
136
 
136
137
  def run_backtest
137
- show_title('Run backtest')
138
+ show_title 'Run backtest'
138
139
  return false unless validate_initialized_project!
139
140
 
140
141
  unless project_settings.last_compile_id
@@ -145,6 +146,21 @@ module Qc
145
146
  do_run_backtest
146
147
  end
147
148
 
149
+ def run_open
150
+ show_title 'Open backtest results'
151
+ return open_results_in_quant_connect
152
+ end
153
+
154
+ def open_results_in_quant_connect
155
+ return false unless validate_initialized_project!
156
+ return false unless validate_on_mac!
157
+
158
+ open_workflow_file = ::File.expand_path ::File.join(__dir__, '..', '..', 'automator', 'open-qc-results.workflow')
159
+ open_command = "automator -i #{project_settings.project_id} #{open_workflow_file}"
160
+ puts "Opening backtest results for project #{project_settings.project_id}"
161
+ system open_command
162
+ end
163
+
148
164
  def do_run_default
149
165
  return false unless validate_initialized_project!
150
166
 
@@ -165,6 +181,7 @@ module Qc
165
181
  def do_run_backtest
166
182
  backtest = quant_connect_proxy.create_backtest project_settings.project_id, project_settings.last_compile_id, "backtest-#{project_settings.last_compile_id}"
167
183
  puts "Backtest for compile #{project_settings.last_compile_id} sent to the queue with id #{backtest.id}"
184
+ open_results_in_quant_connect if options.open_results
168
185
 
169
186
  begin
170
187
  if backtest.started?
@@ -259,6 +276,16 @@ module Qc
259
276
  initialized_project?
260
277
  end
261
278
 
279
+ def validate_on_mac!
280
+ puts "This command is only supported in macos" unless macos?
281
+ macos?
282
+ end
283
+
284
+ def macos?
285
+ host_os = RbConfig::CONFIG['host_os']
286
+ host_os =~ /darwin|mac os/
287
+ end
288
+
262
289
  def initialized_project?
263
290
  project_settings.project_id
264
291
  end
@@ -4,10 +4,10 @@ module Qc
4
4
  end
5
5
 
6
6
  def run(argv)
7
- options = parse_options(argv)
7
+ parsed_options = parse_options(argv)
8
8
 
9
9
  command = argv[0]
10
- client = Qc::CommandRunner.new(quant_connect_proxy)
10
+ client = Qc::CommandRunner.new(quant_connect_proxy, parsed_options)
11
11
  success = begin
12
12
  if command
13
13
  client.run(command.to_sym)
@@ -29,31 +29,35 @@ module Qc
29
29
  end
30
30
 
31
31
  def parse_options(args)
32
- options = OpenStruct.new
32
+ parsed_options = OpenStruct.new
33
33
 
34
- opt_parser = OptionParser.new do |opts|
35
- opts.banner = "Usage: qc [command] [options]"
34
+ opt_parser = OptionParser.new do |options|
35
+ options.banner = "Usage: qc [command] [options]"
36
36
 
37
- opts.separator ""
38
- opts.separator "Supported commands: #{Qc::CommandRunner::SUPPORTED_COMMANDS.join(', ')}"
39
- opts.separator "When no command provided it will execute: 'push compile backtest' in sequence"
37
+ options.separator ""
38
+ options.separator "Supported commands: #{Qc::CommandRunner::SUPPORTED_COMMANDS.join(', ')}"
39
+ options.separator "When no command provided it will execute: 'push compile backtest' in sequence"
40
40
 
41
- opts.separator ""
42
- opts.separator "Common options:"
41
+ options.separator ""
42
+ options.separator "Common options:"
43
43
 
44
- opts.on("-h", "--help", "Show this message") do
45
- puts opts
44
+ options.on("-o", "--open", "Open backtest results in QuantConnect. Only for `qc` or `qc backtest` commands.") do
45
+ parsed_options.open_results = true
46
+ end
47
+
48
+ options.on("-h", "--help", "Show this message") do
49
+ puts options
46
50
  exit 0
47
51
  end
48
52
 
49
- opts.on("--version", "Show version") do
53
+ options.on("--version", "Show version") do
50
54
  puts Qc::VERSION
51
55
  exit 0
52
56
  end
53
57
  end
54
58
 
55
59
  opt_parser.parse!(args)
56
- options
60
+ parsed_options
57
61
  end
58
62
  end
59
63
  end
@@ -74,13 +74,14 @@ module Qc
74
74
  def read_backtest(project_id, backtest_id)
75
75
  response = perform_request :get, '/backtests/read', params: {projectId: project_id, compileId: backtest_id}
76
76
  validate_response! response
77
- create_backtest_from_json_response(OpenStruct.new({success: response.success}.merge(response.backtests[0])))
77
+ found_backtest_json = response.backtests.find{|backtest_json| backtest_json['backtestId'] == backtest_id}
78
+ create_backtest_from_json_response(OpenStruct.new({success: response.success}.merge(found_backtest_json)))
78
79
  end
79
80
 
80
81
  private
81
82
 
82
83
  def create_backtest_from_json_response(response)
83
- Qc::Backtest.new(response.backtestId, response.name, response.completed, response.progres.to_f, response.result, response.success)
84
+ Qc::Backtest.new(response.backtestId, response.name, response.completed, response.progress.to_f, response.result, response.success)
84
85
  end
85
86
 
86
87
  def create_compile_from_json_response(response)
@@ -1,3 +1,3 @@
1
1
  module Qc
2
- VERSION = "0.5.6"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Manrubia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-13 00:00:00.000000000 Z
11
+ date: 2017-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -124,6 +124,9 @@ files:
124
124
  - LICENSE.txt
125
125
  - README.md
126
126
  - Rakefile
127
+ - automator/open-qc-results.workflow/Contents/Info.plist
128
+ - automator/open-qc-results.workflow/Contents/QuickLook/Preview.png
129
+ - automator/open-qc-results.workflow/Contents/document.wflow
127
130
  - bin/console
128
131
  - bin/qc
129
132
  - bin/setup