5 ms·
Show HN: Ninjabot – A fast cryptocurrency bot implemented in Go
- SRTP 5y agoEveryone's a genius in a bull market.
- woah 5y agoEveryone’s a genius in the hacker news comment section
- BobbyJo 5y agoNot everyone. Now, which one of us is the imposter?
- isaacimagine 5y agoI am— Wait!
- dmos62 5y agoThat's an important concept to grasp for newcomers. Making good trades in a trending market is relatively easy. Making money, or at least not losing money, in a ranging market is the hard part.
- snissn 5y ago> START PORTFOLIO = 10000 USDT > FINAL PORTFOLIO = 19015.904019955597 USDT > GROSS PROFIT = 9015.904020 USDT (90.16%) > MARKET CHANGE = 396.71% does this mean the bot went up 90% when the market went up 396%?
- senectus1 5y agocould be wrong here.. but I think Change means ups AND downs...
- throwaway4good 5y agoYeah the market went up 4x in the test period (see test data folder) which is from November last year until a few weeks ago (which also was about the market top). The strategy is a simple two moving averages strategy. It will capture less of the return in a very strong market but maybe protect you on the downside. The results don’t look particular good though.
- viraptor 5y agohttps://github.com/rodrigo-brito/ninjabot/blob/b9ff23d5c44d42c9bebf4d07b789207512a2299c/pkg/exchange/paperwallet.go#L95 https://github.com/rodrigo-brito/ninjabot/blob/b9ff23d5c44d4... I'm not sure this is calculated properly since marketChange is `sum(last-first)/first` (ratio) then avgMarketChange is `ratio/num_samples*100`. That's... average percent change between each sample? Doesn't sound right. (unless I misunderstand what's referenced in candles)
- dmos62 5y agoHaha, variable for first candle is `fistCandle` [0]. Pretty mangled code. Weird to have to iterate over `avgPrice` to get pairs. This is calculating the average market change across all pairs for which `avgPrice` is tracked in this PaperWallet, whatever that means. type PaperWallet struct { sync.Mutex ctx context.Context baseCoin string counter int64 takerFee float64 makerFee float64 initialValue float64 feeder Feeder orders []model.Order assets map[string]*assetInfo avgPrice map[string]float64 lastCandle map[string]model.Candle fistCandle map[string]model.Candle } [...] func (p *PaperWallet) Summary() { var ( [...] marketChange float64 ) [...] for pair, price := range p.avgPrice { [...] marketChange += (p.lastCandle[pair].Close - p.fistCandle[pair].Close) / p.fistCandle[pair].Close [...] } avgMarketChange := marketChange / float64(len(p.avgPrice)) [...] } [0] https://www.google.com/search?q=fist+candle&tbm=isch https://www.google.com/search?q=fist+candle&tbm=isch
- rodrigobrito 5y agoHi, Ninjabot author here. The idea of Market Change is to compare your strategy with the "buy and hold". It means, buys at the start of the period and sell at the and. We also use avg price, because the user can create several buys and a single sell. And the profit is based on the average price in this case.
- multimedial 5y agoSOmething that is quite vital but not mentioned anywhere in the readme is the strategy being used. Or how to develop one, for that same matter. It is a trading engine - in itself quite interesting, but limited in its usefulness by the lack of strategies. UPDATE: it has one sample strategy implemented, an EMA crosser (9/21) at https://github.com/rodrigo-brito/ninjabot/blob/main/example/strategy.go https://github.com/rodrigo-brito/ninjabot/blob/main/example/... This said, I would be very much interested in an introduction to different (simple) trading strategies with examples - does anyone know some introductory text to those?
- rodrigobrito 5y agoYou are sure, it is like a trading engine for spot market. I create some examples, but a better documentation will be great to make it more clear.
- askmike 5y agoThis looks super cool! I would love to play around with this, but the docs are a little light at the moment (unless I missed them). Would definitely recommend pushing docs and content on how to build custom strats, extend the main framework with custom reporting or new exchanges. It does Binance but it's unclear to me what product types (I'm assuming spot markets). Things I recommend exploring: (high latency) arbitrage between derivs and spot (for example cash and carry arbitrage). Or super simple funding arb on coinmargined perps (short 1x into synthetic usd). Pure directional is hard, and besides that there is a ton of alpha in more market neutral stuff. ---- A long while back I created a framework with a lot of overlapping functionality called Gekko (not trying to shill, I haven't maintained it for years). It took what I learned from that experience and build a prop trading firm called Folkvang. Crypto has a sea of opportunities ready to seize and in a bull market like we've seen in the last few months there is plenty of fish for everyone (yes there is a free lunch, even for those without a decade of quant/HFT experience from wall street). ---- play, build and have fun - can easily grow into a career
- multimedial 5y agoWhere can I learn more about the concepts you mentioned? I find it quite hard to acquire knowledge in that area as I don‘t even get to formulate the right questions.
- rodrigobrito 5y agoYes, for now it supports only spot market. The docs are very poor for now, the project is recent (a couple of weeks), but I will try to create a website for it, soon. I used Gekko for a long time, it is a great project.!
- danuker 5y agoI warmly recommend the book Systematic Trading by Robert Carver. [1] The perils of trading bots are explained in it. The author himself runs one for a long time. [2] In particular, the greatest risks are overtrading (so you get eaten up by fees), and overexposure (so you get eaten up by volatility). [1] - https://www.systematicmoney.org/systematic-trading https://www.systematicmoney.org/systematic-trading [2] - https://qoppac.blogspot.com/2021/04/trading-and-investing-performance-year.html https://qoppac.blogspot.com/2021/04/trading-and-investing-pe...
- dmos62 5y agoIf those are the greatest risks, it sounds like it's easy to buy low and sell high. I would have thought that that's the biggest challenge.
- wombat23 5y agoWell it kinda is. Empirically, you could have bought a share of the SPX at any point in time, and sold it with profit later. The real problem is what happened in the time between, and whether you were able to hold on.
- asdev 5y agowhat does this have to do with OP's post? Does the book directly contradict OP's work
- user-the-name 5y ago
- SideburnsOfDoom 5y agoAll the benefits of cryptocurrency plus all the benefits of High-frequency trading? We're doomed.
- ForHackernews 5y agoCan this quickly trade on Elon Musk tweets? Tweet => Sentiment Analysis => if + { buy } else { sell } As far as I can tell, Musktweets are the fundamentals driving the cryptocurrency market.
- progx 5y agoSome days ago a made a joke of that. I should develop a tradingbot that detects Elons positive or negative statements about a coin and buy or sell ;-)
- workallday21 5y agoI'm willing to bet multiple such bots have been implemented and are running live. It's just an obvious strategy.
- deleted 5y ago[deleted]
- hummel 5y agoI'm the CTO of a crypto hedge fund since 2014. If you are newb and want to start working with bots/algos/signals; I must advice you that when I started on early 2014, it was already late for deploying HFT. Also you compete against the frontrunning happening inside the exchanges, so traditional finance tools don't translate to crypto very well. Took me between 4-6 years to refine a valid strategy that is able to move thousands of coins at the same time and beat the crypto market on any condition. This is probably one of the hardest thing I ever did. So if you expect to make money with open source, algos, strategies, you still very far from the objective.
- throwaway77384 5y agoIt's funny, I played around on the platform kryll.io for some time. It's a place where you can use decision blocks in a drag and drop manner to compose strategies. They have a marketplace where people can share strategies, etc. The marketplace always shows these massive returns, like "30% over the last week on BTC/USDT". Nowhere do they make it clear that this includes the natural evolution of the market (lol). Worse, if a bot / strategy works for many different pairs, it cherry-picks the one that happened to have good returns that week. So far as I can tell, there are no strategies on the entire platform that outperform a bull market and in a bear market the strategies were always way too slow to pick up on things crashing. It turned into a gigantic pyramid-scheme style scam, where the fanciest imagery / language for your BS strategy was what determined how many people ended up using it. Of course you get a cut of the user's fees paid for trading. Honestly, the whole crypto-trading world seems incredibly dishonest. If kryll actually had a working product, they would advertise gains above the natural evolution of the market and gains in bear markets. They would also only charge fees on strategy profits. They do neither. Another issue I ran into quickly, is the incredibly opaque fee model of many exchanges. Take Binance: They will tell you the fees you paid for the last 3 months only, there is no place anywhere in the app or the website where they just tell you your cumulative spend on fees. And the 3 month fee CSV you can download has the fees in the cryptos traded, using their value AT THE TIME OF TRADING. So if you want to figure out the fees you paid, you have to build a thing that back-traces what a given crypto was worth at the time and calculate it from that. With bot-trading, I can tell you that that gets real complicated real quick. It's such a shame that so much of the crypto world relies on people being uninformed. I myself am a huge crypto fan and have done well just by holding. Trading hasn't worked out for me yet. I remain skeptical it ever will.
- leppr 5y agoIn typical HN fashion I'll criticize the naming: This seems to be a trading bot on centralized exchanges, so as it stands it doesn't interact with cryptocurrency and it could trade anything (not necessarily cryptocurrency). Hence at least adding "trading [bot]" would be more descriptive.
- debarshri 5y agoI have a completely different question. What make a program, bot? Why isn't this called service or app or utility? Just curious.
- kuroguro 5y agoThe way I see it it's software that does something that a human is "supposed to do". Eg chat is for humans but a chat bot will use the chat's interface for automating some tasks. Or bots in a multiplayer game take place of other players etc. Bot ~ robot ~ humanoid? I guess?
- sharperguy 5y agoTook me some time to realize that this is a trading bot. Seems relavant to specify that.
- multimedial 5y agoTried to install it on an RPI4, but failed due to different packages only available for x86. Any chance to get it to run on ARM64? I got an RPI4 sitting around which I would like to use for papertrading.
- deleted 5y ago[deleted]