diff --git a/backend/backend/algorithms/custom_algos/template_algorithm.py b/backend/backend/algorithms/custom_algos/template_algorithm.py index 129bdf37..1be4ffe0 100644 --- a/backend/backend/algorithms/custom_algos/template_algorithm.py +++ b/backend/backend/algorithms/custom_algos/template_algorithm.py @@ -30,7 +30,9 @@ def log(msg): if len(byte_code.errors) != 0: log('COMPILE ERROR =====') for error in byte_code.errors: - log(error) + formatted_error = error.replace('"', "'") + log(formatted_error) + logger.close() return { 'done': True, 'success': False, diff --git a/frontend/angular-src/src/app/graph/graph.component.html b/frontend/angular-src/src/app/graph/graph.component.html index 62239b95..dc16b45a 100644 --- a/frontend/angular-src/src/app/graph/graph.component.html +++ b/frontend/angular-src/src/app/graph/graph.component.html @@ -31,7 +31,7 @@

{{ finalAlpha }}

- +
diff --git a/frontend/angular-src/src/app/graph/graph.component.ts b/frontend/angular-src/src/app/graph/graph.component.ts index e0b89cc6..d0a9b9d4 100644 --- a/frontend/angular-src/src/app/graph/graph.component.ts +++ b/frontend/angular-src/src/app/graph/graph.component.ts @@ -44,6 +44,7 @@ export class GraphComponent implements OnInit, OnDestroy { private code: string; public done: boolean; + public failed: boolean; public finalAlpha: number; private xaxis: string[]; @@ -63,6 +64,7 @@ export class GraphComponent implements OnInit, OnDestroy { private editor: EditorService, private scroll: ScrollToService) { this.done = false; + this.failed = false; this.logChannel = null; this.xaxis = []; this.dataset1 = []; @@ -213,8 +215,7 @@ export class GraphComponent implements OnInit, OnDestroy { else if (this.type === 'custom') { this.log = this.log.concat('Sending code for compilation, fingers crossed it works!', '\n', - `Trying to execute between ${this.start} to ${this.end}`, '\n', - 'If it takes a long time it probably failed (no failure msg yet) :(', '\n'); + `Executing backtest between ${this.start} to ${this.end}`, '\n'); this.extractDataFromAPI( this.editor.executeSrcCode(this.code, this.capitalBase, this.start, this.end, this.logChannel) @@ -247,6 +248,12 @@ export class GraphComponent implements OnInit, OnDestroy { return; } else if (!response.done) { return; + } else if (response.hasOwnProperty('success') && !response.success) { + this.failed = true; + if (this.ws) { + this.ws.close(); + } + return; } else { if (this.subscription) this.subscription.unsubscribe();