<repository_url>
with the actual URL of the Galadriel repository.
template.env
to .env
and add your OpenAI API and Coingecko API keys:
template.agents.env
to agents.env
and add your Solana keypair path:
agent.py
file:
Create a new file named agent.py
in the examples/trading
directory and add the following code:
.env
and agents.env
files, initializes the LiteLLM model with your OpenAI API key, and defines the
trading interval.
market_data_devnet.fetch_mock_market_data
: Fetches mock market data for development purposes.raydium_cpmm.BuyTokenWithSolTool()
: Tool for buying tokens with SOL using Raydium CPMM.solana_common.GetAdminWalletAddressTool()
: Tool to get the admin wallet address.solana_common.GetUserBalanceTool()
: Tool to get the user’s balance for a specific token.CodeAgent
with the trading prompt, LiteLLM model, and the defined tools. It also enables additional authorized imports
such as json
that might be required by the tools. Setting max_steps
makes the trading agent more reliable by increasing the number of steps it
can take to complete the task
AgentRuntime
with a Cron
input to schedule agent execution, no outputs (as the agent executes trades directly), and the
initialized trading agent.
.agents.env
has some funds.