Skip to content

heskarioth/crypto_investment_tracker

Repository files navigation

Crypto Investment Tracker

Tired of keeping track of your crypto portfolio across multiple exchanges? Crypto Investment Tracker enables you to keep track of all your crypto holdings across all your providers (currently support for Binance and Kraken.com is enabled).

Installation

Dashboard Set up

This project makes use of Google Sheets for the Dashboard front-end and Python for back-end jobs. In order to set up a correct connection between the two, you need to create a ServiceAccount in Google Developer Console, enable Google Sheets API, share access to Google Sheet File to that ServiceAccount and create API Keys. You can follow this guide to get you up and running. After downloading the JSON credential file, rename it as sheets_creds.json and place it under the sheets_utils folder. The code is expecting a predefined template to be used as Dashboard, please make sure to copy this template and rename it Crypto Investment Tracker. Finally, ensure that your Sheet ID has been given to the GOOGLE_SHEET_ID variable in global_vars.

Installation

To install the package, go to location where you want to save project and follow the below commands:

git clone https://github.com/heskarioth/crypto_investment_tracker.git
cd crypto_investment_tracker
python3 setup.py install

API Exchange keys set up

This project utilises Kraken and Binance. Follow this link for instructions on how to create API keys for Binance and this other one for Kraken. Their corresponding values should be given to the variables below in portfolio_keys module. Don't forget to also amend INVESTED_COINS with the list of coins you're holding.

KRAKEN_API_KEY = '????????????????????????????????????????????????'
KRAKEN_PRIVATE_KEY = '???????????????????????????????????????????????'

BINANCE_API_KEY = '??????????????????????????????????????'
BINANCE_PRIVATE_KEY = '??????????????????????????????????????'

INVESTED_COINS = ['BTC','ADA','AAVE','HBAR','STX','BNB','MATIC'] # This is the list of coins I have.

Usage

From terminal, go to location repo was saved and execute below line:

python3 main.py

Dashboard Documentation

The Dashboard is structured in four parts (or tabs).

  • Summary tab includes a broad overview of all your portfolio holding across the different exchanges, balances, savings, open orders, selling recommendations, and portfolio asset allocation breakdown, current value and profit_loss.
  • Binance tab includes all holdings' information including: historical trades, acrrued interest, balances, open orders and profit-loss for the Binance Exchange.
  • Kraken tab includes all holdings' information including: historical trades, acrrued interest, balances, open orders and profit-loss for the Kraken Exchange.
  • WatchList tab includes all latest market data for crypto assets in our watchlist. The data here is taken from CoinGecko.

Methods description:

  • Summary
    • Get me an overview of all my crypto holdings. Include total token quantity, dca, profit_loss, price paid, and current asset value.
      summary_get_overview_tab(kraken_dca_df,binance_dca_df)
    • Get me all my open orders across all the exchanges.
      summary_get_open_orders([kraken_open_orders,binance_open_orders])
    • Get me how much I have deposited in all my accounts.
      summary_get_deposits_usd_(kraken_deposit_history,kraken_account_size,binance_deposit_history,binance_account_size)
    • Get me total available spot balance across all exchanges (in BTC and USDT)
      summary_get_spot_balance(kraken_spot_balance,binance_spot_balance)
    • Get me total savings account balance across all exchanges (in BTC and USDT).
      summary_get_savings_balance(binance_savings_overview,kraken_savings_overview)
    • Get me total account size across all exchanges (in BTC and USDT).
      summary_get_account_size(binance_account_size,kraken_account_size)
    • Give my trade history, suggest me selling prices for the crypto I own.
      summary_get_selling_recomendations_overview(df_portfolio_overview)
  • Binance
    • Get me an overview of all my crypto holdings in Binance. Include total token quantity, dca, profit_loss, price paid, and current asset value.
      binance_dca_profit_loss(Binanceclient)
    • Get me all trade history.
      binance_get_all_trades(Binanceclient)
    • Get me all pending orders in Binance.
      binance_get_open_orders(Binanceclient)
    • Get me all past dividend payments.
      binance_get_past_dividends(Binanceclient)
    • Get me Binance savings balance.
      binance_get_savings(Binanceclient,binance_interest_history)
    • Get me Binance spot balance.
      binance_get_spot_balance(Binanceclient)
    • Get me BInance account size.
      binance_get_total_account_size(Binanceclient)
    • Get me fiat deposit history to Binance.
      binance_get_deposit_history(Binanceclient)
  • Kraken
    • Get me an overview of all my crypto holdings in Kraken. Include total token quantity, dca, profit_loss, price paid, and current asset value.
      kraken_dca_profit_loss(Krakenclient)
    • Get me total savings account balance (in BTC and USDT).
      kraken_get_savings(Krakenclient)
    • Get me total spot account balance (in BTC and USDT).
      kraken_get_spot_balance(Krakenclient)
    • Get me all pending orders in Kraken.
      kraken_get_open_orders(Krakenclient)
    • Get me all trade history in Kraken.
      kraken_get_transactions_history(Krakenclient)
    • Get me all past dividend payments.
      kraken_get_interest_history(Krakenclient)
    • Get me Kraken account size.
      kraken_get_total_account_size(Krakenclient)
    • Get me fiat deposit history to Kraken.
      kraken_get_deposit_history(Krakenclient)
  • WatchList
    • Given my watchlist, return me a daily snapshot overview.
      watchlist_get_overview()

Dashboard Custimization and Extensions

All the market data extracted for our coins is saved into a sqllite db. This means we can use that data to do other calculations and extend our dashboards. If you want to do so, make sure to use the d2gspread library to speed up data loading to the dashboard:

def updater(df,sheetname,clean=True,col_names=True,row_names=False,start_cell='A1'): 
    d2g.upload(
        df
        ,gfile=GOOGLE_SHEET_ID
        ,wks_name=sheetname
        ,credentials=creds
        ,clean=clean
        ,col_names=col_names
        ,row_names=row_names
        ,start_cell=start_cell
            )

One important note to consider is that not all trading pairs will be available across all your exchange accounts. For instance, you can't trade AAVE as AAVEEUR on Binance because it is not available but you can trade it on Kraken. For this reason we have to manually update the PAIRS in global_vars to reflect the difference, e.g.

PAIRS = {
        'BINANCE': {'AAVE':['AAVEUSDT']}
        ,'KRAKEN': {'AAVE':['AAVEEUR']}
         }

Moreover, I am not sure abut you but I've received few shitcoins on Binance as airdrops and I have no intention of following them, here we can make sure to ignore them. Similarly, if we want to change the scope of the watchlist cryptos, then we can amend COIN_WATCHLIST_GECKO_SYMBOL:

COIN_WATCHLIST_GECKO_SYMBOL = ['btc','eth','usdt','bnb','usdc','sol','ada','dot','luna']

Future Development

Below some of the development items for the next iteration:

  • Integrate other exchages: blockchain.com, coinbase, crypto.com
  • Introduce concurrency

To follow latest development effort on this project, please follow related Trello board.

License

MIT

About

All In One Solution for your Crypto Investing Tracking

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages