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

okx trading #93

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

okx trading #93

wants to merge 6 commits into from

Conversation

ronryanq
Copy link

@ronryanq ronryanq commented Jan 25, 2025

Pull Request Template

Description

Please include a summary of the changes and the related issue.

Type of Change

  • Bugfix
  • New Feature
  • Improvement
  • Documentation Update

Checklist

  • I have read the contributing guidelines.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Related Issue

Closes #[issue number]

@hyacinthus
Copy link
Collaborator

Thank you for your Pull Request. I will review it tomorrow and provide some suggestions regarding structure and standards.

@skankhhunt24
Copy link

niceee

@hyacinthus
Copy link
Collaborator

Hey, thanks again for your contribution. To ensure everyone can benefit from your skills, we still need to do a few things.

Considering that CEX is an important category of skills, we classify CEX trading skills as "first-class skills." It can have its own folder within the skills directory and top-level configuration in the agent. You need to implement these improvements; if you have specific projects in mind, you can reference the implementation in the skills/twitter folder:

  • Create a cex folder in the skills directory and place your skill in it.
  • Within the cex folder, create base.py, inheriting from IntentKitSkill, and create a class with a name like CEXBaseSkill for shared use among the skills under cex.
  • Define any special infrastructure you need, such as the ccxt client, in this class.
  • Ensure that the OKX trading skill is based on this CEX class.
  • If your skill has input parameters, you need to define them to help the AI understand how to call it.
  • Since some new packages are being introduced, you need to use the poetry add command to add these packages to the project, such as ccxt and pandas.
  • In the Agent model located in models/agent, add cex_skills. If there are any configurations needed at the agent level, you can also add cex_config, and then import the config into the previously created CEXBaseSkill.
  • Add code to load cex_skills in the initialize_agent function in app/core/engine.
  • Modify docs/create_agent.sh to include content related to cex_skill, ensuring it is in sync with the Agent model.
  • Add a cex.md document in docs/skills that briefly explains how to use this skill.

Once you complete these tasks, we can easily configure the agent to use CEX skills. Since this is a first-class skill, there are quite a few places that need modifications.

Choose a reason for hiding this comment

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

Looks good

Choose a reason for hiding this comment

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

Nice

Choose a reason for hiding this comment

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

Nice

@@ -657,3 +658,23 @@ def save(self, db: Session) -> None:
db.add(self)

db.commit()

def initialize_agent():
Copy link
Collaborator

Choose a reason for hiding this comment

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

not here, add cex_config and cex_skills in the model Agent in this file.
like "enso_skills" and enso_config

@@ -0,0 +1,13 @@
from langchain_core.tools import BaseTool
from skills.crestal.search_web3_services import search_web3_services
Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove the unused skill, only keep your new skill.

from skills.crestal.search_web3_services import search_web3_services
from skills.crestal.trade_on_okx import TradeOnOkx # Import the new skill

def get_common_skill(name: str) -> BaseTool:
Copy link
Collaborator

Choose a reason for hiding this comment

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

In addition to the name, you can also pass in cex_config. Then, in the app/core/engine.py initialize_agent function, imitate enso or Twitter to initialize the skills for this category.

@@ -0,0 +1,70 @@
rom .base import CEXBaseSkill

class TradeOnOkx(CEXBaseSkill):
Copy link
Collaborator

Choose a reason for hiding this comment

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

_run and _arun is required for a skill.

args_schema is required too, if there is no param, please use an empty pydantic object, for example see twitter/mentions.py

@@ -0,0 +1,13 @@
from langchain_core.tools import BaseTool
Copy link
Collaborator

Choose a reason for hiding this comment

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

CEX should be cex, use lowercase in the folder name.

Copy link

@Khawar110 Khawar110 left a comment

Choose a reason for hiding this comment

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

Ok. Approved your request

@crestalnetwork crestalnetwork deleted a comment from Cngok88 Feb 7, 2025
@crestalnetwork crestalnetwork deleted a comment from demeajeta Feb 7, 2025
@crestalnetwork crestalnetwork deleted a comment from Khawar110 Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants