Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Integrate OpenBB Into Camel #1300

Merged
merged 17 commits into from
Jan 1, 2025
Merged

feat: Integrate OpenBB Into Camel #1300

merged 17 commits into from
Jan 1, 2025

Conversation

anjieyang
Copy link
Contributor

@anjieyang anjieyang commented Dec 9, 2024

Description

Integrate OpenBB Platform with CAMEL by adding OpenBBToolkit class for financial data access and analysis. This includes stock quotes, market screening, economic indicators functionality, and ChatAgent integration for interactive analysis.

Motivation and Context

CAMEL needs financial data analysis capabilities to enable AI agents to process and analyze market data. The OpenBB Platform provides comprehensive financial data APIs that can be leveraged through a toolkit interface.

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

  • New feature (non-breaking change which adds core functionality)
  • Example (update in the folder of example)

Implemented Tasks

  • Create OpenBBToolkit class with financial data functions in camel/toolkits/openbb_toolkit.py
  • Add example code demonstrating usage in examples/toolkits/openbb_toolkit.py
  • Implement test suite in test/toolkits/test_openbb_functions.py
  • Add documentation and docstrings

Checklist

  • I have read the CONTRIBUTION guide.
  • My change requires a change to the documentation.
  • I have updated the tests accordingly.
  • I have updated the documentation accordingly.

@anjieyang anjieyang force-pushed the feat/integrate-openbb branch from 0e3d6b4 to 8e1a24c Compare December 12, 2024 03:22
@Wendong-Fan Wendong-Fan added this to the Sprint 18 milestone Dec 12, 2024
@Wendong-Fan Wendong-Fan linked an issue Dec 12, 2024 that may be closed by this pull request
2 tasks
camel/types/openbb_types.py Outdated Show resolved Hide resolved
camel/types/openbb_types.py Outdated Show resolved Hide resolved
camel/toolkits/openbb_toolkit.py Outdated Show resolved Hide resolved
camel/toolkits/openbb_toolkit.py Show resolved Hide resolved
@camel-ai camel-ai deleted a comment from anjieyang Dec 13, 2024
camel/toolkits/openbb_toolkit.py Outdated Show resolved Hide resolved
camel/toolkits/openbb_toolkit.py Outdated Show resolved Hide resolved
camel/toolkits/openbb_toolkit.py Outdated Show resolved Hide resolved
camel/toolkits/openbb_toolkit.py Outdated Show resolved Hide resolved
camel/toolkits/openbb_toolkit.py Outdated Show resolved Hide resolved

return base_symbol

def get_company_fundamentals(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The openBB supports so many functionalities(https://docs.openbb.co/platform/reference). Only for the fundamentals, it supports lots of options(https://docs.openbb.co/platform/reference/equity/fundamental). Couple general questions:

  1. How did we decide which functionalities to integrate first?
  2. Could we do something like func = self.client.equity.fundamentals.get(statement) func(symbol=symbol, provider=provider)? So that we don't need to list all the options which are too many. We only need to check if it exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow thanks @willshang76 for your comment, I will think about how to integrate these ideas into the code

camel/toolkits/openbb_toolkit.py Outdated Show resolved Hide resolved
@Wendong-Fan Wendong-Fan changed the title Feat/integrate OpenBB Into Camel feat: Integrate OpenBB Into Camel Dec 14, 2024
Copy link
Member

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @anjieyang , left some comments below

camel/toolkits/openbb_toolkit.py Show resolved Hide resolved
camel/types/openbb_types.py Outdated Show resolved Hide resolved
camel/toolkits/openbb_toolkit.py Outdated Show resolved Hide resolved
camel/toolkits/openbb_toolkit.py Outdated Show resolved Hide resolved
camel/toolkits/openbb_toolkit.py Outdated Show resolved Hide resolved
camel/toolkits/openbb_toolkit.py Outdated Show resolved Hide resolved
camel/toolkits/openbb_toolkit.py Outdated Show resolved Hide resolved
camel/types/openbb_types.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated
Comment on lines 47 to 60
types-redis = "^4.6.0.20240106"
types-requests = "^2.31.0.20240106"
types-python-dateutil = "^2.8.19.20240106"
types-pytz = "^2024.1.0.20240104"
types-PyYAML = "^6.0.12.12"
types-beautifulsoup4 = "^4.12.0.20240106"
types-colorama = "^0.4.15.20240106"
types-docutils = "^0.20.0.20240106"
types-jsonschema = "^4.21.0.20240106"
types-pillow = "^10.2.0.20240106"
types-protobuf = "^4.24.0.20240106"
types-setuptools = "^69.0.0.20240106"
types-six = "^1.16.21.20240106"
types-urllib3 = "^1.26.25.14"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we need to add this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this last time because I cannot pass the pre-commit check😢

Copy link
Member

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @anjieyang , some test failed, could you help checking and fixing this, thanks!

Copy link
Member

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @anjieyang. I've made some updates to the code:

First, we need to prioritize ensuring the code works as intended. Regarding the implementation of DataFrame conversion, I noticed that different data providers may return varying types of information. The DataFrame schema you defined doesn't cover all possible cases. Since the DataFrame is intended for human users, developers can handle the conversion themselves. Maintaining a comprehensive schema for all providers would be challenging, so I removed the DataFrame output part.

The code quality could be improved in a few areas. There are instances where duplicate methods from the OpenBB client are used, which can be optimized to reduce redundancy. Additionally, some methods include a provider argument that isn't valid. It's important to verify all code thoroughly

Since the docstrings will be passed to the agent, I streamlined the content to avoid exceeding token limits. In the initial implementation, it was easy to hit token limits when running the agent with this tool for multiple rounds.

Make sure only necessary dependencies added and the added dependencies are in the right place, there were some unnecessary dependencies added and not categoried correctly.

Please review the changes and let me know if there's anything you'd like to discuss. Thanks again for your contribution, and Happy New Year!

@Wendong-Fan Wendong-Fan merged commit 1b4afc8 into master Jan 1, 2025
6 checks passed
@Wendong-Fan Wendong-Fan deleted the feat/integrate-openbb branch January 1, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

[Feature Request] Integrate OpenBB
4 participants