top | item 27229436

Show HN: Ninjabot – A fast cryptocurrency bot implemented in Go

107 points| rodrigobrito | 4 years ago |github.com

55 comments

order

danuker|4 years ago

I 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

[2] - https://qoppac.blogspot.com/2021/04/trading-and-investing-pe...

argvargc|4 years ago

Bitcoin averaged 300% returns YoY the past decade (most other crypto followed to a degree, or did similar or better - with some doing worse).

Anyone looking for a trading strategy, automated or not, needs to consistently beat such numbers to do anything other than lose money versus just buying and holding.

Given prior (lack of) success in every other market this kind of thing has been attempted, makes this a hugely tall-order. The most successful quant firms all average well under 100% returns, even with years of experience, armies of experts, and loads of investment in assets and infrastructure.

Buying and holding crypto already outdoes them (massively). Why take on greater risk and spend time to try and get yet more out of such a market?

dmos62|4 years ago

If 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.

asdev|4 years ago

what does this have to do with OP's post? Does the book directly contradict OP's work

user-the-name|4 years ago

This is trading cryptocurrencies, so the actual greatest risks are: Exchanges frontrunning you and manipulating the market, exchanges just taking your money and running, prices crashing without you being able to sell your assets, and all kinds of other stuff.

Cryptocurrency is NOT a market you want to be in.

hummel|4 years ago

I'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.

chasebank|4 years ago

Our PHD quant spent his first 5 years at a prop shop, 7 years at CME, 5 at Trading Technologies before consulting. He said it took him his entire career to realize that the name of the game is risk management, not seeking alpha. Happy to pay his $500/hr for lessons learned. Worth his weight in gold.

throwaway77384|4 years ago

It'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.

zomglings|4 years ago

I'm curious about the frontrunning.

How much of it is based on social dynamics/having access to the right social networks vs. monitoring transactions vs. monitoring mempool/transaction pool?

snissn|4 years 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%?

throwaway4good|4 years ago

Yeah 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|4 years ago

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)

rodrigobrito|4 years ago

Hi, 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.

senectus1|4 years ago

could be wrong here.. but I think Change means ups AND downs...

SRTP|4 years ago

Everyone's a genius in a bull market.

woah|4 years ago

Everyone’s a genius in the hacker news comment section

dmos62|4 years ago

That'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.

ForHackernews|4 years ago

Can 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|4 years ago

Some 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 ;-)

askmike|4 years ago

This 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

rodrigobrito|4 years ago

Yes, 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.!

multimedial|4 years ago

Where 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.

leppr|4 years ago

In 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.

multimedial|4 years ago

SOmething 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/...

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|4 years ago

You 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.

debarshri|4 years ago

I have a completely different question. What make a program, bot? Why isn't this called service or app or utility?

Just curious.

kuroguro|4 years ago

The 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?

multimedial|4 years ago

Tried 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.

sharperguy|4 years ago

Took me some time to realize that this is a trading bot. Seems relavant to specify that.

SideburnsOfDoom|4 years ago

All the benefits of cryptocurrency plus all the benefits of High-frequency trading?

We're doomed.