Skip to content

Commit b6480af

Browse files
authored
Merge pull request #73 from Artimatic/feature/923-autopilot
Feature/923 autopilot
2 parents c1026d0 + a6b8327 commit b6480af

13 files changed

+439
-315
lines changed

server/api/backtest/backtest.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ class BacktestService {
423423
}
424424
response.status(200).send(recommendation);
425425
})
426-
.catch((error) => {
426+
.catch(error => {
427+
console.log(error);
427428
response.status(500).send({ error });
428429
});
429430
}

src/app/ai-picks/ai-picks.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="ai-picks p-grid">
22
<div class="p-col">
33
<p-card header="Buys Predictions">
4-
<p-table [value]="buys">
4+
<p-table [value]="buys" [scrollable]="true" scrollHeight="200px">
55
<ng-template pTemplate="caption">
66
<p-button class="ui-button-danger" icon="pi pi-times" iconPos="right" label="Remove all"
77
(click)="removeAllBuys()"></p-button>
@@ -31,7 +31,7 @@
3131
</div>
3232
<div class="p-col">
3333
<p-card header="Sells Predictions">
34-
<p-table [value]="sells">
34+
<p-table [value]="sells" [scrollable]="true" scrollHeight="200px">
3535
<ng-template pTemplate="caption">
3636
<p-button class="ui-button-danger" icon="pi pi-times" iconPos="right" label="Remove all"
3737
(click)="removeAllSells()"></p-button>
@@ -59,7 +59,7 @@
5959
</p-table>
6060
</p-card>
6161
</div>
62-
<div class="p-col">
62+
<!-- <div class="p-col">
6363
<p-card header="Historical Predictions">
6464
<p-listbox [options]="history" [listStyle]="{'max-height':'250px'}">
6565
<p-header>
@@ -93,5 +93,5 @@ <h5>{{history.label}} <i class="pi pi-times" (click)="removeFromHistoryList(hist
9393
</ng-template>
9494
</p-listbox>
9595
</p-card>
96-
</div>
96+
</div> -->
9797
</div>

src/app/ai-picks/ai-picks.component.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,13 @@ export class AiPicksComponent implements OnInit, OnDestroy {
7777
}, 'aipicks', 300000);
7878
} else {
7979
const prediction = { algorithm: range, prediction: activation.nextOutput, accuracy: accuracy };
80-
console.log('activate prediction', prediction);
81-
if (prediction.prediction > 0.5 || prediction.prediction < 0.3) {
82-
if (isBuy) {
83-
this.addBuyPick(symbol, prediction);
84-
} else {
85-
this.addSellPick(symbol, prediction);
86-
}
80+
console.log('activate prediction', symbol, prediction);
81+
const item = this.createListObject(symbol, prediction);
82+
this.aiPicksService.mlNeutralResults.next(item);
83+
if (prediction.prediction > 0.5) {
84+
this.addBuyPick(symbol, prediction);
8785
} else {
88-
const item = this.createListObject(symbol, prediction);
89-
90-
this.aiPicksService.mlNeutralResults.next(item);
86+
this.addSellPick(symbol, prediction);
9187
}
9288

9389
this.schedulerService.schedule(() => {
@@ -96,8 +92,9 @@ export class AiPicksComponent implements OnInit, OnDestroy {
9692
}
9793
this.isLoading = false;
9894
}, error => {
95+
this.aiPicksService.mlNeutralResults.next(null);
9996
this.counter--;
100-
console.log('error: ', error);
97+
console.log('error on activation ', error);
10198
this.isLoading = false;
10299
});
103100
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<div class="autopilot-container">
2-
<p-avatar icon="pi pi-prime" styleClass="p-mr-2" size="xlarge" shape="circle" (click)="open()"></p-avatar>
2+
<p-avatar icon="pi pi-prime" styleClass="p-mr-2" size="large" shape="circle" (click)="open()"></p-avatar>
33
</div>
44

55
<p-dialog [(visible)]="display" [breakpoints]="{'960px': '75vw', '640px': '100vw'}" [style]="{width: '50vw'}"
66
[closable]="false">
77
<ng-template pTemplate="header">
88
<h3>Autopilot</h3>
9-
<p-inputSwitch [(ngModel)]="display"></p-inputSwitch>
9+
<p-tag [value]="strategyList[strategyCounter]" severity="success"></p-tag>
10+
<p-tag [value]="riskToleranceList[riskCounter]" severity="danger"></p-tag>
1011
</ng-template>
1112
<ng-template pTemplate="content">
1213
<div *ngIf="isLoading">
@@ -16,9 +17,7 @@ <h3>Autopilot</h3>
1617
<app-ai-picks></app-ai-picks>
1718
</ng-template>
1819
<ng-template pTemplate="footer">
19-
<label>Current strategy:&nbsp;</label>{{strategyList[strategyCounter]}}
2020
<p-button label="Next strategy" class="p-button-success" (click)="changeStrategy()" iconPos="left"></p-button>
21-
2221
<p-button label="Stop autopilot" class="p-button-danger" (click)="stop()" iconPos="left"></p-button>
2322
</ng-template>
2423
</p-dialog>

0 commit comments

Comments
 (0)