Yfinance
yfinance
Functions:
| Name | Description |
|---|---|
get_yfin_data_online |
Fetch OHLCV stock data online via yfinance and return as CSV string. |
get_stock_stats_indicators_window |
Calculate and format a specific technical indicator over a window of days. |
get_fundamentals |
Get company fundamentals overview from yfinance. |
get_balance_sheet |
Get balance sheet data from yfinance. |
get_cashflow |
Get cash flow data from yfinance. |
get_income_statement |
Get income statement data from yfinance. |
get_insider_transactions |
Get insider transactions data from yfinance. |
get_yfin_data_online
Fetch OHLCV stock data online via yfinance and return as CSV string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Ticker symbol of the company. |
required |
|
str
|
Start date in YYYY-MM-DD format. |
required |
|
str
|
End date in YYYY-MM-DD format. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
CSV string containing stock data with header info. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/tradingagents/dataflows/yfinance.py
get_stock_stats_indicators_window
get_stock_stats_indicators_window(
symbol: str, indicator: str, curr_date: str, look_back_days: int
) -> str
Calculate and format a specific technical indicator over a window of days.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Ticker symbol of the company. |
required |
|
str
|
Technical indicator to calculate. |
required |
|
str
|
Current trading date in YYYY-MM-DD format. |
required |
|
int
|
Number of days to look back. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Formatted string containing indicator values and a description. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the requested indicator is not supported, |
Source code in src/tradingagents/dataflows/yfinance.py
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 | |
get_fundamentals
Get company fundamentals overview from yfinance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Ticker symbol of the company. |
required |
|
str | None
|
Current date used as a point-in-time boundary. Current yfinance snapshot metrics are omitted for historical dates because Yahoo Finance does not expose their historical availability through this endpoint. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Formatted string containing fundamentals overview. |
Source code in src/tradingagents/dataflows/yfinance.py
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 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |
get_balance_sheet
Get balance sheet data from yfinance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Ticker symbol of the company. |
required |
|
str
|
Frequency of data ('annual' or 'quarterly'). Defaults to "quarterly". |
'quarterly'
|
|
str | None
|
Current date used as a point-in-time boundary. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
CSV string containing balance sheet data. |
Source code in src/tradingagents/dataflows/yfinance.py
get_cashflow
Get cash flow data from yfinance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Ticker symbol of the company. |
required |
|
str
|
Frequency of data ('annual' or 'quarterly'). Defaults to "quarterly". |
'quarterly'
|
|
str | None
|
Current date used as a point-in-time boundary. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
CSV string containing cash flow data. |
Source code in src/tradingagents/dataflows/yfinance.py
get_income_statement
Get income statement data from yfinance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Ticker symbol of the company. |
required |
|
str
|
Frequency of data ('annual' or 'quarterly'). Defaults to "quarterly". |
'quarterly'
|
|
str | None
|
Current date used as a point-in-time boundary. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
CSV string containing income statement data. |
Source code in src/tradingagents/dataflows/yfinance.py
get_insider_transactions
Get insider transactions data from yfinance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Ticker symbol of the company. |
required |
|
str | None
|
Current date used as a point-in-time boundary when transaction date columns are available. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
CSV string containing insider transactions data. |