Skip to content
All library documents

Threshold-Based Crypto Portfolio Rebalancing

Article Strategy library · Author: teddy

Summary

This short Python strategy monitors a crypto account's coin holdings, cash balance, and the current coin price. It calculates the market value of the coin position and compares that value with the cash balance. When the difference exceeds 5% of the cash balance in either direction, it trades half the value difference: selling coin when its value is relatively high or buying when it is relatively low. It then checks again once per minute, for a fixed number of cycles.

The example illustrates a simple threshold rebalancing rule intended to keep the two asset values closer together. It includes basic account and ticker logging, but gives no backtest, performance evidence, fee model, or treatment of minimum order sizes and failed trades. The sizing rule is tied to cash balance rather than total portfolio value, and the script does not explain how its chosen threshold or rebalance fraction were selected. The example therefore describes a basic mechanism rather than a validated trading system.

Key ideas

  • The script compares coin market value with the account's cash balance.
  • It triggers a trade when the value gap exceeds 5% of cash balance.
  • Each trade targets half of the current value difference.
  • The account is checked at one-minute intervals for a finite run of iterations.
  • No performance evaluation or transaction-cost analysis is provided.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.