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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
NER_TAGGING_PROMPT = '''
You are an expert in finance who will be performing Named Entity Recognition (NER) 
with the high-level objective of analyzing financial documents. The output should 
be formatted as a JSON object, where the JSON object has a key "entities" that 
contains a list of the extracted entities. If no entities are found, return an 
empty JSON object.

- Finacial Markets (Grouping of financial securities)
- Finacial Securities
- Finacial Indicators

Now, given a text chunk, extract the relevant entities and format the output as a JSON object.

Examples of entities:

- Financial Markets: "US Stock Market", "US Bond Market", "US Real Estate Market", "Tech Stocks", "Energy Stocks"
- Financial Securities: "Apple", "Tesla", "Microsoft", "USD", "Bitcoin", "Gold", "Oil"
- Economic Indicators: "Consumer Price Index (CPI)", "Unemployment Rate", "GDP Growth Rate", "Federal Deficit"

Input:
Scores on the Doors: crypto 65.3%, gold 10.1%, stocks 7.7%, HY bonds 4.3%, IG bonds 4.3%, govt bonds 3.4%, 
oil 3.7%, cash 1.2%, commodities -0.1%, US dollar -2.0% YTD. 
The Biggest Picture: everyone's new favorite theme...US dollar debasement; US$ -11%
since Sept, gold >$2k, bitcoin >$30k; right secular theme (deficits, debt, geopolitics),
US$ in 4th bear market of past 50 years, bullish gold, bearish Euro, bullish international 
stocks; but pessimism so high right now, and 200bps Fed cuts priced in from June to election, 
look for US$ trading bounce after Fed ends hiking cycle May 3rd (Chart 2). 
2024 Tale of the Tape: inflation slowing, Fed hiking cycle over, recession 
expectations universal, yet UST 30-year can't break below 3.6% (200-dma) because we've already traded 8% to 4% CPI, 
labor market yet to crack, US govt deficit growing too quickly. The Price is Right: next 6 months it's 
“recession vs Fed cuts”; best tells who's winning...HY bonds, homebuilders, semiconductors...HYG <73, XHB <70, 
SOX <2900 recessionary, and if levels hold...it's a no/soft landing.

Output:
{
  "entities": [
    {
      "name": "crypto",
      "type": "Financial Securities",
    },
    {
      "name": "gold",
      "type": "Financial Securities",
    },
    {
      "name": "stocks",
      "type": "Financial Securities",
    },
    {
      "name": "HY bonds",
      "type": "Financial Securities",
    },
    {
      "name": "IG bonds",
      "type": "Financial Securities",
    },
    {
      "name": "govt bonds",
      "type": "Financial Securities",
    },
    {
      "name": "oil",
      "type": "Financial Securities",
    },
    {
      "name": "cash",
      "type": "Financial Securities",
    },
    {
      "name": "commodities",
      "type": "Financial Securities",
    },
    {
      "name": "US dollar",
      "type": "Financial Securities",
    },
    {
      "name": "US$",
      "type": "Financial Securities",
    },
    {
      "name": "gold",
      "type": "Financial Securities",
    },
    {
      "name": "bitcoin",
      "type": "Financial Securities",
    },
    {
      "name": "UST 30-year",
      "type": "Financial Securities",
    },
    {
      "name": "CPI",
      "type": "Economic Indicators",
    },
    {
      "name": "labor market",
      "type": "Economic Indicators",
    },
    {
      "name": "US govt deficit",
      "type": "Economic Indicators",
    },
    {
      "name": "HY bonds",
      "type": "Financial Securities",
    },
    {
      "name": "homebuilders",
      "type": "Financial Markets",
    },
    {
      "name": "semiconductors",
      "type": "Financial Markets",
    },
    {
      "name": "HYG",
      "type": "Financial Securities",
    },
    {
      "name": "XHB",
      "type": "Financial Securities",
    },
    {
      "name": "SOX",
      "type": "Financial Securities",
    }
  ]
}

Input: 
the latest tech stock resurgence of 2024; NASDAQ +15% since January, Apple >$180, Tesla >$250; 
driven by strong earnings, innovation, and AI advancements, NASDAQ in its 3rd bull market of the past decade, 
bullish on semiconductors, cloud computing, and cybersecurity stocks; however, optimism 
is soaring, and 150bps rate hikes anticipated from July to year-end, expect a potential 
pullback in tech stocks after the next earnings season concludes in August (Chart 3). 
Anyway, the bipartisan agreement to suspend the US debt ceiling until 2025 with only limited 
fiscal restraint (roughly 0.1-0.2% of GDP yoy in 2024 and 2025 compared with the baseline) 
means that we have avoided another potential significant negative shock to demand.
On the brightside, the boost to funding that Congress approved late last year for FY23 
was so large (nearly 10% yoy) that overall discretionary spending is likely to be slightly 
higher in real terms next year despite the new caps.

Output:
{
  "entities": [
    {
      "name": "NASDAQ",
      "type": "Financial Securities",
    },
    {
      "name": "Apple",
      "type": "Financial Securities",
    },
    {
      "name": "Tesla",
      "type": "Financial Securities",
    },
    {
      "name": "semiconductors",
      "type": "Financial Market",
    },
    {
      "name": "cloud computing",
      "type": "Financial Market",
    },
    {
      "name": "cybersecurity stocks",
      "type": "Financial Market",
    },
    {
      "name": "tech stocks",
      "type": "Financial Marker",
    },
    {
      "name": "GDP",
      "type": "Economic Indicators",
    },
    {
      "name": "FY23",,
      "type": "Economic Indiciators",
    }
  ]
}

'''

EXTRACT_RELATIONSHIPS_PROMPT = '''
As a finance expert, your role is to extract relationships between a set of entities. 
You will receive an excerpt from a financial report, the name of the analyst who authored 
it, the date the report was published, and a list of entities that have already been extracted. 
Your task is to identify and output relationships between these entities to construct a 
knowledge graph for financial document analysis.

Your output should be a JSON object containing a single key, "relationships," 
which maps to a list of the extracted relationships. These relationships should be 
formatted as structured JSON objects. Each relationship type must include "from_entity"
and "to_entity" attributes, using previously extracted entities as guidance, 
to denote the source and target of the relationship, respectively. Additionally, all 
relationship types should have "start_date" and "end_date" attributes, formatted as 
"YYYY-MM-DD". The "source_text" attribute within a relationship should directly quote 
the description of the relationship from the financial report excerpt.

The relationship types you need to extract include:

[Relationship Type 1: "PREDICTION"]: This relationship captures any forecasts or predictions the analyst makes 
regarding trends in financial securities, indicators, or market entities. Search for phrases such as "we forecast," 
"is likely that," or "expect the market to." You must also assess the sentiment of the prediction—whether it is neutral, 
positive (increase), or negative (decrease)—and include this in the relationship. Map the sentiment to one of the following

- PREDICTED_MOVEMENT_NEUTRAL (neutral sentiment)
- PREDICTED_MOVEMENT_INCREASE (positive sentiment)
- PREDICTED_MOVEMENT_DECREASE (negative sentiment)

The "from_entity" should be the analyst's  name(s), while the "to_entity" should be the entity the prediction concerns (utilize the previously extracted entities as guidance). 
Each prediction must have a defined "start_date" and "end_date" indicating the expected timeframe of the prediction. If 
the prediction is not explicitly time-bound, omit this relationship. Use the report's publishing date as the "start_date" 
unless the author specifies a different date. The "end_date" should correspond to when the prediction is anticipated to conclude.

Be sure to include the source excerpt you used to derive each relationship in the "source_text" attribute of the corresponding relationship. 
Realize that predictions are about the future. Lastly, note that sometimes you will need to infer what entity is being referred to, 
even if it is not explicitly named in the source sentence. 

Example Input:

Analyst: Helen Brooks
Publish Date: 2024-06-12

Text Chunk: Labor markets are showing signs of normalization to end 2024; unemployment could drift higher in 2024 while remaining low in historical context.
Momentum in the job market is starting to wane with slowing payroll growth and modestly rising unemployment, as well as declining quit rates and temporary help. 
Increased labor force participation and elevated immigration patterns over the past year have added labor supply, while a shortening work week indicates moderating demand for labor. 
Considering the challenges to add and retain workers coming out of the pandemic, businesses could be more reluctant than normal to shed workers in a slowing economic environment. 
Even so, less hiring activity could be enough to cause the unemployment rate to tick up to the mid-4% area by the end of next year due to worker churn. 
Already slowing wage gains should slow further in the context of a softer labor market.
Anyway, the bipartisan agreement to suspend the US debt ceiling until 2025 with only limited 
fiscal restraint (roughly 0.1-0.2% of GDP yoy in 2024 and 2025 compared with the baseline) 
means that we have avoided another potential significant negative shock to demand.
On the brightside, the boost to funding that Congress approved late last year for FY23 
was so large (nearly 10% yoy) that overall discretionary spending is likely to be slightly 
higher in real terms next year despite the new caps.

{
    "entities": [
        {
            "name": "labor markets",
            "type": "Economic Market",
        },
        {
            "name": "unemployment",
            "type": "Economic Indicators",
        },
        {
            "name": "job market",
            "type": "Economic Market",
        },
        {
            "name": "payroll growth",
            "type": "Economic Indicators",
        },
        {
            "name": "labor force participation",
            "type": "Economic Indicators",
        },
        {
            "name": "rising unemployment",
            "type": "Economic Indicators",
        }
        {
            "name": "immigration patterns",
            "type": "Economic Indicators",
        },
        {
            "name": "hiring activity",
            "type": "Economic Indicators",
        },
        {
            "name": "worker churn",
            "type": "Economic Indicators",
        },
        {
          "name": "unemployment rate",
          "type": "Economic Indicators",
        },
        {
          "name": "discretionary spending",
          "type": "Economic Indicators",
        },
        {
          "name": "GDP",
          "type": "Economic Indicators",
        }
    ]
}


Example Output:
{
    "relationships": [
        {
            "PREDICTION": {
                "from_entity": "Helen Brooks",
                "to_entity": "labor market",
                "start_date": "2024-06-12",
                "end_date": "2024-12-31",
                "predicted_movement": "PREDICTED_MOVEMENT_NEUTRAL",
                "source_text": "Labor markets are showing signs of normalization to end 2024;"
            }
        },
        {
            "PREDICTION": {
                "from_entity": "Helen Brooks",
                "to_entity": "unemployment",
                "startDate": "2024-06-12",
                "endDate": "2024-12-31",
                "predicted_movement": "PREDICTED_MOVEMENT_INCREASE",
                "source_text": "unemployment could drift higher in 2024 while remaining low in historical context."
            }
        },
        {
            "PREDICTION": {
                "from_entity": "Helen Brooks",
                "to_entity": "unemployment rate",
                "start_date": "2024-06-12",
                "end_date": "2025-12-31",
                "predicted_movement": "PREDICTED_MOVEMENT_INCREASE",
                "source_text": "Even so, less hiring activity could be enough to cause the unemployment rate to tick up to the mid-4% area by the end of next year due to worker churn."
            }
        },
        {
            "PREDICTION": {
                "from_entity": "Helen Brooks",
                "to_entity": "discretionary spending",
                "start_date": "2024-06-12",
                "end_date": "2025-12-31",
                "predicted_movement": "PREDICTED_MOVEMENT_INCREASE",
                "source_text": "On the brightside, the boost to funding that Congress approved late last year for FY23 was so large (nearly 10% yoy) that overall discretionary spending is likely to be slightly higher in real terms next year despite the new caps."
            }
        },
    ]
}

Example Input:

Analyst: John Doe, Herb Johnson, Taylor Mason

Publish Date: 2024-01-02

Text Chunk: Scores on the Doors: crypto 65.3%, gold 10.1%, stocks 7.7%, HY bonds 4.3%, IG bonds 4.3%, govt bonds 3.4%,
oil 3.7%, cash 1.2%, commodities -0.1%, US dollar -2.0% YTD. The Biggest Picture: everyone’s new favorite
theme...US dollar debasement; US$ -11% since Sept, gold >$2k, bitcoin >$30k; right secular theme (deficits,
debt, geopolitics), US$ in 4th bear market of past 50 years, bullish gold, oil, Euro, international stocks; but pessimism
so high right now, and 200bps Fed cuts priced in from June to election, look for US$ trading bounce after Fed
ends hiking cycle May 3rd (Chart 2). Tale of the Tape: inflation slowing, Fed hiking cycle over, recession
expectations universal, yet UST 30-year can’t break below 3.6% (200-dma) because we’ve already traded 8% to 4% CPI,
labor market yet to crack, US govt deficit growing too quickly. The Price is Right: next 6 months it’s
“recession vs Fed cuts”; best tells who’s winning...HY bonds, homebuilders, semiconductors...HYG <73, XHB <70,
SOX <2900 recessionary, and if levels hold...it’s a no/soft landing.

{
  "entities": [
    {
      "name": "crypto",
      "type": "Financial Securities",
    },
    {
      "name": "gold",
      "type": "Financial Securities",
    },
    {
      "name": "stocks",
      "type": "Financial Securities",
    },
    {
      "name": "HY bonds",
      "type": "Financial Securities",
    },
    {
      "name": "IG bonds",
      "type": "Financial Securities",
    },
    {
      "name": "govt bonds",
      "type": "Financial Securities",
    },
    {
      "name": "oil",
      "type": "Financial Securities",
    },
    {
      "name": "cash",
      "type": "Financial Securities",
    },
    {
      "name": "commodities",
      "type": "Financial Securities",
    },
    {
      "name": "US dollar",
      "type": "Financial Securities",
    },
    {
      "name": "US$",
      "type": "Financial Securities",
    },
    {
      "name": "gold",
      "type": "Financial Securities",
    },
    {
      "name": "bitcoin",
      "type": "Financial Securities",
    },
    {
      "name": "UST 30-year",
      "type": "Financial Securities",
    },
    {
      "name": "CPI",
      "type": "Economic Indicators",
    },
    {
      "name": "labor market",
      "type": "Economic Indicators",
    },
    {
      "name": "US govt deficit",
      "type": "Economic Indicators",
    },
    {
      "name": "HY bonds",
      "type": "Financial Securities",
    },
    {
      "name": "homebuilders",
      "type": "Financial Markets",
    },
    {
      "name": "semiconductors",
      "type": "Financial Markets",
    },
    {
      "name": "HYG",
      "type": "Financial Securities",
    },
    {
      "name": "XHB",
      "type": "Financial Securities",
    },
    {
      "name": "SOX",
      "type": "Financial Securities",
    }
  ]
}

Example Output:

{
    "relationships": [
        {
            "PREDICTION": {
                "from_entity": "John Doe, Herb Johnson, Taylor Mason",
                "to_entity": "US$",
                "start_date": "2024-06-12",
                "end_date": "2024-11-05",
                "predicted_movement": "PREDICTED_MOVEMENT_INCREASE",
                "source_text": "200bps Fed cuts priced in from June to election, look for US$ trading bounce after Fed ends hiking cycle May 3rd."
            }
            "PREDICTION": {
                "from_entity": "John Doe, Herb Johnson, Taylor Mason",
                "to_entity": "Fed cuts",
                "start_date": "2024-06-12",
                "end_date": "2024-11-05",
                "predicted_movement": "PREDICTED_MOVEMENT_DECREASE",
                "source_text": "200bps Fed cuts priced in from June to election, look for US$ trading bounce after Fed ends hiking cycle May 3rd."
            }
        },
    ]
}
'''