1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "mode": "stockConsensus",
12 "tickers": [
13 "AAPL"
14 ],
15 "analysts": [],
16 "searchQuery": "",
17 "maxItems": 2,
18 "ratingPosition": "all",
19 "includeAiAnalysts": false,
20 "ratingAction": "all",
21 "newsSentiment": "all",
22 "newsContent": "all",
23 "transactionType": "all",
24 "minTransactionValue": 0,
25 "positionAction": "all",
26 "minPositionValue": 0,
27 "marketCountry": "United States",
28 "sector": "Any",
29 "analystConsensus": "Any",
30 "priceTargetUpside": "Any",
31 "marketCapBucket": "Any",
32 "dividendYield": "Any",
33 "peRatio": "Any",
34 "includeSecondaryListings": false,
35 "exchange": "All US primary exchanges",
36 "earningsDate": "Any",
37 "sortBy": "Market Cap",
38 "sortDirection": "Descending",
39 "pageSize": 100
40};
41
42
43const run = await client.actor("nimbryxo-studio/yahoo-finance-analyst-ratings-and-consensus").call(input);
44
45
46console.log('Results from dataset');
47console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
48const { items } = await client.dataset(run.defaultDatasetId).listItems();
49items.forEach((item) => {
50 console.dir(item);
51});
52
53