0bps

Strategy vault / DCA & fixed investment

100USDT Invested Every Week Regular Fixed Investment

Invest 100 USDT weekly, with fixed periodic amounts

Author
jfyh5388
Complexity
Starter · 17 lines
Parameters
0

Invest 100 USDT weekly, with fixed periodic amounts

Source Python

def main():
    amountAll = 0                                              #Total Holdings
    cost = 0                                                   #Cost
    marketValueCurrent = 0                                     #Current total market value of holdings
    rateOfReturn = 0                                           #Yield
    while True:
        ticker = exchange.GetTicker()
        price = ticker['Last']                                 #Get current price
        amount = 100 / price                                   #Calculate the purchase amount this time
        exchange.Buy(price,amount)                             #buy
        amountAll = amountAll + amount                         #Calculate total holding amount
        cost = cost + 100                                      #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:", 100, "Principal:", cost, "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-06. 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.

in Claude Code, Cursor, Codex & 4 more
/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-Fixed-Investment.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. 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

esc

Try , , or .

↑↓ move↵ open