Inspiration

We were inspired by Chainlink Function and automation to create a proof-of-concept trading bot that utilizes an off-chain API that trades ETH.

What it does

Our POC utilizes Chainlink automation to trigger a call on a daily timeframe to a solidity contract that uses Chainlink function to call an off-chain API. This API returns trading signals - both LONG and SHORT trades - based on the ETH daily closing price. The API implements two trading strategies. A swing and a momentum trading strategies.

How we built it

We started with the Chainlink Functions tutorial calling chat-gpt. We then modified it to call our trading API. Instead of using Javascript to interact with the Chainlink Function consumer, we moved this logic inside a solidity contract. We pass the Javascript to be executed by Chainlink Functions as a parameter to that contract.

Challenges we ran into

  • Passing the Javascript code into the contract.
  • Creating and deploying the API.
  • The development and unit testing cycle was slow because of the multiple steps required.
  • Difficulty debugging the code. We had to do multiple deployments in order to isolate issues.

Accomplishments that we're proud of

We have a fully functional POC that can be extended with more functionality.

What we learned

How to use Chainlink Functions and automation in a real life use case. Initially, we were planning on using chat-gpt to analyze the ETH closing price and come back with a trading signal. However, we quickly realized that this was feasible. So we pivoted to using chat-gpt to create the trading strategies. We then developed python scripts to implement the strategies and expose them as a callable API using HTTP REST.

What's next for DeepFi

Now that we have a working end-to-end POC. We can add the following:

  • Implement the trading signals on-chain.
  • Add more trading strategies.
  • Add the ability to return strategy exit signals based on the entry price. This will require passing parameters to the off-chain API.
  • Look into training our own trading model using chat-gpt.
Share this project:

Updates