Skip to content

Commit 3294de6

Browse files
committed
Fixed stop time
1 parent 3ed0577 commit 3294de6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/app/autopilot/autopilot.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ export class AutopilotComponent implements OnInit, OnDestroy {
177177
.pipe(takeUntil(this.destroy$))
178178
.subscribe(() => {
179179
const startStopTime = this.getStartStopTime();
180-
if (moment().isAfter(moment(startStopTime.endDateTime)) &&
181-
moment().isBefore(moment(startStopTime.endDateTime).add(5, 'minutes'))) {
180+
if (moment().isAfter(moment(startStopTime.endDateTime).subtract(15, 'minutes')) &&
181+
moment().isBefore(moment(startStopTime.endDateTime))) {
182182
console.log('Stopping');
183183

184184
if (this.reportingService.logs.length > 0) {
@@ -227,7 +227,7 @@ export class AutopilotComponent implements OnInit, OnDestroy {
227227
};
228228
sessionStorage.setItem('profitLoss', JSON.stringify(profitObj));
229229
}
230-
230+
231231
stop() {
232232
this.display = false;
233233
this.timer.unsubscribe();
@@ -352,7 +352,7 @@ export class AutopilotComponent implements OnInit, OnDestroy {
352352
let trainingResults = null;
353353
try {
354354
trainingResults = await this.machineDaytradingService.trainStock(stock, backtestDate.subtract({ days: 1 }).format('YYYY-MM-DD'), backtestDate.add({ days: 1 }).format('YYYY-MM-DD'));
355-
} catch(error) {
355+
} catch (error) {
356356
console.log('error getting traing results ', error);
357357
}
358358
console.log('training daytrade results ', trainingResults);

0 commit comments

Comments
 (0)