Skip to content

Commit ab07a36

Browse files
committed
Updated get instrument
1 parent cca89a2 commit ab07a36

File tree

5 files changed

+65
-1802
lines changed

5 files changed

+65
-1802
lines changed

server/api/portfolio/portfolio.service.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -785,9 +785,11 @@ class PortfolioService {
785785
getInstrument(cusip: string) {
786786
const accountId = this.getAccountId();
787787

788-
const query = `${tdaUrl}instruments/${cusip}`;
788+
//const query = `${tdaUrl}instruments/${cusip}`;
789+
const url = `${tdaUrl}instruments?symbol=${cusip}&projection=fundamental`;
790+
789791
const options = {
790-
uri: query,
792+
uri: url,
791793
qs: {
792794
apikey: this.tdaKey[accountId]
793795
},

src/app/autopilot/autopilot.component.ts

+26-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { MessageService } from 'primeng/api';
1313
import { AlgoQueueItem } from '@shared/services/trade.service';
1414
import { ScoringIndex } from '@shared/services/score-keeper.service';
1515
import { MachineDaytradingService } from '../machine-daytrading/machine-daytrading.service';
16-
import { BearList, PrimaryList, PersonalBullishPicks, PersonalBearishPicks } from '../rh-table/backtest-stocks.constant';
16+
import { BearList, PrimaryList, PersonalBullishPicks, PersonalBearishPicks, OldList } from '../rh-table/backtest-stocks.constant';
1717
import { AiPicksPredictionData } from '@shared/services/ai-picks.service';
1818
import Stocks from '../rh-table/backtest-stocks.constant';
1919
import { FindPatternService } from '../strategies/find-pattern.service';
@@ -1180,8 +1180,31 @@ export class AutopilotComponent implements OnInit, OnDestroy {
11801180
});
11811181
}
11821182

1183-
test() {
1184-
this.portfolioService.getInstrument('67066G104').subscribe((response) => {
1183+
async test() {
1184+
let counter = 0;
1185+
const newList = [];
1186+
while (counter < OldList.length) {
1187+
const stock = OldList[counter].ticker;
1188+
1189+
if (stock) {
1190+
this.schedulerService.schedule(async () => {
1191+
try {
1192+
const results = await this.portfolioService.getInstrument(stock).toPromise();
1193+
if (results[stock]) {
1194+
if (results[stock].fundamental.marketCap > 1900) {
1195+
newList.push(stock);
1196+
}
1197+
}
1198+
} catch (err) {
1199+
console.log(err);
1200+
}
1201+
}, `findTrades`, null, false, 60000);
1202+
}
1203+
1204+
counter++;
1205+
}
1206+
console.log(JSON.stringify(newList));
1207+
this.portfolioService.getInstrument('W').subscribe((response) => {
11851208
console.log('test123', response);
11861209
});
11871210
}

src/app/login/login.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
required></textarea>
1919
</div>
2020
<div class="p-inputgroup">
21-
<p-checkbox formControlName="saveToCookie" label="Save to Cookie" [binary]="true"></p-checkbox>
21+
<p-checkbox formControlName="saveToCookie" label="Save credentials" [binary]="true"></p-checkbox>
2222
</div>
2323
</div>
2424
<div>

0 commit comments

Comments
 (0)