staketaxcsv
- Python repository to create blockchain CSVs for Algorand (ALGO), Cosmos (ATOM), Agoric (BLD), Bitsong (BTSG), Sentinel (DVPN), Evmos (EVMOS), Fetch.ai (FET), Chihuahua (HUAHUA), IoTex (IOTX), Juno (JUNO), Kujira (KUJI), KYVE Network (KYVE), Terra Classic (LUNC), Terra 2.0 (LUNA), Osmosis (OSMO), Solana (SOL), and Stargaze (STARS) blockchains.
- CSV codebase for https://stake.tax
- Contributions/PRs highly encouraged, such as support for new txs, blockchains, or CSV formats. Examples:
- Add cosmo-based-blockchain CSV: https://docs.stake.tax/devs/adding-csv-in-cosmos-based-ecosystem
- Add new CSV format: https://docs.stake.tax/devs/add-new-csv-format-example
Install
-
Install python 3.9 (one way)
-
Install pip packages
pip3 install -r requirements.txt
Usage
-
Load environment variables (add to ~/.bash_profile or ~/.bashrc to avoid doing every time):
set -o allexport source sample.env set +o allexport
-
Usage as CLI
- Remember to add your path to staketaxcsv/src to the
PYTHONPATH
environment variable. - Same arguments apply for report_algo.py (ALGO), report_atom.py (ATOM), report_*.py:
cd src # Create default CSV python3 staketaxcsv/report_atom.py <wallet_address> # Create all CSV formats (i.e. koinly, cointracking, etc.) python3 staketaxcsv/report_atom.py <wallet_address> --format all # Show CSV result for single transaction (great for development/debugging) python3 staketaxcsv/report_atom.py <wallet_address> --txid <txid> # Show CSV result for single transaction in debug mode (great for development/debugging) python3 staketaxcsv/report_atom.py <wallet_address> --txid <txid> --debug
- Remember to add your path to staketaxcsv/src to the
-
Usage as staketaxcsv module
>>> import staketaxcsv >>> help(staketaxcsv.api) >>> >>> address = "<SOME_ADDRESS>" >>> txid = "<SOME_TXID>" >>> >>> staketaxcsv.formats() ['default', 'balances', 'accointing', 'bitcointax', 'coinledger', 'coinpanda', 'cointelli', 'cointracking', 'cointracker', 'cryptio', 'cryptocom', 'cryptotaxcalculator', 'cryptoworth', 'koinly', 'recap', 'taxbit', 'tokentax', 'zenledger'] >>> >>> staketaxcsv.tickers() ['ALGO', 'ATOM', 'BLD', 'BTSG', 'DVPN', 'EVMOS', 'FET', 'HUAHUA', 'IOTX', 'JUNO', 'KUJI', 'LUNA1', 'LUNA2', 'OSMO', 'REGEN', 'SOL', 'STARS'] >>> >>> # write single transaction CSV >>> staketaxcsv.transaction("ATOM", address, txid, "koinly") ... >>> # write koinly CSV >>> staketaxcsv.csv("ATOM", address, "koinly") ... >>> # write all CSVs (koinly, cointracking, etc.) >>> staketaxcsv.csv_all("ATOM", address) ... >>> # check address is valid >>> staketaxcsv.has_csv("ATOM", address) True
Contributing Code
-
See Tests for running unit tests.
-
See Linting to see code style feedback.
-
See Docker to alternatively install/run in docker container.
-
Providing a sample txid will expedite a pull request (email [email protected], DM @staketax, etc.):
# For a given txid, your PR (most commonly) should print different output before/after: python3 staketaxcsv/report_osmo.py <wallet_address> --txid <txid>
Reference
See README_reference.md: