Cryptocurrency is a digital asset built on blockchain technology, a decentralized ledger whose records are linked and protected by cryptography. Its central use is transferring value directly between people without a trusted third party such as a bank. section 1.2.6
Treat cryptocurrency as both a technical system and a volatile investment asset:
- Ownership depends on controlling the private key used to sign transactions; without that key, the asset is not owned. section 5.5
- Staking supports transaction validation and may generate rewards, but payouts fluctuate and do not remove exposure to scams, fraud, or price volatility. section 1.2.6 section 5.5
- Secure storage matters: minimizing exchange-held assets and using hardware wallets can reduce operational risk. section 5.5
Monitoring cryptocurrency holdings
A Python monitor can combine locked and flexible Binance staking positions with offline assets stored on a hardware ledger. It can then retrieve USD prices from CoinMarketCap, merge prices into a pandas DataFrame, and export total value, holdings, live prices, and staking yield to a worksheet. section 6.5.4
Listing 6.10 Loading data from Binance
from binance.client import Client
binance_client = Client(os.getenv("exchange.binance.api"),
os.getenv("exchange.binance.secret"))
locked_assets = pd.DataFrame( #1
[
(pos["asset"], pos["amount"], pos["apy"])
for pos in binance_client
.get_simple_earn_locked_product_position()['rows']
],
columns=[COL_TICKER, COL_AMOUNT, COL_YIELD]) #1
flexible_assets = pd.DataFrame( #2
[(pos["asset"], pos["totalAmount"],
pos["latestAnnualPercentageRate"])
for pos in binance_client
.get_simple_earn_flexible_product_position()['rows']],
columns=[COL_TICKER, COL_AMOUNT, COL_YIELD]) #2
assets = pd.concat([locked_assets,
flexible_assets]) #3
assets = assets.astype({COL_AMOUNT: 'float',
COL_YIELD: 'float',
COL_TICKER: 'string'}) #3
assets.set_index(COL_TICKER, inplace=True) #3
The listing demonstrates how to authenticate with Binance, retrieve locked and flexible staking positions, normalize them into DataFrames, and combine the results. section 6.5.4

