Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
272d1dc
Fix for trades reducing coin quantities
Feb 27, 2021
d032352
Quick fix for missing get_market_ticker_price_from_list in binance_ap…
Feb 27, 2021
f484f12
Removed unnecessary self reference
Feb 27, 2021
724edb8
Added missing first function in binance_api_manager
Feb 27, 2021
6ede3d5
Fix for missing "self" argument
Feb 27, 2021
6ce8726
Merge pull request #140 from johannes-peeters/master
rel-s Feb 28, 2021
3d88ad3
Add basic REST API server
j-waters Feb 21, 2021
8a6b256
Run api server in Docker
j-waters Feb 21, 2021
ab9976e
Add separate container for api server
j-waters Feb 21, 2021
a6a3883
Add CORS to api server
j-waters Feb 21, 2021
58692c5
Add coins endpoint
j-waters Feb 22, 2021
a01499d
Add info method to each db model to return a dict representation
j-waters Feb 23, 2021
9e18f85
Add socketio
j-waters Feb 23, 2021
eb54d5b
Set datetime in init method instead of defaulting
j-waters Feb 23, 2021
e4ae561
Only return scout log entries for the current coin
j-waters Feb 23, 2021
c97bd0a
Add current coin history endpoint
j-waters Feb 23, 2021
61ec6f7
Add pairs endpoint
j-waters Feb 23, 2021
e768329
Add total value history endpoint
j-waters Feb 23, 2021
4a9e069
Add filter to value history endpoint
j-waters Feb 23, 2021
e9898f4
Add filtering by time period
j-waters Feb 23, 2021
bdd7c45
Add get_ticks method
j-waters Feb 27, 2021
5f93aab
Add wait_for_order method
j-waters Feb 27, 2021
6a37bb5
Rename and simplify get_ticks
j-waters Feb 27, 2021
5d5271d
Display on the console, the current coin+Bridge, so users can see som…
ardgraft Mar 1, 2021
762a374
added end='\r' to print on console the current coin and datetime
ardgraft Mar 1, 2021
ef82a09
Moved 'tld' default value to 'DEFAULTS'
rel-s Feb 27, 2021
247db1f
Refactored transaction_through_tether to transaction_through_bridge.
rel-s Feb 27, 2021
092da80
Moved current_coin logic from main() to a seperate function.
rel-s Feb 27, 2021
70d3b7f
Added function description to update_values
rel-s Feb 27, 2021
7641f74
Fixed wrong type in get_pairs_from
rel-s Feb 27, 2021
060ce61
Changed variable names in sell_alt to ones that make more sense
rel-s Feb 27, 2021
560dc42
Changed variable names in buy_alt to ones that make more sense
rel-s Feb 27, 2021
5f93fb9
Fixed wrong variables usage in buy_alt->trade_log
rel-s Feb 27, 2021
e28ff56
Code prettying in crypto_trading.py
rel-s Feb 28, 2021
bcca8fb
Fixed junk from rebasing
rel-s Feb 28, 2021
67b8742
Fixed typo in function name
rel-s Mar 1, 2021
38399c6
Removed unnecessary sleeps between sell and buy
edeng23 Mar 1, 2021
4171e44
Put logs in log directory
quantumsheep Feb 23, 2021
a148142
Update README.md
Mystikal91 Mar 2, 2021
38cbf86
Update README.md
edeng23 Mar 2, 2021
a306402
:construction_worker: Add initial github actions flow
segersniels Feb 26, 2021
641fb88
:wrench: Add support for arm64
segersniels Feb 26, 2021
d5753c8
:construction_worker: Add ARMv6 and ARMv7 support
segersniels Mar 3, 2021
1b8fe11
Move code into separate classes
j-waters Mar 3, 2021
632957a
Make project a package
j-waters Mar 3, 2021
a478475
:sparkles: Add support to override using environment variables
segersniels Feb 27, 2021
068c893
:memo: Add basic description regarding environment variable configura…
segersniels Feb 27, 2021
0f07c73
:recycle: Move all defaults to default section of config
segersniels Feb 28, 2021
73d2b88
:recycle: Dont exit when no user.cfg found and assume default config …
segersniels Feb 28, 2021
b98f096
:bug: Initialize empty user config section in case user is using env …
segersniels Feb 28, 2021
9c3b068
:rotating_light: Fix linting (black)
segersniels Mar 4, 2021
f36fa4a
:ambulance: Check if env var is set before trying to split
segersniels Mar 4, 2021
f4ae88e
:memo: Update README
segersniels Mar 4, 2021
b4d1bf8
update docker-compose for new package reality
PrzemyslawSarnacki Mar 4, 2021
2ec4e3a
:wrench: Point the example to the official image
segersniels Mar 4, 2021
a8a9bc4
:memo: Add status badges
segersniels Mar 4, 2021
8a2433b
:memo: Add information about official docker image
segersniels Mar 4, 2021
42435b2
:rotating_light: Lint README.md
segersniels Mar 4, 2021
32db822
make apprise example more clear
Mar 4, 2021
54f894d
updated api_server to work on docker since packaging broke it 632957a…
Mar 8, 2021
efa4a9f
Don't traceback if `user.cfg` does not exist.
s0undt3ch Mar 9, 2021
ecd78ad
Remove "Initializing X vs Y" notifications
quantumsheep Mar 4, 2021
dafc27d
Merge pull request #191 from s0undt3ch/hotfix/unique-coin-list
rel-s Mar 13, 2021
ad7f967
change logger to have separate logging files for different services
Mar 8, 2021
846882a
removed obsolete LOG_PATH and added mention about the default log
Mar 8, 2021
8c98434
Apply suggestions from code review
Pekafu Mar 9, 2021
42ef53e
#181 - Pin requirements
Mar 13, 2021
ace273d
Maintain formatting and check for lint issues on CI
s0undt3ch Mar 7, 2021
f6a80fa
Only push images when pushing to the branch
s0undt3ch Mar 8, 2021
92f3710
No longer needs to be executable after 632957a632
s0undt3ch Mar 8, 2021
a340c29
Allow stopping with CTRL-C without showing a traceback
s0undt3ch Mar 8, 2021
bcebb65
Fix pre-commit config
j-waters Mar 13, 2021
7e1f72c
Apply formatting
j-waters Mar 13, 2021
17e38ad
Automatically get transaction fees
j-waters Mar 12, 2021
103a393
Cache api calls that are unlikely to change
j-waters Mar 12, 2021
8694ccc
Take into account using BNB for fees
j-waters Mar 12, 2021
a8bde0a
BNB fee payment detection
edeng23 Mar 15, 2021
be1c006
Update README.md
edeng23 Mar 15, 2021
c211ba1
Fixed linting issues
edeng23 Mar 15, 2021
3cea564
Fix automatic fee getting
j-waters Mar 16, 2021
bd07962
Updated wording
edeng23 Mar 21, 2021
4ce768b
Trim Trailing Whitespace
edeng23 Mar 21, 2021
d80725e
Add ability to select strategy
j-waters Mar 14, 2021
ee1844c
Add multiple active coins strategy
j-waters Mar 16, 2021
5e49803
Add dynamic strategy loader
j-waters Mar 14, 2021
95ff67a
Fix default strategy name
j-waters Mar 18, 2021
e5237ad
Fix rebasing issues
j-waters Mar 21, 2021
4806f0f
Add bridge scout to default strategy
j-waters Mar 21, 2021
3673fed
fix retrieval of BNB fees switch on Binance API
Mar 23, 2021
24bfe72
fix lint
Mar 23, 2021
4d7c5d0
Set current coin after jumping from bridge coin
j-waters Mar 22, 2021
9d4db23
Add logger.info about chosen strategy on bot start
Aleksei-Grigorovskii-epam Mar 22, 2021
c835d2a
Refactor so that things are easier to mock
j-waters Mar 11, 2021
e619c9d
Add basic backtesting system
j-waters Mar 11, 2021
395b871
Add system to run backtesting
j-waters Mar 11, 2021
7795557
Massively improved backtesting speed
j-waters Mar 16, 2021
88370c8
Improve logging and example file
j-waters Mar 17, 2021
82f5b50
Add skipping an increment on error, fixes possible zero division errors
j-waters Mar 21, 2021
fc5838a
Disable all notifications for backtesting
j-waters Mar 21, 2021
3405fe2
Improve logging, data loading, and remove the SkipIncrement exception
j-waters Mar 23, 2021
8c42c33
Use database for backtesting cache instead of json file
j-waters Mar 23, 2021
122a473
Catch backtesting errors
j-waters Mar 23, 2021
6e5e76d
Use strategy selector in backtesting
j-waters Mar 23, 2021
41d4325
Customise yield interval
j-waters Mar 23, 2021
5547ae5
Added referral link to the account setup stage
edeng23 Apr 6, 2021
f4bc883
update to python-binance==0.7.10 (#260)
Ixtalo Apr 11, 2021
b90cd27
Update trading logic to support cancel timeout order
Apr 3, 2021
0de5573
Handle recover after cancel order for strategy multiple coins
Apr 3, 2021
0c69ce1
Disabled pylint "arguments-differ"
edeng23 Apr 13, 2021
68be1a7
Added "Related Projects" section
edeng23 Apr 13, 2021
b5bcd4e
Fix backtest to use all_tickers in sell_alt
Apr 13, 2021
d56c07b
Fix readme for buy_timeout / sell_timeout that were formatted as INI …
Apr 13, 2021
666e2f7
Update docker-compose.yml
Conight Apr 12, 2021
38f4186
Update docker-compose.yml
Conight Apr 14, 2021
36cc814
Fixed percentages in backtest output
nazegnl Apr 21, 2021
cc9cf3e
Include python-binance==0.7.10 in pre-commit-config
Ixtalo Apr 21, 2021
7819725
Implement the same logic for displaying the scout message.
nazegnl Apr 21, 2021
0bfd46a
Fix collate coin in case BTC is in the supported coin list
Apr 14, 2021
7e34575
lint
Apr 14, 2021
95699f4
Changed example 'scout sleep time'
edeng23 May 11, 2021
4ec7ce4
Merge pull request #271 from Blaklis/fix-readme
rel-s May 11, 2021
97a57a9
Improve logging
DmytroLitvinov Apr 6, 2021
b437b8d
Merge pull request #261 from Ixtalo/Issue-260-update-python-binance
rel-s May 12, 2021
c4d8a81
Update docker-compose to include local supported_coin_list file and a…
lixifumi May 12, 2021
849ac08
Will attempt to access API endpoints that require valid config on sta…
rel-s May 12, 2021
c2282c1
Merge pull request #291 from nazegnl/Fixed-percentages-in-backtest-ouput
rel-s May 13, 2021
b6befa5
Use rustc from apt in Dockerfile
May 23, 2021
bd6c083
Copy and install requirements after apt install
May 23, 2021
80ef5fe
Add Binance websocket support
j-waters Apr 27, 2021
dbdd052
Cache tickers that don't exist
j-waters Mar 21, 2021
8826134
Don't keep re-fetching balances if a coin's balance is 0
j-waters Mar 21, 2021
b5e6ad5
Get orders using the websocket
j-waters Mar 22, 2021
d12e6d5
Force balance update when necessary
j-waters Mar 23, 2021
18de307
Improve logging
j-waters Mar 23, 2021
9c500b4
Remove `check_same_thread` database argument
j-waters Mar 23, 2021
db8544b
Fix backtest.py
erenatas Apr 29, 2021
87404fe
Bump requirements versions
idkravitz May 3, 2021
4c2fe62
Switch websockets backend to ubwa
idkravitz May 3, 2021
63cc3ee
Bump apprise version to 0.9.2
idkravitz May 3, 2021
c0d6f53
Fixed passing non-string objects to notifications
idkravitz May 3, 2021
05279db
Add traceback logging in retry
idkravitz May 3, 2021
431331b
Workaround for apprise tag detection
idkravitz May 3, 2021
9904319
Fix out of sync issue for !userData stream
idkravitz May 5, 2021
9a628f0
Fix the data race on cache.balances R/W
idkravitz May 6, 2021
d2fc189
Fix print in multiple_coins_strategy.py
idkravitz May 7, 2021
751c1c0
Fix a race that could lead to orders out of sync in user data
idkravitz May 9, 2021
1167918
Fix attribute name for bw_api_manager
idkravitz May 11, 2021
a255ca7
Hide mutex behind contextmanager
idkravitz May 13, 2021
14c959a
Avoid forgetting to release lock even in wrong usage
idkravitz May 13, 2021
a10259e
Update README.md about scout_sleep_time
idkravitz May 14, 2021
da75666
Use TLD with websockets
idkravitz May 14, 2021
7d393a0
Add outboundAccountInfo event support (tld us)
idkravitz May 14, 2021
d76e4da
Protect against KeyError on balanceUpdate
idkravitz May 15, 2021
40020d7
Upgrade sqlalchemy to 1.4.15
idkravitz Jun 13, 2021
74b4fe3
add scout_sleep_time details to documentation
Lisiadito Jun 1, 2021
03d02a8
Upgrade python-binance to 1.0.12 and pylint to 2.8.3 (#372)
idkravitz Aug 25, 2021
14bd5fe
:arrow_down: Downgrade pylint@2.4.4
segersniels Aug 25, 2021
77ccd87
Create Procfile
ghostnetrn Aug 26, 2021
a69744d
Create app.json
ghostnetrn Aug 26, 2021
1ec75bf
Create runtime.txt
ghostnetrn Aug 26, 2021
8332de8
Update README.md
ghostnetrn Aug 26, 2021
af08f88
Update app.json
ghostnetrn Aug 28, 2021
40905ff
Update app.json
ghostnetrn Aug 28, 2021
7b5a5d4
Correcting the trading fees for the backtest
AMilkov May 22, 2021
57df16f
Better formula
bamooxa Sep 8, 2021
86cc395
Update auto_trader.py
bamooxa Sep 8, 2021
0347c42
spread calculation
bamooxa Sep 9, 2021
f9d2caa
Revert "spread calculation"
bamooxa Sep 9, 2021
9340813
Update auto_trader.py
bamooxa Sep 18, 2021
ec4867e
Update config.py
bamooxa Sep 18, 2021
cdca77a
Lint fix
edeng23 Nov 13, 2021
9183553
Bump apprise version to 0.9.5.1
edeng23 Nov 13, 2021
e2aa51c
Update apprise_example.yml
MasaiasuOse Dec 5, 2021
2b22e4d
The user.cfg is more beginner friendly
MasaiasuOse Dec 3, 2021
e9a226b
Linting
edeng23 Dec 16, 2021
e1425aa
Bumped unicorn-binance-websocket-api version
edeng23 Jan 4, 2022
48131e0
Bumped unicorn-binance-websocket-api version in pre-commit-config
edeng23 Jan 4, 2022
84cc358
Update README.md
coinbookbrasil2021 Dec 31, 2021
4f2acb9
Create deploy.template.yaml
coinbookbrasil2021 Dec 31, 2021
e494bc7
Update deploy.template.yaml
coinbookbrasil2021 Dec 31, 2021
2a4d95c
Update deploy.template.yaml
coinbookbrasil2021 Dec 31, 2021
be474a5
Update deploy.template.yaml
coinbookbrasil2021 Dec 31, 2021
cfc5265
Update and rename deploy.template.yaml to app.yaml
coinbookbrasil2021 Dec 31, 2021
9196c58
Update and rename app.yaml to deploy.template.yaml
coinbookbrasil2021 Dec 31, 2021
ab14843
Update deploy.template.yaml
coinbookbrasil2021 Dec 31, 2021
4ecdd4d
Update deploy.template.yaml
coinbookbrasil2021 Dec 31, 2021
809c4da
Update Procfile
coinbookbrasil2021 Dec 31, 2021
9ac89ca
Update Procfile
coinbookbrasil2021 Dec 31, 2021
50aeffc
Update deploy.template.yaml
coinbookbrasil2021 Dec 31, 2021
42e88b3
Update deploy.template.yaml
coinbookbrasil2021 Dec 31, 2021
8e51cae
Renaming of BTT into BTTC
MasaiasuOse Jan 22, 2022
56a50e3
Prevent price format error by retrieving precision dynamically for sp…
Blaklis Oct 28, 2021
e3b8931
Apparently originaly intended to sleep for 1s after each attempt, but…
MasaiasuOse Jan 29, 2022
fd77cb6
Added itsdangerous==2.0.1 as requirement
MasaiasuOse Feb 21, 2022
ae6ada1
Bumped Flask version
edeng23 Apr 17, 2022
64451a3
Update README.md
edeng23 Aug 21, 2022
bbabb31
Fix: Changing property name (StopIteration error)
shohart Apr 22, 2023
29ce7a1
Revert "Fix: Changing property name (StopIteration error)"
edeng23 May 5, 2023
3eaf949
Fix: changed property name
edeng23 May 5, 2023
caca9ad
Updated .pre-commit-config.yaml
edeng23 May 5, 2023
e4dc483
fix: Dockerfile to reduce vulnerabilities
snyk-bot Feb 16, 2025
0260861
chore: add tg to readme
carlosmiei Feb 19, 2025
7d7a716
Merge pull request #607 from ccxt/readme-tg-community
carlosmiei Feb 19, 2025
f5984b4
Update README
edeng23 Feb 20, 2025
982817a
Merge pull request #608 from edeng23/readme-update
carlosmiei Feb 20, 2025
819fbce
update flask dependency
carlosmiei Feb 26, 2025
3a11544
Merge branch 'master' of github.com:ccxt/binance-trade-bot
carlosmiei Feb 26, 2025
4979980
testnet support
carlosmiei Feb 27, 2025
32d7a4a
update requirements and readme
carlosmiei Feb 28, 2025
00c2f1b
update python-binance version
carlosmiei Feb 28, 2025
f896529
Merge pull request #606 from ccxt/snyk-fix-f9e4c1c542c759f9b1abba282b…
carlosmiei Feb 28, 2025
55f8cbb
Bump flask from 2.1.1 to 2.3.2 (#527)
dependabot[bot] Mar 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .do/deploy.template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
spec:
name: binance-trade-bot
workers:
- environment_slug: python
git:
branch: master
repo_clone_url: https://github.com/coinbookbrasil/binance-trade-bot.git
envs:
- key: API_KEY
scope: BUILD_TIME
value: "API KEY BINANCE"
- key: API_SECRET_KEY
scope: BUILD_TIME
value: "API_SECRET_KEY"
- key: CURRENT_COIN_SYMBOL
scope: BUILD_TIME
value: "XMR"
- key: BRIDGE_SYMBOL
scope: BUILD_TIME
value: "USDT"
- key: TLD
scope: BUILD_TIME
value: "com"
- key: SCOUT_MULTIPLIER
scope: BUILD_TIME
value: "1"
- key: HOURS_TO_KEEP_SCOUTING_HISTORY
scope: BUILD_TIME
value: "1"
- key: STRATEGY
scope: BUILD_TIME
value: "default"
- key: BUY_TIMEOUT
scope: BUILD_TIME
value: "0"
- key: SELL_TIMEOUT
scope: BUILD_TIME
value: "0"
- key: SUPPORTED_COIN_LIST
scope: BUILD_TIME
value: "ADA ATOM BAT BTT DASH DOGE EOS ETC ICX IOTA NEO OMG ONT QTUM TRX VET XLM XMR"
name: binance-trade-bot
66 changes: 66 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: binance-trade-bot
on:
push:
branches:
- master
pull_request:
branches:
- "*"

jobs:
Lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- id: changed-files
name: Get Changed Files
uses: dorny/paths-filter@v2
with:
token: ${{ github.token }}
list-files: shell
filters: |
repo:
- added|modified:
- '**'
- name: Set Cache Key
run: echo "PY=$(python --version --version | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Check ALL Files On Branch
uses: pre-commit/action@v2.0.0
if: github.event_name != 'pull_request'
- name: Check Changed Files On PR
uses: pre-commit/action@v2.0.0
if: github.event_name == 'pull_request'
with:
extra_args: --files ${{ steps.changed-files.outputs.repo_files }}

Docker:
runs-on: ubuntu-latest
needs: Lint
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name == 'push'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
push: ${{ github.event_name == 'push' }}
tags: ${{ github.repository }}:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
29 changes: 15 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
*.log
.current_coin
.current_coin_table
*.pyc
__pycache__
nohup.out
user.cfg
.idea/
.vscode/
.replit
venv/
crypto_trading.db
apprise.yml
.DS_Store
*.log
.current_coin
.current_coin_table
*.pyc
__pycache__
nohup.out
user.cfg
.idea/
.vscode/
.replit
venv/
crypto_trading.db
apprise.yml
.DS_Store
.bot/
80 changes: 80 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
minimum_pre_commit_version: 1.15.2
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: trailing-whitespace # Trims trailing whitespace.
args: [--markdown-linebreak-ext=md]
- id: mixed-line-ending # Replaces or checks mixed line ending.
args: [--fix=lf]
- id: end-of-file-fixer # Makes sure files end in a newline and only a newline.
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: check-ast # Simply check whether files parse as valid python.

- repo: local
hooks:
- id: sort-supported-coin-list
name: Sort Supported Coin List
entry: .pre-commit-hooks/sort-coins-file.py
language: python
files: ^supported_coin_list$

- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
hooks:
- id: pyupgrade
name: Rewrite Code to be Py3.6+
args: [--py36-plus]

- repo: https://github.com/pycqa/isort
rev: 5.11.5
hooks:
- id: isort
args: [--profile, black, --line-length, '120']

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
args: [-l, '120']

- repo: https://github.com/asottile/blacken-docs
rev: v1.11.0
hooks:
- id: blacken-docs
args: [--skip-errors]
files: ^docs/.*\.rst
additional_dependencies: [black==20.8b1]

- repo: https://github.com/s0undt3ch/pre-commit-populate-pylint-requirements
rev: aed8c6a
hooks:
- id: populate-pylint-requirements
files: ^(dev-)?requirements\.txt$
args: [requirements.txt, dev-requirements.txt]

- repo: https://github.com/pre-commit/mirrors-pylint
rev: v3.0.0a5
hooks:
- id: pylint
name: PyLint
args: [--output-format=parseable, --rcfile=.pylintrc]
additional_dependencies:
- Flask==2.1.1
- apprise==0.9.5.1
- cachetools==4.2.2
- eventlet==0.30.2
- flask-cors==3.0.10
- flask-socketio==5.0.1
- gunicorn==20.1.0
- itsdangerous==2.0.1
- pylint-sqlalchemy
- python-binance==1.0.12
- python-socketio[client]==5.2.1
- schedule==1.1.0
- sqlalchemy==1.4.15
- sqlitedict==1.7.0
- unicorn-binance-websocket-api==1.34.2
- unicorn-fy==0.11.0
19 changes: 19 additions & 0 deletions .pre-commit-hooks/sort-coins-file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python
# pylint: skip-file
import pathlib

REPO_ROOT = pathlib.Path(__name__).resolve().parent
SUPPORTED_COIN_LIST = REPO_ROOT / "supported_coin_list"


def sort():
in_contents = SUPPORTED_COIN_LIST.read_text()
out_contents = ""
out_contents += "\n".join(sorted(line.upper() for line in in_contents.splitlines()))
out_contents += "\n"
if in_contents != out_contents:
SUPPORTED_COIN_LIST.write_text(out_contents)


if __name__ == "__main__":
sort()
Loading