Strategy vault / DCA & fixed investment
100USDT Invested Every Week Regular Variable Investment
Fixed investment of about 100 USDT every week, with no fixed amount on a regular basis. Buy more when it goes down, buy less when it goes up, and the rate of return is better than the fixed amount.
Fixed investment of about 100 USDT every week, with no fixed amount on a regular basis. Buy more when it goes down, buy less when it goes up, and the rate of return is better than the fixed amount.
Source Python
def main():
amountAll = 0 #Total Holdings
cost = 0 #Cost
marketValueCurrent = 0 #Current total market value of holdings
marketValueExpected = 0 #Current expected total market capitalization
rateOfReturn = 0 #Yield
eachBuy = 100
while True:
marketValueExpected = marketValueExpected + eachBuy #Calculate the current expected total market value
ticker = exchange.GetTicker()
price = ticker['Last'] #Get current price
amount = marketValueExpected / price - amountAll #Calculate the purchase amount this time
if amount > 0:
exchange.Buy(price,amount) #buy
else:
amount = 0
amountAll = amountAll + amount #Calculate total holding amount
cost = cost + amount * price #Calculate total cost
marketValueCurrent = amountAll * price #Calculate the current total market value held
rateOfReturn = (marketValueCurrent - cost) / cost #Calculate return rate
Log("Amount invested this time:", amount * price, "Principal:", cost,"Current total holdings", amountAll,"Current total market value:", marketValueCurrent, "Yield:", rateOfReturn * 100,"%" ,"Current Price:", price, )
Sleep(7 * 24 * 60 * 60 * 1000) #Wait for a Week
Published by jfyh5388 on the FMZ strategy square · last modified 2021-04-16. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/100USDT-Invested-Every-Week-Regular-Variable-Investment.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- Digital Currency Fixed InvestmentPython · DCA & fixed investment
- Fixed Investment StrategyPython · DCA & fixed investment
- 100USDT Invested Every Week Regular Fixed InvestmentPython · DCA & fixed investment
- Martin Variant Original VersionPython · DCA & fixed investment
- Dollar Cost Averaging Investment StrategyPine Script · DCA & fixed investment · 1d
- Dynamic DCA based Cryptocurrency Quantitative Trading StrategyPine Script · DCA & fixed investment · 1h