How AI Helps Us Write Connectors for Crypto Exchanges
September 2024. We, the StockSharp team, are actively using AI to write connectors for crypto exchanges. But let me warn you — if you are reading this in 2025 or later, all of this might already be outdated. If you’re from the future, welcome to the past! And don’t forget to check if our methods are still relevant.
Our journey with AI started with ChatGPT 3.5, which, frankly, could not write even a simple trading strategy, let alone a crypto exchange connector. However, with the arrival of ChatGPT 4.0 and Claude Sonnet 3.5, things drastically changed. Now, AI can write complex code modules, though with caveats: you still have to intervene, clarify, and fix bugs, which has become a normal part of our process.
Step 1. Starting a project in Claude.ai
Project creation interface in Claude.ai. Here, all data and examples are saved, allowing you to maintain the context of the work.
Claude.ai is like your personal developer, who understands some things, but without your supervision, can write something that might make your hair stand on end. So keep your documentation and vigilance close.
Step 2. Copying existing code
To avoid reinventing the wheel every time, we base our work on an already existing connector, for example, for Coinbase. We copy the project structure and adapt all the key classes and methods for the new exchange. This is just the beginning — the real fun starts now.
Step 3. Adapting the WebSocket client
Original WebSocket client code for one of the exchanges, generated by Claude.ai. The AI suggests expanding the data types and events.
Claude.ai made a mistake in implementing WebSocket authentication. We corrected the code and added proper authentication before connecting.
Example code where the WebSocket address is passed as a parameter, making the architecture more flexible.
Step 4. Setting up the REST client and adapter
After setting up the WebSocket client, we move on to the REST client. Claude.ai generates basic requests, but we have to manually clarify whether they are correct. Each exchange’s API differs, and you need to be careful not to miss important details in the documentation.
Generated domain model classes. We manually supplemented them with attributes and corrected the data types.
We added JsonProperty attributes for proper work with JSON data.
Claude fixes code for processing trade data transmitted via WebSocket and REST API.
Step 5. Optimization and new methods
Optimized methods for working with candlesticks and trade data via WebSocket, refactored into separate classes.
Claude.ai added methods for trade operations in SocketClient, but they had to be optimized and corrected for errors.
Step 6. Testing — the code doesn’t always work on the first try
Claude.ai suggested code for working with REST API Gate.io, but it needed to be tested and refined.
Step 7. Data conversion for spot and derivatives
Claude.ai suggested the Extensions class to support data conversion between spot and derivatives on Gate.io.
SpotAdapter was rewritten with changes in HttpClient and SocketClient, using methods from Extensions.
Step 8. Futures adapter and error corrections
Generated HttpClient for working with futures via REST API Gate.io.
Fixed futures adapter with correct order book processing logic.
Optimized methods for data recovery and order book processing based on Claude.ai’s suggestions.
GitHub Copilot — overhyped toy or real helper?
AI: an enhancer for professionals and a barrier for beginners
If you’re a beginner developer just diving into the world of programming, you’re, to put it mildly, out of luck. Currently, AI won’t boost your efficiency in any significant way. Moreover, trusting AI with complex tasks can get you even more tangled in code and problems it generates. It’s a different story for experienced programmers.
For professionals, AI becomes a powerful tool that amplifies their capabilities: it speeds up development, offers solutions, and enriches knowledge of various technologies and libraries. In such a tandem, AI helps you focus on key project aspects, leaving the routine to it.
However, as we have already mentioned, AI hits the weakest spot — beginner developers, making the gap between them and professionals even wider. Experienced programmers can quickly identify AI errors, correct them, and continue working, while a novice will simply drown in these problems. Ironically, at a time when AI was conceived as a help for everyone, it currently only increases this gap.
But we should hope that in the future, AI will become more independent in programming, and then this gap may not only stop growing but disappear altogether, leveling the playing field for everyone, regardless of their level of expertise.