Coder Social home page Coder Social logo

juanparker1 / accbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crynners/accbot

0.0 0.0 0.0 173 KB

AccBot is an open-source accumulation bot that incrementally purchases BTC based on a DCA strategy to accumulate your portfolio

License: MIT License

C# 70.74% PowerShell 29.21% Batchfile 0.05%

accbot's Introduction

Community Chat MIT License PR's Welcome GitHub Release Github All Releases

Přečíst README v češtině

Introduction

Welcome to AccBot. AccBot is an open-source accumulation bot that buys BTC (possibly LTC, ETH, XMR or DASH and others) at regular intervals in small amounts of FIAT (CZK, EUR, USD and others) on the most popular exchanges (see the list below) according to the DCA strategy.

List of supported exchanges:

Why DCA?

Why AccBot?

There are many different bots for buying cryptocurrencies, but quite often they are closed applications where you need to register, fill in API keys and the bot then buys/trade for you according to the rules. The downside is that the app probably collects data and statistics about your purchases, the code is closed, so you don't have full control over what the bot will actually do. Our solution is fully decentralized in that everyone installs their own bot in their own environment. Thus, individual user bots are fully decoupled and no data is collected centrally anywhere. Everyone's statistics are stored in their own DB, which are then dumped at will to private Telegram channels.

A simple description of how the AccBot works

  • It buys a user-defined amount in Czech crowns (typically tens of CZK) / Euros (typically units of Euros) every user-defined hours (ideally divisible by 24, so that it always buys at the same time, e.g. -> every hour, 1x in 2h, 1x in 4h, 1x in 8h, etc.).
  • It runs autonomously without the need to manage it somehow over time, you only need to keep track of your CZK account balance and replenish it regularly on the exchange (e.g. once a month).
  • Operating costs are practically zero (it comes out to about 0.04 €/month for Azure hosting); the bot is implemented as Azure function for now, which runs at regular intervals and the whole solution is thus hosted on Azure.
  • (Optional functionality) After each purchase, the Telegram channel informs you of the amount of the purchase. This information is supplemented with statistics, what is the current average accumulated price, etc. See example:
    • image
  • (Optional functionality) If a sufficient amount of BTC is accumulated, then if the withdrawal fee from the total amount is less than the user defined limit (e.g. 0.1%), the bot will send the accumulated amount of BTC from the exchange to the defined BTC wallet (note: if you want to use this functionality, we recommend enabling API send only to your specific BTC wallet, see settings when creating an API key on Coinmate)
    • image

Pre-requisites

  1. Installed PowerShell

  2. Installed Azure CLI

  3. An established account on any supported exchange

    • If you would like to support us and sign up through our referral link, you can click on the banners below

    Registration link via referral

  4. An account on Azure (the account is free; you only pay for the funds used, which comes out to about $0.04/month)

Installation procedure

  1. Generate API keys on your exchange. E.g. for Coinmate is instructions for generating keys here. This step is important to allow AccBot to access funds on the exchange and perform its accumulation activity. Write down the generated ClientId, PublicKey and PrivateKey in your notepad -> you will need them in step 5.

    • ATTENTION: You need to add Trading permissions to the API keys, see:

    image.

    • If you'd like to use the autowithdrawal feature, check the "Enable for Withdrawal" option as well. In this case, we recommend that you also check "Enable for withdrawals to template addresses only", which means that the bot will only be able to send accumulated BTC to the addresses you define, see:

    image

  2. Download the ZIP from the current RELEASE, which contains the PowerShell installation script and the built bot.

  3. Unzip the ZIP from the previous point anywhere on your filesystem. 5.(Optional) Set up Telegram notifications. (If, despite the recommendation, you do not want to use Telegram notifications, do not fill in the Telegram variables in the next step)

  4. In Notepad (or another text editor), first open the init_variables.ps1 file, which contains the general settings for the bot

  5. Edit the variables in the ## USER-DEFINED VARIABLES ### section.

######################################
### GENERAL USER-DEFINED VARIABLES ###
######################################
# Exchange you want to link the bot to
# (POSSIBLE VALUES: coinmate, huobi, binance, kraken, ftx, coinbase, kucoin, bitfinex, bittrex)
$ExchangeName='coinmate'

#Name that appears in Telegram notifications
$Name='anonymous'

# The name of the AccBot you want to deploy. Used when you want to accumulate multiple pairs at once.
# Usage: 
# 1. Run the script with e.g. AccBotName='BTC-AccBot' with the configuration for the first bot
# 2. Run a script with e.g. AccBotName='ETH-AccBot' with the configuration for the second bot
# (ALLOWED VALUES: "a-z", "0-9", "-")

$AccBotName='BTC-AccBot'

################################################
########### Timer settings #####################
################################################
# You have the option to fill in either the $HourDivider or $NCronTabExpression variable

# If you want to buy every X hours (less than once per day), which is also the recommended setting (more often in smaller batches), fill in HourDivider
# HourDivider specifies how many hours you want to shop regularly
# (POSSIBLE VALUES: 1, 2, 3, 4, 6, 8, 12)

$HourDivider='1'

# If you only want to shop once every 2 days, once a week, or e.g. every Tuesday and Saturday, fill in $NCronTabExpression
# The format of this variable is in NCRONTAB, see: https://docs.microsoft.com/cs-cz/azure/azure-functions/functions-bindings-timer?tabs=csharp#ncrontab-expressions
# Examples:
# "0 0 */2 * * * *" -> once every two hours
# "0 30 9 * * * 1-5" -> at 9:30 every working day
# Online NCRONTAB value generator: https://ncrontab.swimburger.net/

$NCronTabExpression = ''

################################################
########### Exchange selection settings ########
################################################

# Flag if you want to enable Withdrawal if the fee is less than 0.1% 
# ALLOWED VALUES: true / false
$WithdrawalEnabled='false'

# Wallet address for withdraw (only applies if WithdrawalEnabled = TRUE)
$WithdrawalAddress=''

# (Only applied if $WithdrawalEnabled='true'). 
# Maximum withdrawal fee limit in percentage.
# DEFAULT: 0.001 = 0.1 %
$MaxWithdrawalPercentageFee = '0.001'

################################################
########### Telegram Settings ##################
################################################

# Address of the telegram channel you want to receive notifications to (in @ChannelName format)
$TelegramChannel='@channel_name'

# Private key of the Telegram bot (ATTENTION, the bot must be a member of the channel above)
$TelegramBot='telegram_bot_hash'

################################################
########### Azure log settings #################
################################################

The # flag to create a log on Azure. (ALLOWED VALUES: true / false). 
# RECOMMENDATION: By default have it disabled, i.e. "false". 
# Log increases the monthly cost from approx 0.04€/month to approx 0.2€/month. 
# So it is recommended to turn it on only if your bot for example does not purchase as it should. 

$CreateAzureLog = 'false'

##################################
### END USER-DEFINED VARIABLES ###
##################################
  1. After saving the general configuration, open the configuration file coinmate_variables.ps1 or huobi_variables.ps1 depending on which exchange you want to accumulate on.
  • For Coinmate, fill in the following values:
# Crypto you want to buy on Coinmate (POSSIBLE VALUES: BTC, LTC, ETH, XRP, DASH)
$Currency='BTC'

# Fiat currency you want to buy crypto with on Coinmate (POSSIBLE VALUES: CZK, EUR)
$Fiat='CZK'

# Size of the chunk in CZK or EUR you want to buy regularly (MINIMUM for CZK: 26; MINIMUM for EUR: 1)
$ChunkSize='26'

# ClientId from Coinmate API
$CoinMateCredentials_ClientId='111'

# Public key from Coinmate API
$CoinMateCredentials_PublicKey='XXX'

# Private key from Coinmate API
$CoinMateCredentials_PrivateKey='XXX'

# (Only used when $WithdrawalEnabled='true'). 
# Maximum withdrawal fee limit in absolute value (CZK)
# If set to -1, only the percentage condition is applied => $MaxWithdrawalPercentageFee
$MaxWithdrawalAbsoluteFee = -1
  • For Huobi, fill in the following values:
# Crypto you want to buy on Huobi (POSSIBLE VALUES: BTC, LTC, ETH, XRP, DASH)
$Currency='BTC'

# Fiat currency you want to buy crypto with on Huobi (POSSIBLE VALUES: USDT, HUSD)
$Fiat='USDT'

# The size of the USDT or HUSD chunk you want to buy regularly (MINIMUM: 5)
$ChunkSize='5'

# API Key from Huobi API
$HuobiCredentials_Key='XXX'

# API Secret from Huobi API
$HuobiCredentials_Secret='XXX'
  • For Kraken, fill in the following values:
# Crypto you want to buy on Kraken (POSSIBLE VALUES: BTC, LTC, ETH, XRP, DASH)
$Currency='BTC'

# Fiat currency you want to buy crypto with on Kraken (POSSIBLE VALUES: USDT)
$Fiat='USDT'

# The size of the USDT (or $Fiat) chunk you want to buy regularly (MINIMUM: by exchange)
$ChunkSize='5'

# Name of the wallet you want to send the accumulated crypto to
$WithdrawalKeyName = ''

# API Key from Kraken API
$KrakenCredentials_Key='XXX'

# API Secret from Kraken API
$KrakenCredentials_Secret='XXX'
  • In case of Binance fill in the following values:
# Crypto you want to buy on Binance (POSSIBLE VALUES: BTC, LTC, ETH, XRP, DASH, ...)
$Currency='BTC'

# Fiat currency you want to buy crypto with on Binance (POSSIBLE VALUES: USDT, BUSD, USDC, DAI)
$Fiat='USDT'

# The size of the USDT (or $Fiat) chunk you want to buy regularly (MINIMUM: by exchange)
$ChunkSize='10'

# API Key from Binance API
$BinanceCredentials_Key='XXX'

# API Secret from Binance API
$BinanceCredentials_Secret='XXX'
  • For FTX, fill in the following values:
# Crypto you want to buy on Binance (POSSIBLE VALUES: BTC, LTC, ETH, XRP, DASH, ...)
$Currency='BTC'

# Fiat currency you want to buy crypto with on Binance (POSSIBLE VALUES: USDT, BUSD, USDC, DAI)
$Fiat='USDT'

# The size of the USDT (or $Fiat) chunk you want to buy regularly (MINIMUM: by exchange)
$ChunkSize='5'

# API Key from Binance API
$FTXCredentials_Key='XXX'

# API Secret from Binance API
$FTXCredentials_Secret='XXX'
  • For Bitfinex, fill in the following values:
# Crypto you want to buy on Kraken (POSSIBLE VALUES: BTC, LTC, ETH, XRP, DASH)
$Currency='BTC'

# Fiat currency you want to buy crypto with on Kraken (POSSIBLE VALUES: USDT)
$Fiat='USDT'

# The size of the USDT (or $Fiat) chunk you want to buy regularly (MINIMUM: by exchange)
$ChunkSize='5'

# Name of the wallet you want to send the accumulated crypto to
$WithdrawalKeyName = ''

# API Key from Bitfinex API
$BitfinexCredentials_Key='XXX'

# API Secret from Bitfinex API
$BitfinexCredentials_Secret='XXX'
  • For KuCoin, fill in the following values:
# Crypto you want to buy on Huobi (POSSIBLE VALUES: BTC, LTC, ETH, XRP, DASH)
$Currency='BTC'

# Fiat currency you want to buy crypto with on Huobi (POSSIBLE VALUES: USDT, HUSD)
$Fiat='USDT'

# The size of the USDT or HUSD chunk you want to buy regularly (MINIMUM: 5)
$ChunkSize='5'

# API Key from KuCoin API
$KuCoinCredentials_Key='XXX'

# API Secret from KuCoin API
$KuCoinCredentials_Secret='XXX'

# API PassPhrase from KuCoin API
$KuCoinCredentials_PassPhrase='XXX'
  • For Coinbase, fill in the following values:
# Crypto you want to buy on Kraken (POSSIBLE VALUES: BTC, LTC, ETH, XRP, DASH)
$Currency='BTC'

# Fiat currency you want to buy crypto with on Kraken (POSSIBLE VALUES: USDT)
$Fiat='USDT'

# The size of the USDT (or $Fiat) chunk you want to buy regularly (MINIMUM: by exchange)
$ChunkSize='5'

# Name of the wallet you want to send the accumulated crypto to
$WithdrawalKeyName = ''

# API Key from Coinbase API
$CoinbaseCredentials_Key='XXX'

# API Secret from Coinbase API
$CoinbaseCredentials_Secret='XXX'
  • For Bittrex, fill in the following values:
# Crypto you want to buy on Kraken (POSSIBLE VALUES: BTC, LTC, ETH, XRP, DASH)
$Currency='BTC'

# Fiat currency you want to buy crypto with on Kraken (POSSIBLE VALUES: USDT)
$Fiat='USDT'

# The size of the USDT (or $Fiat) chunk you want to buy regularly (MINIMUM: by exchange)
$ChunkSize='5'

# Name of the wallet you want to send the accumulated crypto to
$WithdrawalKeyName = ''

# API Key from Bittrex API
$BittrexCredentials_Key='XXX'

# API Secret from Bittrex API
$BittrexCredentials_Secret='XXX'

9.

  • : Double-click to run run.bat file (For Windows OS).
  • / : Run PowerShell and execute the command in PowerShell
    powershell.exe -executionpolicy bypass -file .\install_script.ps1

The script will automatically prepare all the resources you need on Azure. It should also pop up the Azure portal login window at the beginning.

** WARNING: The installation takes a few minutes, please wait for it to complete.** The following message should appear at the end:

image

(Optional) Telegram notifications settings

This part is not mandatory for the bot to work, however it is a great added value as the bot will periodically inform you after each purchase what your average BTC accrued price is and how many BTC you have already accrued. You will also be able to verify in real time that the bot is working.

  1. Create an account on Telegram

  2. Create a bot via BotFather according to instructions.

    • The token from the tutorial is then inserted into the $TelegramBot variable from the PowerShell script
  3. Create a new channel (video tutorial to create from the mobile app -> Android or iOS version). Alternatively, follow the following printscreen -> create via Telegram desktop.

    • In the top left corner, click on settings

    image

    • Click on the New Channel button

    image

    • Name your channel and confirm the creation with the button

    image

    • Mark the channel as Public and come up with a unique name for it. This name is then filled in the format @MyAccBotChannel (in the case of the example below) in the $TelegramChannel variable in the powershell script image
    • To set the created channel as Private do the following:
  4. Invite your bot (search for it by name) that you created in step 2 via BotFather to the channel. image

    • Confirm the bot as a channel administrator

    image

    • Leave the default permissions of the bot

    image

  5. Done, the bot should now write information about purchases with statistics to the created channel.

FAQ

Q: How can I change the settings of a running AccBot?

A: If AccBot is already running successfully and you want to change some settings over time (frequency or amount of individual purchases, withdrawal permissions, etc.), the easiest way is to edit USER-DEFINED VARIABLES in the installation script install_script.ps1 and run the script again according to step 9 of the installation instructions.

Q: How to deploy a new version of AccBot?

A: Download the ZIP from the current RELEASE, set up the configuration files init_variables.ps1 and {burst you want to accumulate} variables.ps1 and re-run the script according to step 7 of the installation instructions.

Q: Can I accumulate BTC and ETH at the same time?

A: Yes. Just run the script according to step 7 of the installation guide with the configuration of the 1st bot (i.e. accumulation to BTC), and then run the script with the configuration of the 2nd bot.
⚠️CAUTION: You need to change the $AccBotName variable (AccBot name) in the init_variables.ps1 configuration file.

Donate

heart_donate

We decided to provide AccBot completely free of charge, as we want to give as many people as possible the easiest and cheapest way to apply the DCA strategy. We believe that saving regularly in Bitcoin is the best way to secure for the future. In fact, investing in BTC with emotions involved and with ambitions to predict the market does not pay off in most cases.

If you'd like to support us, we certainly won't stop you from doing so. Below are the individual wallets where you can send us a donation, for example for a beer. :) Thank you <3

  • BTC ❤️: bc1q2hz79m4csklecqgusu9e2yjnrr6e9ca6nhu0at
  • LTC: LTXdCFBYHgVLa8cBNBqwEvaQLi8tENY5R3
  • XMR: 49QBko3UdegAkx6g8foqjs9efQD6rrhsPEoTqP9HmA2LCUZsJ8xBD2JZSMEdzhA5NJ9SrVhzu2uJXRUvL2kAiV45LyDBCUt
  • DOGE: DR9mEaVLmx3gxqiqffwYQcLsT1upRL3xe9
  • ETH: 0x8A944bcb5919dF04C5207939749C40A61f88188C
  • DOT: 15sBCVyWu5Gy9VnzQpid4ggC1MmguBBd1xotUVbsbbRWddun
  • BNB: bnb1lwcgq8emrjgptxg4hm37d5tf2yunrph842awrh
  • ADA: addr1qxgfp7xf8rpg7laque78queavpfdztajgl3hr8kuanuqgdysjruvjwxz3al6penuwpen6czj6yhmy3lrwx0dem8cqs6qr8y8fj

accbot's People

Contributors

crynners avatar hlavasim avatar pierrediancourt avatar tousekjan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.