Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
USE AT YOUR OWN RISK. THIS TRADES REAL MONEY. NO WARRENTY IS GIVEN
A script that can connect to a cryptocurrency exchange and buy/sell cryptocurrency to keep your portfolio balancer to a certain ratio.
$ virtualenv --python=python3 .
$ . bin/activate
$ pip install -r requirements.txt
$ pip install -e .
Create a config file in config.ini
with definition of your exchange and portfolio percentages, and theshold (percent) that rebalancing is needed:
[binance]
api_key = <api key>
api_secret = <api secret>
threshold = 2.0
targets = XRP 40
BTC 20
ETH 20
BNB 10
USDT 10
By default it values the portfolio in USDT, this can be changed with --valuebase
argument.
Dry run (don't actually trade) against Binance
$ crypto_balancer binance
Connected to exchange: binance
Current Portfolio:
XRP 3272.28 (39.92 / 40.00%)
BTC 0.14 (20.05 / 20.00%)
ETH 3.85 (20.02 / 20.00%)
BNB 22.81 ( 9.99 / 10.00%)
USDT 262.48 (10.02 / 10.00%)
Total value: 2619.40 USDT
Balance error: 0.043 / 0.08
No balancing needed
To force it to rebalance regardless of if needed:
$ crypto_balancer --force binance
Connected to exchange: binance
Current Portfolio:
XRP 3272.28 (39.92 / 40.00%)
BTC 0.14 (20.04 / 20.00%)
ETH 3.85 (20.02 / 20.00%)
BNB 22.81 ( 9.99 / 10.00%)
USDT 262.48 (10.02 / 10.00%)
Total value: 2619.28 USDT
Balance error: 0.042 / 0.08
Balancing needed [FORCED]:
Proposed Portfolio:
XRP 3278.51 (40.00 / 40.00%)
BTC 0.14 (20.04 / 20.00%)
ETH 3.83 (19.95 / 20.00%)
BNB 22.81 ( 9.99 / 10.00%)
USDT 262.48 (10.02 / 10.00%)
Total value: 2619.28 USDT
Balance error: 0.032
Total fees to re-balance: 0.00199 USDT
Orders:
BUY 6.2279674364331195 XRP/ETH @ 0.00234478
To get it to actually execute trades if needed:
$ crypto_balancer --force --trade binance
Connected to exchange: binance
Current Portfolio:
XRP 3272.28 (39.96 / 40.00%)
BTC 0.14 (20.04 / 20.00%)
ETH 3.84 (19.94 / 20.00%)
BNB 22.94 (10.04 / 10.00%)
USDT 262.48 (10.02 / 10.00%)
Total value: 2619.01 USDT
Balance error: 0.043 / 0.08
Balancing needed [FORCED]:
Proposed Portfolio:
XRP 3272.28 (39.96 / 40.00%)
BTC 0.14 (20.04 / 20.00%)
ETH 3.85 (20.00 / 20.00%)
BNB 22.80 ( 9.98 / 10.00%)
USDT 262.48 (10.02 / 10.00%)
Total value: 2619.01 USDT
Balance error: 0.031 / 0.08
Total fees to re-balance: 0.001592 USDT
Orders:
Submitted: sell 0.13 BNB/ETH @ 0.08422
You can set this to run in a cron job on a unix system by putting something along the lines of (adjust for your path and email address) below in your crontab file:
MAILTO=matt@example.com
*/5 * * * * OUTPUT=`cd /home/matt/crypto_balancer; bin/crypto_balancer --trade binance`; echo "$OUTPUT" | grep -q "No balancing needed" || echo "$OUTPUT"
This will run the script every 5 minutes, and will email you only if some balancing (or an error) occurs.
FAQs
A tool to automatically balance cryptocurrency portfolios
We found that crypto-balancer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.