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: Add advanced trading #1340

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

moondevonyt
Copy link

@moondevonyt moondevonyt commented Dec 21, 2024

sup fam, today i put in a few hours to extend the Eliza framework by adding some core trading functionality for on-chain solana bots. my focus was to create a set of tools that will allow agents to execute trades, manage risk, and pull critical data. here's what I added and worked on:

What I Added/Completed Today:

  1. nice_funcs.py:
  • Added a library of helpful functions tailored for Solana on-chain trading.
  • Functions now include position management, wallet holdings fetching, and other utilities to make trading more efficient.
  • This has been tested with my personal bots but should integrate well with Eliza’s architecture.
  1. bot.py:
  • Built a script that allows agents to perform trading actions such as:
  • Closing a position (action 0).
  • Opening a position (action 1).
  • Adding stop-loss logic (action 2).
  • Implementing breakout trades (action 3).
  • Market-making logic (action 5).
  • Currently, it uses basic user input to decide the action, but this will soon be fully bot-driven.
  1. get_ohlcv_data.py
  • this allows the agent to get open, high, low, close and volume data
  • also have moving averages and examples of other technical indicators
  1. dontshare.py (ignored):
  • Added placeholders for sensitive information such as:
  • Solana private keys.
  • BirdEye API keys.
  • RPC URLs.
  • Added this file to .gitignore to ensure it doesn’t get accidentally pushed.
  1. Updated README.md:
  • Wrote a comprehensive README to document how to use these new tools and scripts.
  • It includes detailed steps for configuration, usage, and what each action/script does.

Why This Matters:

  • These tools lay the groundwork for enabling AI agents to perform advanced trading strategies directly on-chain.
  • The added functionality simplifies interaction with Solana contracts while maintaining flexibility for future enhancements.
  • It ensures agents can operate autonomously with minimal human intervention—just plug in the strategy, and they're good to go.

What's Next?

  • I'm researching the best way to transition from Python to TypeScript or add a shell for TS compatibility, depending on the project direction.
  • Planning to integrate more trading actions like:
  • Funding buys (action 6).
  • Liquidation monitoring (action 7).
  • Always happy to hear feedback on how this integrates with Eliza’s current architecture and if there are specific improvements to focus on.

Thanks for the opportunity to contribute. Let me know if there’s anything you’d like me to adjust or refine for tomorrow.

@odilitime odilitime changed the base branch from main to develop December 21, 2024 18:52
@odilitime odilitime changed the title Add advanced trading feat: Add advanced trading Dec 21, 2024
@chrislatorres
Copy link

is the goal to convert this to typescript?

@moondevonyt
Copy link
Author

moondevonyt commented Dec 21, 2024 via email

@shakkernerd shakkernerd deleted the branch elizaOS:develop December 22, 2024 07:02
@madjin madjin reopened this Dec 22, 2024
@moondevonyt
Copy link
Author

hey fam, thank you for reviewing. please lmk if it is necessary to convert to typescript prior to a PR. all of my quant stuff is in python but im willing to learn ts and convert it if needed

also the integration tests are failing due to the need of api keys: birdeye, helius rpc and solana private key. is there a secure way i can send mine?

im @moondev on discord

cheers

@shakkernerd
Copy link
Member

shakkernerd commented Dec 22, 2024

Hey @moondevonyt good stuffs! I would need to do an extensive test and also bring it up with other team members before deciding if port to typescript or not (I might be able to help and support if that will be the case though).

Also, the integration tests failure is due to script not finding the OPEN API key (not from your end).

@moondevonyt
Copy link
Author

hey @shakkernerd thank you very much for your help w review and ts.

tomorrow i was planning on building a python shell to make it all useable from typescript, but i would be curious do you think it is a better use of time doing that, or re-writing in ts?

i have a ton to contribute from the quant side, virtually all in python so i will do whatever is needed to be done to allow the agents to leverage my libraries

thank you sir

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.

4 participants