Cryptocurrency Investor Bot

This project is a result of my recent interest in both golang, and investments into stocks. I found that while investing I was consistently executing the same flow of commands, which was to attempt to buy at a lower price, or during a dip, and sell a portion, or all of my investment when I could achieve a profit. This sort of automation is by no means a new idea, as there are proprietary tools individuals may use to automate their own trading. I saw this as an opportunity to expose myself to golang, and to create a tool for myself to automate trading.

The bot would be designed to accomplish these simple functionalities:

  1. Establish a WebSocket connection to the exchange, maintaining the connection in order to complete any transactions.
  2. Subscribe to cryptocurrency tickers. When ticker message events occur it would need to evaluate the current holdings and execute actions.
  3. Follow a pre-defined ruleset, keeping in mind strategies including stop loss, securing unrealized gains, and establishing a history in attempts to "learn".

Before I began to write functionality I had little idea on how to structure my project. I felt that the desired functionality went far beyond a single main.go file. I looked online for opinions on project structure and settled with some unoffial golang project layout standards.

Now that I had established a decent project structure I was able to move onto planning and writing functionality. My first challenge was creating an API wrapper in the golang language as I had not been able to find any supporting libraries. With the API wrapper somewhat fleshed out, I was able to begin working on likely the most difficult part of this project; determining the logic around when and why the bot should complete actions. As many cryptocurrencies are quite volatile, it is difficult to be correct with short term positions. Ideally the bot would be able to learn and understand trends in the market. This is dipping into machine learning, which I ultimately would like to integrate down the road. As a first step toward completion of this project a static ruleset around buying and selling would be adequate.