Skip to content

Commit e1af6a0

Browse files
committed
Merge branch 'feature/923-autopilot' of https://github.com/Artimatic/robinhood-td-algorithmic-trading-in-angular into feature/923-autopilot
2 parents d720805 + acad8ca commit e1af6a0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/app/autopilot/autopilot.component.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -609,10 +609,17 @@ export class AutopilotComponent implements OnInit, OnDestroy {
609609
return null;
610610
}
611611

612+
async backtestList(cb = async (stock: string, mlResult: number) => { }, stockList: (PortfolioInfoHolding[] | any[]) = CurrentStockList) {
613+
614+
stockList.forEach(async (stock) => {
615+
const backtestResults = await this.backtestTableService.getBacktestData(stock.name);
616+
if (backtestResults) {
617+
cb(stock, backtestResults.ml);
618+
}
619+
});
620+
}
621+
612622
async findSwingtrades(cb = async (stock: string, mlResult: number) => { }, stockList: (PortfolioInfoHolding[] | any[]) = CurrentStockList) {
613-
if (stockList) {
614-
this.machineDaytradingService.setCurrentStockList(stockList);
615-
}
616623
let stock;
617624
const found = (name) => {
618625
return Boolean(this.currentHoldings.find((value) => value.name === name));
@@ -989,7 +996,7 @@ export class AutopilotComponent implements OnInit, OnDestroy {
989996
}
990997
};
991998

992-
this.findSwingtrades(callback, this.currentHoldings);
999+
this.backtestList(callback, this.currentHoldings);
9931000
}
9941001

9951002
async analyseRecommendations(holding: PortfolioInfoHolding) {

0 commit comments

Comments
 (0)