Bitcoin Forum
May 01, 2024, 12:10:19 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Kraken DCA Bot  (Read 326 times)
codepleb (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 20


View Profile
February 14, 2023, 08:05:29 AM
Merited by hugeblack (5), Little Mouse (1)
 #1

Hello Community

I wanted to tell you about a DCA (Dollar Cost Averaging) bot that I coded, for the crypto exchange Kraken.

Features:
  • Buys 0.0001 BTC every couple seconds/minutes/hours.
  • Spreads all buys over the span of a month (when a new fiat deposit is expected, it should have used all fiat right before).
  • Buys hundreds/thousands/millions of times per month (depending on the amount of fiat you deposit).
  • Automatic adjustments after each buy (what is the price of bitcoin now, how many more buys can I do until the end of the month, when should the next buy take place?). If the bitcoin price drops by 50%, you will not run out of fiat earlier! You will just buy less frequently.
  • Automatic withdrawals to your hardware wallet! Either monthly or when reaching a certain bitcoin-stacking target on Kraken.
  • All open source and no compiled code. You can read it yourself.
  • Can be used with docker
  • Step by step video manuals included!

AND THE MOST IMPORTANT ONE:
The fees do not stack! Kraken has very low fees (0.26% without any trading-tier, for each transaction, which means the amount of transactions does not matter). Investing $500 each month will only cost you ~$1.30. A withdrawal to your hardware wallet will be as cheap as ~$0.07.

I use this bot myself since several months, probably close to a year.

Check it out here:
https://github.com/raphaellueckl/kraken-dca

And yes, I'm new to this forum. Smiley Read a lot here and there, but never took part in discussions.

Greetings
Codepleb
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, which will follow the rules of the network no matter what miners do. Even if every miner decided to create 1000 bitcoins per block, full nodes would stick to the rules and reject those blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714522219
Hero Member
*
Offline Offline

Posts: 1714522219

View Profile Personal Message (Offline)

Ignore
1714522219
Reply with quote  #2

1714522219
Report to moderator
hugeblack
Legendary
*
Offline Offline

Activity: 2492
Merit: 3625


Buy/Sell crypto at BestChange


View Profile WWW
February 18, 2023, 04:49:53 PM
 #2

It's good that you made it open source, but why just Kraken? Does it work with different platforms? Or does it only work with that platform?
Is the time interval an hour as a maximum, or can many hours be added to represent a week, or once a month?
Also, in the event of any technical error, is it possible to withdraw to an address that is not in the white list, or can you add any address to withdraw.

I will give it a try if it works with OKX. Smiley

.BEST..CHANGE.███████████████
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
███████████████
..BUY/ SELL CRYPTO..
codepleb (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 20


View Profile
February 19, 2023, 07:43:50 PM
Merited by LoyceV (4), hugeblack (4)
 #3

It's good that you made it open source, but why just Kraken? Does it work with different platforms? Or does it only work with that platform?

It only works for kraken. Doing that for other exchanges would be best achieved by writing another bot, as every exchange has different APIs to talk to.

Is the time interval an hour as a maximum, or can many hours be added to represent a week, or once a month?

One hour is not any time interval defined by me? I think there is a misunderstanding: You deposit, say, 500 dollars each month. The bot will notice that you did a deposit and reserves time for another month in which it will buy bitcoin until that time is over. It will always buy 0.0001 bitcoin (if you don't adapt this value). At the current price (24'700$) it could execute 204 times the 0.0001 bitcoin buy order. It will spread those buys equally over the next month, so that you run out of money until that month has ended. Since the price changes all the time, it will permanently adjust itself though, so that you don't run out of fiat too fast or too late. The highest prio is to have 0 fiat in your account by the end of that timespan (a month). And it will permanently adjust itself to the current bitcoin price after each executed buy order.

Say you deposit on the 15th of a month, it will use up all your fiat until the 15th of the next month!

Also, in the event of any technical error, is it possible to withdraw to an address that is not in the white list, or can you add any address to withdraw.

No, the bot cannot withdraw to random bitcoin addresses. You explicitly need to define those in your kraken account and give an alias to them. The bot itself will only know the alias, not the actual address. The bot has no idea where the bitcoins will be sent to.

Example, on kraken you will need to add your bitcoin withdrawal addresses combined with aliases that might look like this:

Alias: my-ledger
Address: bc1qiowrjovglnlsgfn

Alias: metamask-hotwallet
Address: bc1jhadashjdkjashd

Greetings!
LoyceV
Legendary
*
Offline Offline

Activity: 3290
Merit: 16577


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
February 21, 2023, 02:39:33 PM
 #4

You deposit, say, 500 dollars each month. The bot will notice that you did a deposit and reserves time for another month in which it will buy bitcoin until that time is over. It will always buy 0.0001 bitcoin (if you don't adapt this value). At the current price (24'700$) it could execute 204 times the 0.0001 bitcoin buy order. It will spread those buys equally over the next month, so that you run out of money until that month has ended.
But why? What's the point of making 204 small buys instead of just buying $500 worth of Bitcoin at once?
DCA is only worth it if the price drops. In that case, you'll end up with more Bitcoin. But if the price goes up, you would have been better off buying in a lump sum. And even if you buy $500 "lump sum", it's still considered DCA if you do it every month.
Because Bitcoin goes up on average (why else would you invest in it), I believe your DCA-method will result in a (slightly) smaller Bitcoin stash than if you'd buy $500 worth of Bitcoin once a month.

codepleb (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 20


View Profile
February 21, 2023, 03:35:36 PM
Merited by hugeblack (4), LoyceV (2)
 #5

But why? What's the point of making 204 small buys instead of just buying $500 worth of Bitcoin at once?
DCA is only worth it if the price drops. In that case, you'll end up with more Bitcoin. But if the price goes up, you would have been better off buying in a lump sum. And even if you buy $500 "lump sum", it's still considered DCA if you do it every month.
Because Bitcoin goes up on average (why else would you invest in it), I believe your DCA-method will result in a (slightly) smaller Bitcoin stash than if you'd buy $500 worth of Bitcoin once a month.

It takes away the stress, as you no longer time the market, but buy as often as possible at all prices. That's the beauty of DCA. Smiley If you try to time the market, history shows that your performance will be worse on average. Are you sure that you will buy every month, using your strategy? Or will you wait because tomorrow, the dip will be even bigger (potentially)?

I understand your theory, but I doubt that your psychology will not interfere with it.

And what if you buy 500$ at the beginning of the month and the day after bitcoin is at 30% discount... Won't you pull your hair, because you could have waited just one more day?

Doing DCA completely takes out all stress for me. Price dips: My stash gets less valuable, but I buy bitcoin at cheaper prices all the time. Price moons: My stash gets more valuable, but my buys get less frequent due to them becoming more expensive.

I literally cannot lose with this strategy. Since I'm doing DCA, I notice how disconnected I can be from all the volatility and go on live my life in peace.

But that's an individual decision, the need differs between people. I absolutely love it!

Cheers! Smiley
LoyceV
Legendary
*
Offline Offline

Activity: 3290
Merit: 16577


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
February 21, 2023, 03:56:28 PM
Merited by codepleb (2)
 #6

It takes away the stress, as you no longer time the market, but buy as often as possible at all prices.
My stress-free method of doing that is buying/selling at fixed days, either monthly or weekly.

Quote
Are you sure that you will buy every month, using your strategy?
Yes.

Quote
I understand your theory, but I doubt that your psychology will not interfere with it.
I've learned a long time ago that I can't time the market.

Quote
And what if you buy 500$ at the beginning of the month and the day after bitcoin is at 30% discount... Won't you pull your hair, because you could have waited just one more day?
Yes, it happens. But it happens in the other direction too.

Quote
I literally cannot lose with this strategy.
Sure you can. If Bitcoin goes up, you could have had more by buying sooner*. If it goes down, your purchasing power goes down.

Quote
I absolutely love it!
That's what matters. If it works for you, keep doing it Smiley

* Hypothetical, of course. The same "problem" exists if you spend Bitcoin, and it increases in value afterwards. But as I read on the Wall Observer a while ago: "That's the problem we want to have".

codepleb (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 20


View Profile
March 29, 2023, 08:08:45 AM
 #7

New Update:
- Made the code more error proof (some errors were not catched and could shutdown the bot).
- Made checking cycle from 10 Minutes to 1 Minute (still customizable, if you want to adapt this value).

How to update:
https://github.com/raphaellueckl/kraken-dca#updates

Don't forget to join the discord! Smiley https://discord.gg/TARdDh4hN8
Little Mouse
Legendary
*
Offline Offline

Activity: 2030
Merit: 1979


Marketing Campaign Manager |Telegram ID- @LT_Mouse


View Profile WWW
March 30, 2023, 07:20:01 AM
 #8

Is volatility should be considered when you plan DCA? In DCA, usually people set amount, frequency. No matter what the price is, they will buy in the fixed period and with the exact amount. When you are buying frequently adjusting with the volatility, you are trying to get the benefit of a dump etc.
Well, the same can be done through your bot too and it's helpful for people who don't want to take the stress of buying manually at their fixed period.

Do you have plan to make it available for Binance? Maybe I would give it a try for different purposes.

██████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
██████████████████████
.SHUFFLE.COM..███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
█████████████████████
████████████████████
██████████████████████
████████████████████
██████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
██████████████████████
██████████████████████
██████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
.
...Next Generation Crypto Casino...
codepleb (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 20


View Profile
April 02, 2023, 08:05:20 PM
 #9

Is volatility should be considered when you plan DCA? In DCA, usually people set amount, frequency. No matter what the price is, they will buy in the fixed period and with the exact amount. When you are buying frequently adjusting with the volatility, you are trying to get the benefit of a dump etc.
Well, the same can be done through your bot too and it's helpful for people who don't want to take the stress of buying manually at their fixed period.

Do you have plan to make it available for Binance? Maybe I would give it a try for different purposes.

Not really. I wrote this bot for me, but thought it would be of use for others too, as this is a much requested feature by a lot of people. Smiley

I don't need to buy bitcoin on several exchange. One exchange with good fees is totally fine for me. It's not really a risk either, as I withdraw it at least once a month (can be adjusted too). I would obviously swap it for another exchange, if kraken would go down or if they would increase fees tremendously, but at the moment they are amongst the cheapest permanent fees over all exchanges.

Cheers
codepleb
LoyceV
Legendary
*
Offline Offline

Activity: 3290
Merit: 16577


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
April 05, 2023, 08:36:13 AM
 #10

I don't think that most people will trust kraken cause it has bad reputation and it's not working good.
Kraken works fine and I have no reason not to trust them. Your claim needs more convincing evidence than just stating it as if it's a fact.

codepleb (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 20


View Profile
April 05, 2023, 11:09:47 AM
 #11

I don't think that most people will trust kraken cause it has bad reputation and it's not working good. So I I'll say that You should make This DCA bot for Kucoin or Bitget and as people like these an there are a lot of funds that are on Bitget.
And also these two exchanges have their own Bots and they ate working fine so I think if really someone wants to run Bit than they can go to the Kucoin Bot.

Not trusting kraken but trusting kucoin instead? That's exactly my humor. :'D

If you don't trust kraken, the only thing left for you are DEX, as there isn't an exchange with a security as prooven as kraken to this day. Not a single hack. Unlike binance, unlike kucoin, unlike [name any exchange older than 3 years].
codepleb (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 20


View Profile
June 05, 2023, 03:15:24 PM
 #12

Catch-All-Errors Update:
- Bot should no longer stop upon networking issues or Kraken API being down.
- Added support for AUD currency.

How to update:
https://github.com/raphaellueckl/kraken-dca#updates

Don't forget to join the discord! Smiley https://discord.gg/TARdDh4hN8
Zoomic
Sr. Member
****
Offline Offline

Activity: 420
Merit: 252


My post made philipma1957 wear signature


View Profile
June 06, 2023, 10:53:54 AM
Last edit: June 08, 2023, 11:01:08 PM by Zoomic
 #13

But why? What's the point of making 204 small buys instead of just buying $500 worth of Bitcoin at once?

And what if you buy 500$ at the beginning of the month and the day after bitcoin is at 30% discount... Won't you pull your hair, because you could have waited just one more day?

What if the bot bought 0.0001btc for me today and by tomorrow I discover that bitcoin is in 40% discount. Is there a way I will maneuver or stop the bot DCA process and then manually buy with my remaining let's say $450. By the next circle I can re-start with the bot.

In other words, the bot should be able to increase the buy amount with respect to percentage discount offered by bitcoin at every given period of time.

LoyceV
Legendary
*
Offline Offline

Activity: 3290
Merit: 16577


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
June 06, 2023, 01:16:52 PM
 #14

Is there a way I will maneuver or stop the bot DCA process and then manually buy with my remaining let's say $450.
Just place a manual order, after that, the bot will be out of funds and can't buy more.

bettercrypto
Sr. Member
****
Offline Offline

Activity: 1316
Merit: 268


★Bitvest.io★ Play Plinko or Invest!


View Profile WWW
June 06, 2023, 11:21:29 PM
 #15

But why? What's the point of making 204 small buys instead of just buying $500 worth of Bitcoin at once?
DCA is only worth it if the price drops. In that case, you'll end up with more Bitcoin. But if the price goes up, you would have been better off buying in a lump sum. And even if you buy $500 "lump sum", it's still considered DCA if you do it every month.
Because Bitcoin goes up on average (why else would you invest in it), I believe your DCA-method will result in a (slightly) smaller Bitcoin stash than if you'd buy $500 worth of Bitcoin once a month.

It takes away the stress, as you no longer time the market, but buy as often as possible at all prices. That's the beauty of DCA. Smiley If you try to time the market, history shows that your performance will be worse on average. Are you sure that you will buy every month, using your strategy? Or will you wait because tomorrow, the dip will be even bigger (potentially)?

I understand your theory, but I doubt that your psychology will not interfere with it.

And what if you buy 500$ at the beginning of the month and the day after bitcoin is at 30% discount... Won't you pull your hair, because you could have waited just one more day?

Doing DCA completely takes out all stress for me. Price dips: My stash gets less valuable, but I buy bitcoin at cheaper prices all the time. Price moons: My stash gets more valuable, but my buys get less frequent due to them becoming more expensive.

I literally cannot lose with this strategy. Since I'm doing DCA, I notice how disconnected I can be from all the volatility and go on live my life in peace.

But that's an individual decision, the need differs between people. I absolutely love it!

Cheers! Smiley

It's so nice to see and doing DCA helps you at the same time to take away your stress, I hope everyone who does DCA is like you, anyway, is what you're saying bot really tested? I hope you showed at least a screenshot so that those who see what you are saying will be familiar.

Then @hugeblack is right why only kraken? it might that kraken isn't accepted by all countries, or it could be that country will be restricted there? Though there is a video tutorial, I will watch it to be familiarize with those guidelines as well.



BIG WINNER!
[15.00000000 BTC]


▄████████████████████▄
██████████████████████
██████████▀▀██████████
█████████░░░░█████████
██████████▄▄██████████
███████▀▀████▀▀███████
██████░░░░██░░░░██████
███████▄▄████▄▄███████
████▀▀████▀▀████▀▀████
███░░░░██░░░░██░░░░███
████▄▄████▄▄████▄▄████
██████████████████████
▀████████████████████▀
▄████████████████████▄
██████████████████████
█████▀▀█▀▀▀▀▀▀██▀▀████
█████░░░░░░░░░░░░░▄███
█████░░░░░░░░░░░░▄████
█████░░▄███▄░░░░██████
█████▄▄███▀░░░░▄██████
█████████░░░░░░███████
████████░░░░░░░███████
███████░░░░░░░░███████
███████▄▄▄▄▄▄▄▄███████
██████████████████████
▀████████████████████▀
▄████████████████████▄
███████████████▀▀▀▀▀▀▀
███████████▀▀▄▄█░░░░░█
█████████▀░░█████░░░░█
███████▀░░░░░████▀░░░▀
██████░░░░░░░░▀▄▄█████
█████░▄░░░░░▄██████▀▀█
████░████▄░███████░░░░
███░█████░█████████░░█
███░░░▀█░██████████░░█
███░░░░░░████▀▀██▀░░░░
███░░░░░░███░░░░░░░░░░
▀██░▄▄▄▄░████▄▄██▄░░░░
▄████████████▀▀▀▀▀▀▀██▄
█████████████░█▀▀▀█░███
██████████▀▀░█▀░░░▀█░▀▀
███████▀░▄▄█░█░░░░░█░█▄
████▀░▄▄████░▀█░░░█▀░██
███░▄████▀▀░▄░▀█░█▀░▄░▀
█▀░███▀▀▀░░███░▀█▀░███░
▀░███▀░░░░░████▄░▄████░
░███▀░░░░░░░█████████░░
░███░░░░░░░░░███████░░░
███▀░██░░░░░░▀░▄▄▄░▀░░░
███░██████▄▄░▄█████▄░▄▄
▀██░████████░███████░█▀
▄████████████████████▄
████████▀▀░░░▀▀███████
███▀▀░░░░░▄▄▄░░░░▀▀▀██
██░▀▀▄▄░░░▀▀▀░░░▄▄▀▀██
██░▄▄░░▀▀▄▄░▄▄▀▀░░░░██
██░▀▀░░░░░░█░░░░░██░██
██░░░▄▄░░░░█░██░░░░░██
██░░░▀▀░░░░█░░░░░░░░██
██░░░░░▄▄░░█░░░░░██░██
██▄░░░░▀▀░░█░██░░░░░██
█████▄▄░░░░█░░░░▄▄████
█████████▄▄█▄▄████████
▀████████████████████▀




Rainbot
Daily Quests
Faucet
codepleb (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 20


View Profile
September 18, 2023, 08:32:31 PM
 #16

Then @hugeblack is right why only kraken? it might that kraken isn't accepted by all countries, or it could be that country will be restricted there? Though there is a video tutorial, I will watch it to be familiarize with those guidelines as well.

I use kraken and did this project for myself and shared it with others too. I don't see a need to support any other less prooven exchanges as long as kraken is cheap, up and running fine.

But feel free to port this to other exchanges.

BTW sorry I manually checked this thread. I don't get email notifications. Probably did that on purpose back then.
I'm using this bot and didn't abandon it. And I work on it when I see new requirements or bugs.
SamReomo
Hero Member
*****
Offline Offline

Activity: 784
Merit: 673


Top Crypto Casino


View Profile
September 22, 2023, 10:47:12 PM
 #17

I use kraken and did this project for myself and shared it with others too. I don't see a need to support any other less prooven exchanges as long as kraken is cheap, up and running fine.


I think it will be better to make a similar bot for other exchanges as well. As you're good at programming and you can make those bots for the users of other exchanges in your free time. A lot of members on this forum aren't Kraken users and that's why it's better to make a similar bot for some other famous exchanges that people use. I would also recommend you to add daily and weekly interval option into the bot.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!