This was a hobby project of myself to create the simplest Cryptocurrency bot possible. It was written in Python, operates on Binance, and stores all logging and trading information into a MongoDB database. The trading strategy is extremely simple:
- Assume that crypto prices will fluctuate, but eventually be restored to its original quote - Buy small quantities every time the price falls below a threshold, keeping track of the amount purchased and the price payed - Sell those exact quantities when the price is above what was payed for it
It was a lot of fun developing it, and I guess I made something around 3 dollars before shutting it down. It is my first contribution to opensource world, and I hope others can benefit from it :)
So first of all, thank you for sharing your work, I'm sure it was a lot of fun building it and making it work!
If you'll indulge me, I'll point out a few thoughts about application logic that handles money.
First of all, money related logic should be using fixed point mathematics in all places. In the case of EUR/USD fixed to 2 points behind the decimal point and in case of BTC and others, somewhere around 9-16 (can't be bothered to look it up atm). There is a cumulative error that is produced when using floating point variables. I'll be happy to share a link to a discussion, if you want!
The second thought I had was about using MongoDB for this use case. While it is great for getting started and MongoDB has made great strides at improving safety, it is still a suboptimal choice for handling financial transactions (logs or otherwise). I will also be happy to clarify why, if someone wants to discuss the matter further.
Would you mind clarifying this last bit? The default settings are not ideal and you need to do some configuration, but if you know what you're doing MongoDB has been capable of safe data storage since 3.6? What else would make it suboptimal?
Admittedly I'd probably choose postgres on a new project, given the many features. But in my dayjob I use MongoDB because of Org/Historical reasons and am not really aware of any problems that can't be mitigated. Is it just because you have to waste time mitigating common problems?
still a good idea to remove it from commit history if possible, but those secrets should be considered compromised and should be changed.
And now you even get internet karma points for it.
Seems you came out ahead. Not many people who went down the crypto rabbit hole can claim that. :-D
Just in case somebody thinks it's real and go full retard with it.
Please don't use language like this.
Hence: Please don´t be anal like this.
I would use order book data instead of ticker data, though, since you have more control of your risks regarding the exchange's liquidity.
Well done!
If all you need is ticker data, but you want separate bid/ask, and do not want 3rd party library, you can augment your results with market average from http://cmplot.com/api.json
It also come with all the fiat pairs. No TOS, no login, no nothing, it lives on XMR donation.
I did test the order book support, it indeed works and would be a nice to have feature.
The naivete here is that it only makes money if the market is rising long term. If it is falling over the long term then you'll get stuck with a bunch of losses.
The results it generates are no different than buying at random times and selling random bets at random times.
It doesn’t necessarily require long term trends to be profitable. It just requires the short term trend to be mean reverting, which is usually the case for markets.
Of course, you need a little more sophistication, stop losses and parameter tuning before you can be confident of long term profitability.
Do you know of any stock trading sites that have bots?
I wonder how much of the volume on cryptocurrency exchanges are due to bots.
I stoped mainly because I need to work on my PhD. But the code there was very solid on my tests. I hope I can get back at it early next year :)