(DCA) 可视化

本文转载于微信公众号-Python机器学习AI

DCA (Dollar-Cost Averaging) is an investment strategy where an investor divides the total amount to be invested across periodic purchases of a target asset to reduce the impact of volatility on the overall purchase. The purchases occur regardless of the asset's price and at regular intervals. This strategy aims to reduce the risk of making a large investment at an inopportune time.  Here is a simple Python example to illustrate DCA:

import numpy as np

# Parameters
total_investment = 1200  # Total amount to invest
periods = 12  # Number of periods (e.g., months)
prices = np.random.uniform(10, 20, periods)  # Simulated asset prices

# Calculate investment per period
investment_per_period = total_i

你可能感兴趣的:(python,DCA)