Re:Show HN: Ninjabot – A fast cryptocurrency bot implemented...
by throwaway4good on Friday May 21, 2021 @12:49AM
(#27230616)
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.
Re:Show HN: Ninjabot – A fast cryptocurrency bot implemented...
by viraptor on Friday May 21, 2021 @12:49AM
(#27230617)
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)
Re:Show HN: Ninjabot – A fast cryptocurrency bot implemented...
by dmos62 on Friday May 21, 2021 @05:55AM
(#27232154)
Haha, 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
Re:Show HN: Ninjabot – A fast cryptocurrency bot implemented...
by rodrigobrito on Friday May 21, 2021 @06:24AM
(#27232293)
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.
> 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%?