{"id":22157881,"url":"https://github.com/mkbeh/rin-bitshares-arbitry-bot","last_synced_at":"2026-02-08T11:34:14.863Z","repository":{"id":37596812,"uuid":"160044380","full_name":"mkbeh/rin-bitshares-arbitry-bot","owner":"mkbeh","description":"Bitshares arbitrage-bot","archived":false,"fork":false,"pushed_at":"2023-07-20T15:09:52.000Z","size":224,"stargazers_count":10,"open_issues_count":7,"forks_count":7,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-03T01:04:25.323Z","etag":null,"topics":["arbitrage-bot","asynchronous","bitshares"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkbeh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-02T12:21:37.000Z","updated_at":"2025-02-24T20:59:15.000Z","dependencies_parsed_at":"2022-09-09T12:40:33.745Z","dependency_job_id":null,"html_url":"https://github.com/mkbeh/rin-bitshares-arbitry-bot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mkbeh/rin-bitshares-arbitry-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Frin-bitshares-arbitry-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Frin-bitshares-arbitry-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Frin-bitshares-arbitry-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Frin-bitshares-arbitry-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkbeh","download_url":"https://codeload.github.com/mkbeh/rin-bitshares-arbitry-bot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Frin-bitshares-arbitry-bot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267140646,"owners_count":24041970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arbitrage-bot","asynchronous","bitshares"],"created_at":"2024-12-02T03:16:08.206Z","updated_at":"2026-02-08T11:34:09.812Z","avatar_url":"https://github.com/mkbeh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asynchronous Bitshares arbitrage bot\nAn arbitration bot only works inside bitshares.\nThe bot builds up the volume of four assets: \nBTS, BRIDGE.BTC, CNY, USD. Market pairs are taken \nfrom third party API using the bitshares node with ES plugin. Then market pairs are added to the \nchains along which the bot works. The description \nof the arbitration algorithm is in the module \n`src.algorithms.arbitryalgorithm`. \n***\n\n### Donate\n**Donate me if you like it :)**\n```bash\nBitshares account -\u003e mkbehforever007\nbitcoin -\u003e bc1qqkr72aemz59aawxf74gytrwuw4m9mj20t7e7df\nethereum -\u003e 0xB3e5b643cFB9e2565a3456eC7c7A73491A32e31F\n```\n\n\n### Current issue\nThe problem is the incorrect calculation of \nthe final volumes for placing orders. Due to a \nsmall error in the calculations, it is not \npossible to place orders. I tried various \nsolutions to this problem, but have not yet \ncome to success.\n\n### **How bot works**\n![scheme](https://user-images.githubusercontent.com/26373902/54625801-06648b80-4a81-11e9-9c52-c7b3dcab7edd.png)\n\n\n## **Getting started**\n\n* [Installing Bitshares node and wallet](#installing-bitshares-node-and-wallet)\n    * [Configuring node](#configuring-node)\n    * [Configuring wallet](#configuring-wallet)\n* [Installing nginx](#installing-nginx)\n    * [Configuring nginx](#configuring-nginx)\n        * [Base configuration](#base-configuration)\n        * [Filling nginx.conf](#filling-nginxconf)\n        * [Adding ssl](#adding-ssl)\n* [Server security setting](#server-security-setting)\n    * [Adding SSH keys](#adding-ssh-keys)\n    * [Configuring Firewall](#configuring-ufw)\n* [Installing and usage bot](#installing-and-usage-bot)\n    * [Contents of the config.ini file](#contents-of-the-configini-file)\n    * [Adding app to supervisor](#adding-app-to-supervisor)\n    * [Logging](#logging)\n    * [Cython supporting](#cython-supporting)\n* [Milestones](#milestones)\n\n**The following actions were performed on ubuntu 18.10**\n\n### **Installing Bitshares node and wallet**\n\u003e vi /etc/apt/sources.list\n\n```bash\n# Add repo.\ndeb http://security.ubuntu.com/ubuntu xenial-security main\n```\n\n\u003e sudo apt-get update\n\n\u003e sudo apt-get install autoconf cmake make automake libtool git libboost-all-dev libssl-dev g++ libcurl4-openssl-dev libgconf-2-4 libcurl3\n\n\u003e wget https://github.com/bitshares/bitshares-core/releases/download/2.0.190219/BitShares-Core-2.0.190219-Linux-cli-tools.tar.gz\n\n\u003e tar -xzvf BitShares-Core-2.0.190219-Linux-cli-tools.tar.gz\n\n\u003e rm BitShares-Core-2.0.190219-Linux-cli-tools.tar.gz\n\n#### **Configuring node**\n\u003e sudo apt-get install supervisor\n\n\u003e sudo vi /etc/supervisor/conf.d/bts_node.conf\n```bash\n[program:bts_node]\ncommand=/home/\u003cuser\u003e/programs/witness_node/witness_node --rpc-endpoint=\"127.0.0.1:8091\"\ndirectory=/home/\u003cuser\u003e/programs/witness_node/\nstdout_logfile=/var/log/supervisor/bts_node_out.log\nstderr_logfile=/var/log/supervisor/bts_node_err.log\nautostart=true\nautorestart=true\nnumprocs=1\nuser=\u003cuser\u003e\n```\n\nWhen the node is synchronized - go to the next step.\n\n#### **Configuring wallet**\n```bash\ncd programs/cli_wallet/\n./cli_wallet --server-rpc-endpoint=ws://127.0.0.1:8091 -r 127.0.0.1:8093\nset_password \u003cyour_super_pwd\u003e\nunlock \u003cyour_super_pwd\u003e\nimport_key \u003cuser_name\u003e \u003cpriv_key\u003e\n```\n\u003e sudo vi /etc/supervisor/conf.d/bts_wallet.conf\n```bash\n[program:bts_wallet]\ncommand=/home/\u003cuser\u003e/programs/cli_wallet/cli_wallet --server-rpc-endpoint=ws://127.0.0.1:8091 -r 127.0.0.1:8093\ndirectory=/home/\u003cuser\u003e/programs/cli_wallet/\nstdout_logfile=/var/log/supervisor/bts_wallet_out.log\nstderr_logfile=/var/log/supervisor/bts_wallet_err.log\nautostart=true\nautorestart=true\nnumprocs=1\nuser=\u003cuser\u003e\n```\n\n\u003e sudo supervisorctl reread\n\n\u003e sudo supervisorctl update\n\n\u003e sudo supervisorctl start bts_node\n\n\u003e sudo supervisorctl start bts_wallet\n\n**NOTE:**\n\nIf error while trying to run wallet:\n```\nLogging RPC to file: logs/rpc/rpc.log\nterminate called after throwing an instance of 'std::runtime_error'\n  what():  locale::facet::_S_create_c_locale name not valid\nAborted (core dumped)\n```\n\nTry this:\n\u003e sudo vi /etc/default/locale\n```\n# The file should look like this:\nLANGUAGE=en_US.UTF-8\nLC_ALL=en_US.UTF-8\nLANG=en_US.UTF-8\nLC_TYPE=en_US.UTF-8\n```\n\n```bash\nlocale-gen en_US.UTF-8\ndpkg-reconfigure locales\n```\n\n### **Installing nginx**\n\u003e wget http://nginx.org/download/nginx-1.11.3.tar.gz\n\n\u003e tar -xzvf nginx-1.11.3.tar.gz\n\n\u003e rm nginx-1.11.3.tar.gz\n\n\u003e cd nginx-1.11.3/\n\n\u003e sudo apt-get install libpcre3 libpcre3-dev libpcrecpp0v5 zlib1g-dev build-essential libssl1.0-dev\n\n\u003e ./configure --sbin-path=/usr/bin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-debug --with-pcre --with-cc-opt=\"-Wno-error\" --with-http_ssl_module --with-threads\n\n\u003e make\n\n\u003e sudo make install\n\n### **Configuring nginx**\nPreviously buy domain and add 2 CNAME records for subdomens:\nwallet.your-domain.com, node.your-domain.com.\n\n#### **Base configuration**\n\u003e sudo vi /lib/systemd/system/NGINX.service\n```angular2\n[Unit]\nDescription=The NGINX HTTP and reverse proxy server\nAfter=syslog.target network.target remote-fs.target nss-lookup.target\n\n[Service]\nType=forking\nPIDFile=/usr/local/nginx/logs/nginx.pid\nExecStartPre=/usr/bin/nginx -t\nExecStart=/usr/bin/nginx\nExecReload=/usr/bin/nginx -s reload\nExecStop=/bin/kill -s QUIT $MAINPID\nPrivateTmp=true\n\n[Install]\nWantedBy=multi-user.target\n```\n\u003e systemctl daemon-reload\n\n\u003e systemctl enable NGINX.service\n\n\u003e systemctl start NGINX.service\n\n\u003e systemctl -l status NGINX.service\n\n#### **Filling nginx.conf**\nDon't forget to change stubs in nginx.conf on yours values.\n\n\u003e vi /etc/sysctl.conf\n```bash\n# Add next line in the end of the file.\nfs.file-max = 40000\n```\n\u003e sysctl -p\n\n\u003e vi /etc/nginx/nginx.conf\n\n```bash\n# user  nobody;\nworker_processes         auto;\nworker_rlimit_nofile     40000;\n\npid                      /usr/local/nginx/logs/nginx.pid;\n\nevents {\n    worker_connections   \u003cset_value\u003e;   # worker_rlimit_nofile / worker_processes\n    multi_accept         on;\n    use                  epoll;\n}\n\n\nhttp {\n    # Basic settings\n    sendfile       on;\n    tcp_nopush     on;\n    tcp_nodelay    on;\n    aio            threads;  \n\n    # Logging\n    access_log     off;\n    error_log      /var/log/nginx/error.log crit;\n\n    # Enable open file cache\n    open_file_cache             max=1000 inactive=20s;\n    open_file_cache_valid       30s;\n    open_file_cache_min_uses    2;\n    open_file_cache_errors      on;\n\n    # Keepalive\n    keepalive_timeout    30s;\n    send_timeout         10s;\n\n    # Hide nginx version information.\n    server_tokens        off;\n    \n    # Websockets\n    map $http_upgrade $connection_upgrade {\n\t    default upgrade;\n\t    ''        close;\n\t}\n    \n    # -- Upstreams --\n    upstream subwallet {\n        server 127.0.0.1:8093;\n    }\n\n    upstream subnode {\n    \tserver 127.0.0.1:8091;\n    }   \n    \n    # --- Servers directives ---\n    server {\n        # listen                     443 ssl;\n        listen                     80;\n        server_name                wallet.domain.com;\n        \n        # \u003c----- Uncomment this after generating ssl certs. -------\u003e\n        # ssl_certificate            /etc/letsencrypt/live/wallet.domain.com/fullchain.pem;\n        # ssl_certificate_key        /etc/letsencrypt/live/wallet.domain.com/privkey.pem;\n        # include                    /etc/letsencrypt/options-ssl-nginx.conf;\n        # ssl_dhparam                /etc/letsencrypt/ssl-dhparams.pem;\n        # \u003c-----                -------\u003e\n    \n        location /ws {\n            proxy_pass             http://subwallet;\n            proxy_http_version     1.1;\n            proxy_set_header       Upgrade $http_upgrade;\n            proxy_set_header       Connection $connection_upgrade;\n    \n            proxy_set_header       Host $http_host;\n            proxy_set_header       X-Real-IP $remote_addr;\n            proxy_set_header       X-Forwarded-For $proxy_add_x_forwarded_for;\n            proxy_set_header       X-Forwarded-Proto $scheme;\n            \n            proxy_read_timeout     300s;\n            proxy_connect_timeout  10s;\n\n        }\n    }\n\n    server {\n        listen                     80;\n        server_name                node.domain.com;\n\t\n        location /ws {\n            proxy_pass             http://subnode;\n            proxy_http_version     1.1;\n            proxy_set_header       Upgrade $http_upgrade;\n            proxy_set_header       Connection $connection_upgrade;\n\n            proxy_set_header       Host $http_host;\n            proxy_set_header       X-Real-IP $remote_addr;\n            proxy_set_header       X-Forwarded-For $proxy_add_x_forwarded_for;\n            proxy_set_header       X-Forwarded-Proto $scheme;\n            \n            proxy_read_timeout     60s;\n            proxy_connect_timeout  10s;\n        }\n    }\n}\n```\n\u003e systemctl restart NGINX.service\n\nor do \n\n\u003e systemctl reload NGINX.service\n\n#### **Adding ssl**\n```\nIMPORTANT NOTE:\nAdding ssl you will get a memory leak due to the fact \nthat the aiohttp 3.5.4 library with python3.7 contains a memory leak when working with ssl.\nSo , do not use ssl until this bug is fixed.\n```\n\n```\nsudo apt-get update\nsudo apt-get install software-properties-common\nsudo add-apt-repository universe\nsudo add-apt-repository ppa:certbot/certbot\nsudo apt-get update\nsudo apt-get install certbot python-certbot-nginx \n\ncertbot --nginx -d wallet.domain.com certonly\n\ncrontab -e\n# Add next line for auto updating cert.\n@daily certbot renew\n\n# Change values in /etc/letsencrypt/options-ssl-nginx.conf.\nssl_session_cache shared:le_nginx_SSL:100m;\nssl_session_timeout 4h;\n```\n\n#### **NOTE**\n```\nIf something was wrong -\u003e reboot your system and try again , in 99 percent of the happenings it helps :D\n```\n\nAfter previous steps uncomment lines in nginx.conf and replace domens on yours. Then reboot your system.\n\n### Server security setting\n\n#### **Adding SSH keys**\n```bash\n# On your local car.\nssh-keygen\nmv key_name* ~/.ssh/\nssh-copy-id user@server_ip\n\n# On remote server. \n# Disable pas auth.\nsudo vi /etc/ssh/sshd_config\n-\u003e replace yes to no in PasswordAuthentication line\nsudo systemctl reload sshd\n```\n\n#### **Configuring UFW**\nСhange firewall settings to your liking.\n```bash\nufw default deny incoming \nufw default allow outgoing\nufw allow ssh\nufw enable\nufw allow from \u003cyour ip\u003e to any port www\nufw allow from \u003cyour ip\u003e to any port 443\n```\n\n### **Installing and usage bot**\nThe following procedure will work in Debian \nbased Linux, more specifically the commands \nto make the guide were executed in Ubuntu 18.10 \nwith Python 3.7.\n\n```\n# Installing python 3.7\nsudo apt-get install build-essential checkinstall\nsudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \\\n    libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev\ncd /usr/src\nsudo wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz\nsudo tar xzf Python-3.7.2.tgz\ncd Python-3.7.2\nsudo ./configure --enable-optimizations\nsudo make install\nPython-3.7.2 -V\n\n# Cloning repository\ngit clone https://github.com/mkbeh/rin-bitshares-arbitry-bot\ncd rin-bitshares-arbitry-bot\n\n# Creating and activating virtual env\nsudo pip install virtualenv \nvirtualenv venv\nsource venv/bin/activate\n\npip3.7 install Cython\npip3.7 install numpy\n\n# Installing bot\npython3.7 setup.py install\n\n# Running bot\nJust type rin-bot in the command line and press enter.\n```\nOn first app startup will be generated config, \nwhich must be filled. \nConfig is located -\u003e /home/\\\u003cuser\u003e/rin-bot/config.ini\n\n#### **Contents of the config.ini file**\nExplorer uri you can get here https://github.com/oxarbitrage/bitshares-explorer-api\n\n```angular2\n[DIRS]\noutput dir = path/to/output/directory/output # name output requried\nlog dir = path/to/log/directory/logs         # name logs required\n\n[MIN_DAILY_VOLUME]\noverall min daily volume = 10  #  Must be non float value\npair min daily volume = 5      #  Must be non float value\n\n[LIMITS]\n# Values of the options must be dicts. Values in dicts must have types int \n# or float. Values in dict 'volume limits' expressed in dollars.\nvolume limits = {\"1.3.0\": 15, \"1.3.113\": 15, \"1.3.1570\": 15, \"1.3.121\": 15}\nmin profit limits = {\"1.3.0\": 0.001, \"1.3.113\": 0.02, \"1.3.1570\": 2e-08, \"1.3.121\": 0.02}\n\n[URI]\nnode uri = nodr_uri\nwallet uri = ws://127.0.0.1:8093/ws      # example\nexplorer uri = explrer_uri\n\n[ACCOUNT]\naccount name = account_name\nwallet password = wallet_password\n\n[OTHER]\ndata update time = 1      # Hours. Required int\ntime to reconnect = 350   # Reconnect to node or wallet. Secs. Required int\norders depth = 5          # Amount. Required int\n```\n\nWhen you will fill config - go to the next step.\n\n#### Adding app to supervisor\n\u003e sudo vi /etc/supervisor/conf.d/rin-bot.conf\n```bash\n[program:rin-bot]\ncommand=/home/\u003cuser\u003e/rin-bitshares-arbitry-bot/venv/bin/rin-bot\nautostart=true\nautorestart=true\nstopsignal=KILL\nnumprocs=1\nuser=\u003cuser\u003e\n```\n\n\u003e sudo supervisorctl reread\n\n\u003e sudo supervisorctl update\n\n\u003e sudo supervisorctl start rin-bot\n\n#### Logging\nLogs, output files and config are available by path /home/\\\u003cuser\u003e/rin-bot\n\n#### Cython supporting\n```angular2\nIf you want to compile modules by Cython - uncomment\nlines in setup.py and change the extension of \nthe desired files to .pyx. But Cython compiling not\ntested so use it at your own risk.\n```\n### **Milestones**:\n* Fix a bug associated with incorrect calculation of volumes.\n* Write own async cmd explorer REST API without web interface.\n* Improve bot by adding new features.\n* Write full async lib for Bitshares API.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkbeh%2Frin-bitshares-arbitry-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkbeh%2Frin-bitshares-arbitry-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkbeh%2Frin-bitshares-arbitry-bot/lists"}