boosted.api.graphql_queries
1GET_SEC_INFO_QRY = """ 2query GetSecurities($ids: [Int!]) { 3 securities(ids: $ids) { 4 gbiId 5 symbol 6 name 7 isin 8 currency 9 country 10 sector { 11 name 12 topParentName 13 } 14 } 15} 16""" 17 18# watch for changes here: 19# https://github.com/GBI-Core/boosted-insights-web-server/blob/master/src/main/resources/graphql/watchlist.graphqls#L1 # noqa 20WATCHLIST_ANALYSIS_QRY = """ 21query WatchlistAnalysis( 22 $modelIds: [ID!] 23 $portfolioIds: [ID!] 24 $gbiIds: [Int] 25 $date: String! 26) { 27 watchlistAnalysis( 28 modelIds: $modelIds 29 portfolioIds: $portfolioIds 30 gbiIds: $gbiIds 31 minDate: $date 32 maxDate: $date 33 ) { 34 ...AnalysisFragment 35 ...ExplainWeightsFragment 36 } 37} 38 39fragment AnalysisFragment on WatchlistAnalysis { 40 gbiId 41 analysisDates { 42 date 43 aggregateSignal { 44 rating 45 ratingDelta 46 } 47 portfoliosSignals { 48 portfolioId 49 rank 50 signalDelta 51 rating 52 ratingDelta 53 } 54 } 55} 56 57 58fragment ExplainWeightsFragment on WatchlistAnalysis { 59 gbiId 60 analysisDates { 61 date 62 portfoliosSignals { 63 explainWeightNeg 64 explainWeightPos 65 } 66 } 67} 68""" 69 70GET_MODELS_FOR_PORTFOLIOS_QRY = """ 71query GetPortfoliosAndModels($ids: [ID!]) { 72 portfolios(ids: $ids) { 73 id 74 name 75 modelId 76 modelName 77 } 78} 79""" 80 81GET_EXCESS_RETURN_QRY = """ 82query GetExcessReturn($modelIds: [ID!], $gbiIds: [Int], $date: String!) { 83 models(ids: $modelIds) { 84 id 85 equityExplorerData(date: $date, gbiIds: $gbiIds) { 86 equityExplorerSummaryStatistics { 87 gbiId 88 ER { 89 SP { 90 sixMonthWindowOneMonthHorizon 91 } 92 } 93 } 94 } 95 } 96} 97""" 98 99 100GET_IDEAS_QUERY = """ 101query GetRecommendations( 102 $modelId: ID! 103 $portfolioId: ID! 104 $horizon: String! 105 $deltaHorizon: String! 106 $startDate: String! 107 $endDate: String! 108 $marketDataDate: String! 109 ) { 110 recommendations( 111 modelId: $modelId 112 portfolioId: $portfolioId 113 horizon: $horizon 114 deltaHorizon: $deltaHorizon 115 startDate: $startDate 116 endDate: $endDate 117 marketDataDate: $marketDataDate 118 ) { 119 mainCategories 120 missingRecommendations { 121 category 122 missingReason 123 } 124 recommendations { 125 category 126 dividendYield 127 reason 128 rating 129 ratingDelta 130 risk { 131 text 132 } 133 reward { 134 text 135 } 136 ER { 137 oneMonth 138 threeMonth 139 oneYear 140 } 141 security { 142 symbol 143 gbiId 144 } 145 } 146 } 147 } 148""" 149 150""" 151reasons { 152 type 153 text 154}""" 155 156STOCK_RECOMMENDATION_QUERY = """ 157 query StockRecommendation( 158 $modelId: ID! 159 $portfolioId: ID! 160 $gbiId: Int! 161 $horizon: String! 162 $date: String! 163 ) { 164 stockRecommendation( 165 modelId: $modelId 166 portfolioId: $portfolioId 167 gbiId: $gbiId 168 horizon: $horizon 169 date: $date 170 ) { 171 ER { 172 oneMonth 173 threeMonth 174 oneYear 175 } 176 rewardCategories { 177 rank 178 category 179 } 180 riskCategories { 181 rank 182 category 183 } 184 reasons { 185 type 186 text 187 arrows 188 } 189 recommendation 190 rewardCategory 191 riskCategory 192 } 193 } 194""" 195 196MULTI_STOCK_RECOMMENDATION_QUERY = """ 197 query StocksRecommendations( 198 $gbiIds: [Int!] 199 $strategyId: ID! 200 ) { 201 currentRecommendationsFull( 202 strategyId: $strategyId 203 gbiIds: $gbiIds 204 ) { 205 gbiId 206 recommendation1M { 207 currentCategory 208 ER { 209 oneMonth 210 threeMonth 211 oneYear 212 } 213 reward { 214 text 215 } 216 risk { 217 text 218 } 219 reasons { 220 type 221 text 222 } 223 } 224 recommendation3M { 225 currentCategory 226 ER { 227 oneMonth 228 threeMonth 229 oneYear 230 } 231 reward { 232 text 233 } 234 risk { 235 text 236 } 237 reasons { 238 type 239 text 240 } 241 } 242 recommendation1Y { 243 currentCategory 244 ER { 245 oneMonth 246 threeMonth 247 oneYear 248 } 249 reward { 250 text 251 } 252 risk { 253 text 254 } 255 reasons { 256 type 257 text 258 } 259 } 260 } 261 } 262""" 263 264PF_HOLDING_QUERY = """ 265query getPortfolioHoldings( 266 $date: String! 267 $modelId: ID! 268 $portfolioId: ID! 269) { 270 portfolioHoldings ( 271 date: $date 272 modelId: $modelId 273 portfolioId: $portfolioId 274 ) { 275 security { 276 symbol 277 } 278 gbiId 279 } 280} 281""" 282 283GET_PORTFOLIO_RELATIVE_DATES_QUERY = """ 284query GetPortfolioRelativeDates( 285 $portfolioId: ID! 286 $relativePeriods: [String!] 287 ) { 288 portfolio(id: $portfolioId) { 289 relativeDates(relativePeriods: $relativePeriods) { 290 period 291 date 292 } 293 } 294 } 295""" 296 297GET_PORTFOLIO_FACTOR_ATTRIBUTION_QUERY = """ 298query getPortfolioFactorAttribution($portfolioId: ID!, $startDate: String, $endDate: String) { 299 portfolio(id: $portfolioId) { 300 factorAttribution(startDate: $startDate, endDate: $endDate) { 301 dates 302 portfolioFactorPerformance { 303 name 304 data 305 } 306 factorBetas { 307 name 308 data 309 } 310 factorReturns { 311 name 312 data 313 } 314 } 315 } 316 } 317""" 318 319GET_MODEL_STOCK_UNIVERSE_ID_QUERY = """ 320query getModelStockUniverseId($modelId: ID!) { 321 model(id: $modelId) { 322 stockUniverseId 323 } 324} 325""" 326 327GET_PROS_CONS_QUERY = """ 328query GetProsCons($gbiIds: [Int!]!) { 329 bulkSecurityProsCons(gbiIds: $gbiIds) { 330 gbiId 331 pros { 332 summary 333 details 334 } 335 cons { 336 summary 337 details 338 } 339 } 340} 341""" 342 343GET_MARKET_TRENDS_UNIVERSES_QUERY = """ 344query getMarketTrendsUniverses { 345 getMarketTrendsUniverses { 346 id 347 name 348 } 349} 350""" 351 352 353GENERATE_THEME_QUERY = """ 354mutation generateTheme($input: GenerateThemeInput!) { 355 generateTheme(input: $input) { 356 success 357 themeId 358 } 359 } 360""" 361 362 363GET_STOCK_NEWS_QUERY = """ 364query getStockNews($gbiId: Int!, $deltaHorizon: String!) { 365 getStockNewsSummary(gbiId: $gbiId, deltaHorizon: $deltaHorizon) { 366 summary 367 sourceCounts { 368 count 369 } 370 } 371 getStockNewsTopics(gbiId: $gbiId, deltaHorizon: $deltaHorizon) { 372 topics { 373 topicId 374 topicLabel 375 topicDescription 376 topicPolarity 377 newsItems { 378 newsId 379 headline 380 url 381 summary 382 source 383 publishedAt 384 } 385 } 386 } 387} 388""" 389 390 391GET_THEMES = """ 392query getThemes( 393 $type: MarketTrendsType!, $id: String, $startDate: String!, $endDate: String!, 394 $deltaHorizon: String) { 395 themes( 396 type: $type, id: $id, startDate: $startDate, endDate: $endDate, deltaHorizon: $deltaHorizon 397 ) { 398 themeId 399 themeName 400 themeImportance 401 volatility 402 positiveStockPerformance 403 negativeStockPerformance 404 } 405} 406""" 407 408 409GET_THEMES_FOR_STOCK_WITH_REASONS = """ 410query themesForStockWithReasons($gbiId: Int!, $startDate: String!, $endDate: String!) { 411 themesForStockWithReasons(gbiId: $gbiId, startDate: $startDate, endDate: $endDate) { 412 themeId 413 themeName 414 importanceScore 415 similarityScore 416 positiveThemeRelation 417 reason 418 } 419} 420""" 421 422EARNINGS_IMPACTS_CALENDAR_FOR_STOCK = """ 423query GetEarningsCalendarForStock($gbiId: Int!, $date: String!, $days: Int) { 424 earningsCalendarForStock(gbiId: $gbiId, date: $date, days: $days) { 425 gbiId 426 averageNextDayPerformance 427 eventDate 428 impactedCompanies { 429 gbiId 430 reason 431 security { 432 gbiId 433 name 434 symbol 435 } 436 correlation 437 } 438 security { 439 gbiId 440 name 441 symbol 442 isin 443 } 444 } 445} 446""" 447 448GET_ALL_THEMES = """ 449 query GetAllThemesForUser($universeIds: [ID!]) { 450 getAllThemesForUser(universeIds: $universeIds) { 451 themeId 452 themeName 453 universeIds 454 } 455 } 456""" 457 458 459GET_THEME_DEEPDIVE_DETAILS = """ 460 query GetMarketThemes( 461 $type: MarketTrendsType! 462 $id: String 463 $themeId: ID! 464 $startDate: String! 465 $endDate: String! 466 $deltaHorizon: String! 467 ) { 468 marketThemes( 469 type: $type 470 id: $id 471 themeId: $themeId 472 startDate: $startDate 473 endDate: $endDate 474 deltaHorizon: $deltaHorizon 475 ) { 476 themeName 477 themeDescription 478 universeReturn 479 impactInfos { 480 impactId 481 impactName 482 impactDescription 483 impactScore 484 newsItems { 485 headline 486 newsId 487 publishedAt 488 source 489 url 490 } 491 stocks { 492 gbiId 493 positiveThemeRelation 494 } 495 } 496 stockInfos { 497 gbiId 498 sectorId 499 subSectorId 500 priceChange 501 percentageChange 502 comboRecommendation 503 security { 504 gbiId 505 isin 506 symbol 507 currency 508 name 509 sector { 510 name 511 } 512 } 513 watchlists { 514 watchlistId 515 watchlistName 516 } 517 polarityReasonScores { 518 positiveThemeRelation 519 reason 520 impactScore 521 similarityScore 522 } 523 } 524 thematicSectorInfos { 525 sectorId 526 sectorName 527 sectorRank 528 sectorRankDelta 529 excessReturn 530 subSectorPerformances { 531 subSectorId 532 excessReturn 533 } 534 } 535 themeDevelopments { 536 articleCount 537 date 538 description 539 isMajorDevelopment 540 label 541 news { 542 headline 543 publishedAt 544 source 545 url 546 } 547 sentiment 548 } 549 errorMessage 550 } 551 } 552 553""" 554 555GET_EARNINGS_INSIGHTS_SUMMARIES = """ 556 query GetEarningsSummaries($gbiIds: [Int!]!) { 557 getEarningsSummaries(gbiIds: $gbiIds) { 558 gbiId 559 reports { 560 date 561 title 562 details { 563 header 564 isAligned 565 detail 566 sentiment 567 } 568 highlights 569 qaDetails { 570 header 571 detail 572 sentiment 573 } 574 qaHighlights 575 quarter 576 year 577 } 578 } 579 } 580""" 581 582GET_EARNINGS_COMPARISONS = """ 583 query GetLatestEarningsComparison($gbiIds: [Int!]!) { 584 getLatestEarningsChanges(gbiIds: $gbiIds) { 585 gbiId 586 changes { 587 header 588 detail 589 } 590 } 591 } 592"""
GET_SEC_INFO_QRY =
'\nquery GetSecurities($ids: [Int!]) {\n securities(ids: $ids) {\n gbiId\n symbol\n name\n isin\n currency\n country\n sector {\n name\n topParentName\n }\n }\n}\n'
WATCHLIST_ANALYSIS_QRY =
'\nquery WatchlistAnalysis(\n $modelIds: [ID!]\n $portfolioIds: [ID!]\n $gbiIds: [Int]\n $date: String!\n) {\n watchlistAnalysis(\n modelIds: $modelIds\n portfolioIds: $portfolioIds\n gbiIds: $gbiIds\n minDate: $date\n maxDate: $date\n ) {\n ...AnalysisFragment\n ...ExplainWeightsFragment\n }\n}\n\nfragment AnalysisFragment on WatchlistAnalysis {\n gbiId\n analysisDates {\n date\n aggregateSignal {\n rating\n ratingDelta\n }\n portfoliosSignals {\n portfolioId\n rank\n signalDelta\n rating\n ratingDelta\n }\n }\n}\n\n\nfragment ExplainWeightsFragment on WatchlistAnalysis {\n gbiId\n analysisDates {\n date\n portfoliosSignals {\n explainWeightNeg\n explainWeightPos\n }\n }\n}\n'
GET_MODELS_FOR_PORTFOLIOS_QRY =
'\nquery GetPortfoliosAndModels($ids: [ID!]) {\n portfolios(ids: $ids) {\n id\n name\n modelId\n modelName\n }\n}\n'
GET_EXCESS_RETURN_QRY =
'\nquery GetExcessReturn($modelIds: [ID!], $gbiIds: [Int], $date: String!) {\n models(ids: $modelIds) {\n id\n equityExplorerData(date: $date, gbiIds: $gbiIds) {\n equityExplorerSummaryStatistics {\n gbiId\n ER {\n SP {\n sixMonthWindowOneMonthHorizon\n }\n }\n }\n }\n }\n}\n'
GET_IDEAS_QUERY =
'\nquery GetRecommendations(\n $modelId: ID!\n $portfolioId: ID!\n $horizon: String!\n $deltaHorizon: String!\n $startDate: String!\n $endDate: String!\n $marketDataDate: String!\n ) {\n recommendations(\n modelId: $modelId\n portfolioId: $portfolioId\n horizon: $horizon\n deltaHorizon: $deltaHorizon\n startDate: $startDate\n endDate: $endDate\n marketDataDate: $marketDataDate\n ) {\n mainCategories\n missingRecommendations {\n category\n missingReason\n }\n recommendations {\n category\n dividendYield\n reason\n rating\n ratingDelta\n risk {\n text\n }\n reward {\n text\n }\n ER {\n oneMonth\n threeMonth\n oneYear\n }\n security {\n symbol\n gbiId\n }\n }\n }\n }\n'
reasons { type text }
STOCK_RECOMMENDATION_QUERY =
'\n query StockRecommendation(\n $modelId: ID!\n $portfolioId: ID!\n $gbiId: Int!\n $horizon: String!\n $date: String!\n ) {\n stockRecommendation(\n modelId: $modelId\n portfolioId: $portfolioId\n gbiId: $gbiId\n horizon: $horizon\n date: $date\n ) {\n ER {\n oneMonth\n threeMonth\n oneYear\n }\n rewardCategories {\n rank\n category\n }\n riskCategories {\n rank\n category\n }\n reasons {\n type\n text\n arrows\n }\n recommendation\n rewardCategory\n riskCategory\n }\n }\n'
MULTI_STOCK_RECOMMENDATION_QUERY =
'\n query StocksRecommendations(\n $gbiIds: [Int!]\n $strategyId: ID!\n ) {\n currentRecommendationsFull(\n strategyId: $strategyId\n gbiIds: $gbiIds\n ) {\n gbiId\n recommendation1M {\n currentCategory\n ER {\n oneMonth\n threeMonth\n oneYear\n }\n reward {\n text\n }\n risk {\n text\n }\n reasons {\n type\n text\n }\n }\n recommendation3M {\n currentCategory\n ER {\n oneMonth\n threeMonth\n oneYear\n }\n reward {\n text\n }\n risk {\n text\n }\n reasons {\n type\n text\n }\n }\n recommendation1Y {\n currentCategory\n ER {\n oneMonth\n threeMonth\n oneYear\n }\n reward {\n text\n }\n risk {\n text\n }\n reasons {\n type\n text\n }\n }\n }\n }\n'
PF_HOLDING_QUERY =
'\nquery getPortfolioHoldings(\n $date: String!\n $modelId: ID!\n $portfolioId: ID!\n) {\n portfolioHoldings (\n date: $date\n modelId: $modelId\n portfolioId: $portfolioId\n ) {\n security {\n symbol\n }\n gbiId\n }\n}\n'
GET_PORTFOLIO_RELATIVE_DATES_QUERY =
'\nquery GetPortfolioRelativeDates(\n $portfolioId: ID!\n $relativePeriods: [String!]\n ) {\n portfolio(id: $portfolioId) {\n relativeDates(relativePeriods: $relativePeriods) {\n period\n date\n }\n }\n }\n'
GET_PORTFOLIO_FACTOR_ATTRIBUTION_QUERY =
'\nquery getPortfolioFactorAttribution($portfolioId: ID!, $startDate: String, $endDate: String) {\n portfolio(id: $portfolioId) {\n factorAttribution(startDate: $startDate, endDate: $endDate) {\n dates\n portfolioFactorPerformance {\n name\n data\n }\n factorBetas {\n name\n data\n }\n factorReturns {\n name\n data\n }\n }\n }\n }\n'
GET_MODEL_STOCK_UNIVERSE_ID_QUERY =
'\nquery getModelStockUniverseId($modelId: ID!) {\n model(id: $modelId) {\n stockUniverseId\n }\n}\n'
GET_PROS_CONS_QUERY =
'\nquery GetProsCons($gbiIds: [Int!]!) {\n bulkSecurityProsCons(gbiIds: $gbiIds) {\n gbiId\n pros {\n summary\n details\n }\n cons {\n summary\n details\n }\n }\n}\n'
GET_MARKET_TRENDS_UNIVERSES_QUERY =
'\nquery getMarketTrendsUniverses {\n getMarketTrendsUniverses {\n id\n name\n }\n}\n'
GENERATE_THEME_QUERY =
'\nmutation generateTheme($input: GenerateThemeInput!) {\n generateTheme(input: $input) {\n success\n themeId\n }\n }\n'
GET_STOCK_NEWS_QUERY =
'\nquery getStockNews($gbiId: Int!, $deltaHorizon: String!) {\n getStockNewsSummary(gbiId: $gbiId, deltaHorizon: $deltaHorizon) {\n summary\n sourceCounts {\n count\n }\n }\n getStockNewsTopics(gbiId: $gbiId, deltaHorizon: $deltaHorizon) {\n topics {\n topicId\n topicLabel\n topicDescription\n topicPolarity\n newsItems {\n newsId\n headline\n url\n summary\n source\n publishedAt\n }\n }\n }\n}\n'
GET_THEMES =
'\nquery getThemes(\n $type: MarketTrendsType!, $id: String, $startDate: String!, $endDate: String!,\n $deltaHorizon: String) {\n themes(\n type: $type, id: $id, startDate: $startDate, endDate: $endDate, deltaHorizon: $deltaHorizon\n ) {\n themeId\n themeName\n themeImportance\n volatility\n positiveStockPerformance\n negativeStockPerformance\n }\n}\n'
GET_THEMES_FOR_STOCK_WITH_REASONS =
'\nquery themesForStockWithReasons($gbiId: Int!, $startDate: String!, $endDate: String!) {\n themesForStockWithReasons(gbiId: $gbiId, startDate: $startDate, endDate: $endDate) {\n themeId\n themeName\n importanceScore\n similarityScore\n positiveThemeRelation\n reason\n }\n}\n'
EARNINGS_IMPACTS_CALENDAR_FOR_STOCK =
'\nquery GetEarningsCalendarForStock($gbiId: Int!, $date: String!, $days: Int) {\n earningsCalendarForStock(gbiId: $gbiId, date: $date, days: $days) {\n gbiId\n averageNextDayPerformance\n eventDate\n impactedCompanies {\n gbiId\n reason\n security {\n gbiId\n name\n symbol\n }\n correlation\n }\n security {\n gbiId\n name\n symbol\n isin\n }\n }\n}\n'
GET_ALL_THEMES =
'\n query GetAllThemesForUser($universeIds: [ID!]) {\n getAllThemesForUser(universeIds: $universeIds) {\n themeId\n themeName\n universeIds\n }\n }\n'
GET_THEME_DEEPDIVE_DETAILS =
'\n query GetMarketThemes(\n $type: MarketTrendsType!\n $id: String\n $themeId: ID!\n $startDate: String!\n $endDate: String!\n $deltaHorizon: String!\n ) {\n marketThemes(\n type: $type\n id: $id\n themeId: $themeId\n startDate: $startDate\n endDate: $endDate\n deltaHorizon: $deltaHorizon\n ) {\n themeName\n themeDescription\n universeReturn\n impactInfos {\n impactId\n impactName\n impactDescription\n impactScore\n newsItems {\n headline\n newsId\n publishedAt\n source\n url\n }\n stocks {\n gbiId\n positiveThemeRelation\n }\n }\n stockInfos {\n gbiId\n sectorId\n subSectorId\n priceChange\n percentageChange\n comboRecommendation\n security {\n gbiId\n isin\n symbol\n currency\n name\n sector {\n name\n }\n }\n watchlists {\n watchlistId\n watchlistName\n }\n polarityReasonScores {\n positiveThemeRelation\n reason\n impactScore\n similarityScore\n }\n }\n thematicSectorInfos {\n sectorId\n sectorName\n sectorRank\n sectorRankDelta\n excessReturn\n subSectorPerformances {\n subSectorId\n excessReturn\n }\n }\n themeDevelopments {\n articleCount\n date\n description\n isMajorDevelopment\n label\n news {\n headline\n publishedAt\n source\n url\n }\n sentiment\n }\n errorMessage\n }\n }\n\n'
GET_EARNINGS_INSIGHTS_SUMMARIES =
'\n query GetEarningsSummaries($gbiIds: [Int!]!) {\n getEarningsSummaries(gbiIds: $gbiIds) {\n gbiId\n reports {\n date\n title\n details {\n header\n isAligned\n detail\n sentiment\n }\n highlights\n qaDetails {\n header\n detail\n sentiment\n }\n qaHighlights\n quarter\n year\n }\n }\n }\n'
GET_EARNINGS_COMPARISONS =
'\n query GetLatestEarningsComparison($gbiIds: [Int!]!) {\n getLatestEarningsChanges(gbiIds: $gbiIds) {\n gbiId\n changes {\n header\n detail\n }\n }\n }\n'