Explore more topics
NexusTrade guide

Build and backtest BTC weekly accumulation

Buy $150 of Bitcoin when at least seven days have passed since the last filled purchase, using the original cash balance.

As of 2026-10-10

Jump to a section

TL;DR

Buying $150 of BTC after each seven-day filled-buy interval turned $10,000 into $13,863.37 in the 2024 backtest, with 14.14% reported drawdown and $55.65 in fees. The purchases use the original cash balance, without new deposits or a sale rule. It gained more than the displayed SPY holding benchmark but less than BTC holding's 119.27%; ending value includes unsold BTC.

Follow the example

Step 1 of 3

Read this pair's entry and exit

Read the seven-day $150 purchase rule and follow the accumulated BTC holding. This example has no sale rule.

Entry
Saved rule: DaysSinceOrder(BTC-USD, Buy, Filled) >= 7
Exit
Saved rule: Hold accumulated units through the end of the test
Allocation
Saved rule: $150 per qualifying purchase from $10,000 initial cash; no new deposits
Pair
Saved rule: BTC-USD
What you should see

The plain-language purpose matches the saved rules below. Keep the rule, purchase size and exit together when creating your version.

BTC weekly accumulation: completed 2024 backtest with SPY and BTC buy and hold25.3K9.1K2024-01-012024-12-31
BTC weekly accumulation 2024-12-31, 21:00:00 UTC
13,863.37
SPY buy and hold 2024-12-31, 21:00:00 UTC
12,530.29
BTC buy and hold 2024-12-31, 21:00:00 UTC
21,926.92
BTC weekly accumulationSPY buy and holdBTC buy and holdHistorical simulation
Completed 2024 historical simulation. The plotted observations and comparison series are preserved.
Step 2 of 3

Completed 2024 backtest

Explore the completed 2024 simulation below. Compare its recorded return and drawdown with the plotted benchmarks, then follow the captured fills. The original history, fees and execution assumptions remain available below.

What you should see

The exact stored history shown here, with its source's period, comparisons and limits. Opening the walkthrough does not rerun it.

Preview this strategy in Aurora: authored process map
Authored task map. It describes what to inspect; it is not an account screenshot or a measured result.
Step 3 of 3

Preview this strategy in Aurora

Review the provided strategy request without changing its pair or sizing. Ask for a draft preview before any saved candidate or paid test.

What you should see

An inspectable candidate. New dates or a changed rule define another experiment, not the published result.

Choose a step to follow the example. Opening a request lets you review it; it does not submit a job or change your account.

Inspect the recorded trades

  1. Jan 22, 2024

    Pair

    BTC-USD

    Side

    Buy

    Units (rounded)

    0.00369913

    Submitted price

    $40550.10

    Filled price

    $40550.10

    Fee

    $1.05

  2. Jan 29, 2024

    Pair

    BTC-USD

    Side

    Buy

    Units (rounded)

    0.00357574

    Submitted price

    $41949.38

    Filled price

    $41949.38

    Fee

    $1.05

  3. Feb 05, 2024

    Pair

    BTC-USD

    Side

    Buy

    Units (rounded)

    0.00346196

    Submitted price

    $43328.10

    Filled price

    $43328.10

    Fee

    $1.05

  4. Feb 12, 2024

    Pair

    BTC-USD

    Side

    Buy

    Units (rounded)

    0.00311295

    Submitted price

    $48185.80

    Filled price

    $48185.80

    Fee

    $1.05

  5. Feb 19, 2024

    Pair

    BTC-USD

    Side

    Buy

    Units (rounded)

    0.00288090

    Submitted price

    $52067.00

    Filled price

    $52067.00

    Fee

    $1.05

  6. Feb 26, 2024

    Pair

    BTC-USD

    Side

    Buy

    Units (rounded)

    0.00291782

    Submitted price

    $51408.26

    Filled price

    $51408.26

    Fee

    $1.05

  7. Mar 04, 2024

    Pair

    BTC-USD

    Side

    Buy

    Units (rounded)

    0.00228730

    Submitted price

    $65579.38

    Filled price

    $65579.38

    Fee

    $1.05

  8. Mar 11, 2024

    Pair

    BTC-USD

    Side

    Buy

    Units (rounded)

    0.00207717

    Submitted price

    $72213.55

    Filled price

    $72213.55

    Fee

    $1.05

Recorded rows in source order; spacing does not represent elapsed time.

Show the table · 8 rows, 7 columns

Scroll sideways to compare all columns. Select a heading to sort.

Jan 22, 2024BTC-USDBuy0.00369913$40550.10$40550.10$1.05
Jan 29, 2024BTC-USDBuy0.00357574$41949.38$41949.38$1.05
Feb 05, 2024BTC-USDBuy0.00346196$43328.10$43328.10$1.05
Feb 12, 2024BTC-USDBuy0.00311295$48185.80$48185.80$1.05
Feb 19, 2024BTC-USDBuy0.00288090$52067.00$52067.00$1.05
Feb 26, 2024BTC-USDBuy0.00291782$51408.26$51408.26$1.05
Mar 04, 2024BTC-USDBuy0.00228730$65579.38$65579.38$1.05
Mar 11, 2024BTC-USDBuy0.00207717$72213.55$72213.55$1.05

Follow the Filled events by pair, side and time. Compare the submitted price, filled price, fractional quantity and fee. This table shows up to eight orders from the captured excerpt (50 Filled events).

For a percentage fee, multiply the traded notional by 0.007. To follow a position, start with a purchase and inspect subsequent sale quantities, remaining holdings and cash flows. For the weekly accumulation example, follow each purchase and the resulting position value.

The algorithm

  1. Entry

    DaysSinceOrder(BTC-USD, Buy, Filled) >= 7

  2. Exit

    Hold accumulated units through the end of the test

  3. Allocation

    $150 per qualifying purchase from $10,000 initial cash; no new deposits

  4. Pair

    BTC-USD

  5. Execution

    Market; fractional units enabled

  6. Starting capital

    $10,000; no additional deposits

Show the table · 6 rows, 2 columns
DecisionSaved rule
EntryDaysSinceOrder(BTC-USD, Buy, Filled) >= 7
ExitHold accumulated units through the end of the test
Allocation$150 per qualifying purchase from $10,000 initial cash; no new deposits
PairBTC-USD
ExecutionMarket; fractional units enabled
Starting capital$10,000; no additional deposits

This example trades BTC-USD as a spot Cryptocurrency asset. The saved rules were read back and verified with automated trading off.

Create the same strategy

Ask Aurora to build the rules above, review the preview, then save the draft with automated trading off. Confirm the Cryptocurrency pair, allocation and entry and exit conditions in the saved rules.

In the native Strategies editor, use Buy and Sell actions with the same Cryptocurrency pair. Add the indicator and position-value conditions shown above. The weekly accumulation example uses a single Buy rule with a seven-day DaysSinceOrder condition.

Plan a separate variant and later test

Review the optional next experiment

After reviewing the recorded example, use the prepared request above for the original rules. This optional plan covers a separate variant and a later test.

  1. Create one variant, then test unseen dates

    Ask: "Change only the purchase amount from $150 to $100. Show the rule diff and compare both candidates on the 2024 development period with every other setting fixed." After choosing, freeze the rules and select another test period you have not inspected. The displayed 2024 results already make 2024 a viewed development period. Keep any later revisions in a new research cycle.

Create and backtest with Python

Use the Python SDK instead of Aurora

Python SDK 1.42.0. Save the runner below as run_btc_weekly_accumulation.py.

Install and download

Shell
python3 -m pip install nexustrade==1.42.0
export NEXUSTRADE_API_KEY="YOUR_API_KEY"
curl --fail --output btc_weekly_accumulation.py https://nexustrade.io/seo/strategy-examples/btc-weekly-accumulation.py

Create, test and inspect

Python
from btc_weekly_accumulation import create_btc_weekly_accumulation, backtest_btc_weekly_accumulation

book = create_btc_weekly_accumulation()
completed = backtest_btc_weekly_accumulation()
print(completed["result"])

Run

Shell
python3 run_btc_weekly_accumulation.py

Python strategy and backtest functions

View complete Python SDK functions

The backtest function submits the 2024 test with SPY as its benchmark, records events and waits for the result. Use a new request key when changing rules, dates or fees.

Python
import nexustrade as nt


def create_btc_weekly_accumulation():
    asset = nt.crypto_asset("BTC-USD")
    return nt.portfolio(
        "Public SEO crypto example - BTC weekly accumulation",
        [
            nt.strategy(
                "Buy Bitcoin weekly",
                (nt.DaysSinceOrder(asset, "Buy", "Filled") >= nt.Value(7)),
                nt.buy(asset, 150, "dollars")
            ),
        ],
        initial_value=10000,
        supports_crypto=True,
        supports_fractional_shares=True,
        alerts_enabled=False,
        dividend_policy='cash',
    )


def backtest_btc_weekly_accumulation(client=None):
    client = client or nt.NexusTradeClient.from_environment()
    operation = client.create_backtest(
        nt.backtest(
            create_btc_weekly_accumulation(),
            start_date="2024-01-01", end_date="2024-12-31",
            interval="Day", baseline_symbol="SPY",
            initial_value=10000, generate_events=True,
            dividend_policy="cash",
            fee_config={"Stock": {"type": "percent", "amount": 0.1},
                        "Cryptocurrency": {"type": "percent", "amount": 0.7},
                        "Option": {"type": "dollars", "amount": 0.65}},
        ),
        idempotency_key="explore-btc-weekly-accumulation-2024-spy-v1",
    )
    return client.wait_for_backtest(operation["id"])


# Build locally: book = create_btc_weekly_accumulation()
# Run and inspect: completed = backtest_btc_weekly_accumulation(); print(completed["result"])

Create and backtest with TypeScript

Use the TypeScript SDK instead of Aurora

TypeScript SDK 1.42.0. Save the runner below as run-btc-weekly-accumulation.ts.

Install and download

Shell
npm install nexustrade@1.42.0
npm install --save-dev tsx
export NEXUSTRADE_API_KEY="YOUR_API_KEY"
curl --fail --output btc-weekly-accumulation.ts https://nexustrade.io/seo/strategy-examples/btc-weekly-accumulation.ts

Create, test and inspect

TypeScript
import { createBtcWeeklyAccumulation, backtestBtcWeeklyAccumulation } from "./btc-weekly-accumulation";

async function main() {
  const book = createBtcWeeklyAccumulation();
  const completed = await backtestBtcWeeklyAccumulation();
  console.log(completed.result);
}

main().catch((error: unknown) => {
  console.error(error);
  process.exitCode = 1;
});

Run

Shell
npx tsx run-btc-weekly-accumulation.ts

TypeScript strategy and backtest functions

View complete TypeScript SDK functions

The same rules, dates and fees are used in both SDKs. The backtest function keeps its request key across retries.

TypeScript
import * as nt from "nexustrade";

export function createBtcWeeklyAccumulation() {
  const asset = nt.cryptoAsset("BTC-USD");
  return nt.portfolio(
    "Public SEO crypto example - BTC weekly accumulation",
    [
      nt.strategy(
          "Buy Bitcoin weekly",
          nt.gte(nt.DaysSinceOrder(asset, "Buy", "Filled"), nt.Value(7)),
          nt.buy(asset, 150, "dollars")
      ),
    ],
    { initialValue: 10000, supportsCrypto: true, supportsFractionalShares: true, alertsEnabled: false, dividendPolicy: "cash" }
  );
}

export async function backtestBtcWeeklyAccumulation(client = new nt.NexusTradeClient()) {
  const operation = await client.createBacktest(
    nt.backtest(createBtcWeeklyAccumulation(), {
      startDate: "2024-01-01", endDate: "2024-12-31",
      interval: "Day", baselineSymbol: "SPY",
      initialValue: 10000, generateEvents: true,
      dividendPolicy: "cash",
      feeConfig: {
        Stock: { type: "percent", amount: 0.1 },
        Cryptocurrency: { type: "percent", amount: 0.7 },
        Option: { type: "dollars", amount: 0.65 },
      },
    }),
    { idempotencyKey: "explore-btc-weekly-accumulation-2024-spy-v1" }
  );
  if (typeof operation.id !== "string") throw new Error("Missing backtest ID");
  return client.waitForBacktest(operation.id);
}

// Build locally: const book = createBtcWeeklyAccumulation();
// Run and inspect: const completed = await backtestBtcWeeklyAccumulation(); console.log(completed.result);

Completed 2024 backtest

BTC weekly accumulation: completed 2024 backtest with SPY and BTC buy and hold25.3K9.1K2024-01-012024-12-31
BTC weekly accumulation 2024-12-31, 21:00:00 UTC
13,863.37
SPY buy and hold 2024-12-31, 21:00:00 UTC
12,530.29
BTC buy and hold 2024-12-31, 21:00:00 UTC
21,926.92
BTC weekly accumulationSPY buy and holdBTC buy and holdHistorical simulation
Show the table · 11 rows, 2 columns

Scroll sideways to compare all columns. Select a heading to sort.

StatusCOMPLETE
Backtest return38.63%
Reported maximum drawdown14.14%
SPY buy-and-hold return25.30%
BTC buy-and-hold return119.27%
Total recorded trading fees$55.65
Engine closed-trade count0
Starting capital$10000.00
Ending portfolio value$13863.37
Ending cash$1994.35
Ending position value$11869.02

This saved algorithm completed a Day backtest from 2024-01-01 through 2024-12-31, with $10000.00 starting capital. The chart includes all 744 exported history points.

Compare the strategy with SPY and BTC buy and hold. Each benchmark invests the full $10000.00 starting balance over the same 2024 period. SPY follows its trading sessions; BTC includes weekends. This algorithm follows its own allocation and entry/exit rules, with 0.7% of traded notional charged on each fill. Explore cash and position values to see how capital was deployed.

Understand this entry with Aurora

  1. BTC-USD days since order >= constant

    Left value7>=Right value7ResultTrue
Show the table · 1 row, 5 columns

Scroll sideways to compare all columns. Select a heading to sort.

BTC-USD days since order >= constant7>=7True

At 2024-12-30T14:30:00.000Z, the recorded rule was: # of Days Since the Last Filled Buy Order of BTC-USD ≥ Constant 7. Its overall result was true. Read the individual comparisons below, then ask Aurora to explain how they led to the action.

The signal requested 150 dollars at a submitted price of 92,807.3438. 1 captured Filled order shares this timestamp; Aurora receives those fields with the signal.

Inspect the original signal record

View captured signal JSON
JSON
{
  "eventType": "BuySignal",
  "event": {
    "eventType": "BuySignal",
    "timestamp": "2024-12-30T14:30:00.000Z",
    "signals": [
      {
        "conditionName": "# of Days Since the Last Filled Buy Order of BTC-USD ≥ Constant 7",
        "audit": {
          "type": "minimal",
          "results": {
            "0": {
              "isTrue": true,
              "lhsValue": 7,
              "rhsValue": 7,
              "lhsError": null,
              "rhsError": null,
              "comparison": "greaterThanOrEqual"
            }
          },
          "failuresOnly": false
        },
        "isTrue": true,
        "actionName": "Buy",
        "actionMetadata": {
          "buyOrSell": {
            "targetAsset": {
              "name": "BTC-USD",
              "symbol": "BTC-USD",
              "type": "Cryptocurrency",
              "underlyingSymbol": null,
              "optionType": null,
              "expirationDate": null,
              "strikePrice": null,
              "multiplier": null
            },
            "allocation": {
              "type": "dollars",
              "amount": 150
            },
            "price": 92807.34375,
            "orderType": "Market Order"
          }
        },
        "orderExecution": {
          "type": "Market"
        }
      }
    ]
  },
  "timestamp": 1735569000000
}

Explore a drawdown period

Scale: 0 to 10.9K USD · zero baseline

Portfolio value

  • 2024-06-05T20:00:00.000Z$10900.84
  • 2024-08-05T13:30:00.000Z$9359.13

Scale: 0 to 6.53K USD · zero baseline

Cash

  • 2024-06-05T20:00:00.000Z$6525.85
  • 2024-08-05T13:30:00.000Z$5166.40

Scale: 0 to 4.37K USD · zero baseline

Position value

  • 2024-06-05T20:00:00.000Z$4374.99
  • 2024-08-05T13:30:00.000Z$4192.73
Show the table · 2 rows, 4 columns

Scroll sideways to compare all columns. Select a heading to sort.

2024-06-05T20:00:00.000Z$10900.84$6525.85$4374.99
2024-08-05T13:30:00.000Z$9359.13$5166.40$4192.73

Follow the decline from Jun 05, 2024 to Aug 05, 2024. The table retains the recorded portfolio, cash and position values. The engine reported maximum drawdown of 14.14%.

Test another version

Change one rule or choose a different date range, then compare the resulting curve and trade events with this saved experiment. Explore which trades, fees and periods explain the difference.

Exact captured fill fields

  1. 2024-01-22T14:30:00.000Z

    Pair

    BTC-USD

    Side

    Buy

    Units

    0.0036991276031406364

    Submitted price

    $40550.10

    Filled price

    $40550.10

    Fee

    $1.05

  2. 2024-01-29T14:30:00.000Z

    Pair

    BTC-USD

    Side

    Buy

    Units

    0.003575738280541065

    Submitted price

    $41949.38

    Filled price

    $41949.38

    Fee

    $1.05

  3. 2024-02-05T14:30:00.000Z

    Pair

    BTC-USD

    Side

    Buy

    Units

    0.0034619564345238557

    Submitted price

    $43328.10

    Filled price

    $43328.10

    Fee

    $1.05

  4. 2024-02-12T14:30:00.000Z

    Pair

    BTC-USD

    Side

    Buy

    Units

    0.003112950237788054

    Submitted price

    $48185.80

    Filled price

    $48185.80

    Fee

    $1.05

  5. 2024-02-19T14:30:00.000Z

    Pair

    BTC-USD

    Side

    Buy

    Units

    0.0028809034513223347

    Submitted price

    $52067.00

    Filled price

    $52067.00

    Fee

    $1.05

  6. 2024-02-26T14:30:00.000Z

    Pair

    BTC-USD

    Side

    Buy

    Units

    0.002917818945535186

    Submitted price

    $51408.26

    Filled price

    $51408.26

    Fee

    $1.05

  7. 2024-03-04T14:30:00.000Z

    Pair

    BTC-USD

    Side

    Buy

    Units

    0.0022873042344553553

    Submitted price

    $65579.38

    Filled price

    $65579.38

    Fee

    $1.05

  8. 2024-03-11T13:30:00.000Z

    Pair

    BTC-USD

    Side

    Buy

    Units

    0.002077172587293719

    Submitted price

    $72213.55

    Filled price

    $72213.55

    Fee

    $1.05

Recorded rows in source order; spacing does not represent elapsed time.

Inspect full UTC times and exact fractional quantities

Scroll sideways to compare all columns. Select a heading to sort.

2024-01-22T14:30:00.000ZBTC-USDBuy0.0036991276031406364$40550.10$40550.10$1.05
2024-01-29T14:30:00.000ZBTC-USDBuy0.003575738280541065$41949.38$41949.38$1.05
2024-02-05T14:30:00.000ZBTC-USDBuy0.0034619564345238557$43328.10$43328.10$1.05
2024-02-12T14:30:00.000ZBTC-USDBuy0.003112950237788054$48185.80$48185.80$1.05
2024-02-19T14:30:00.000ZBTC-USDBuy0.0028809034513223347$52067.00$52067.00$1.05
2024-02-26T14:30:00.000ZBTC-USDBuy0.002917818945535186$51408.26$51408.26$1.05
2024-03-04T14:30:00.000ZBTC-USDBuy0.0022873042344553553$65579.38$65579.38$1.05
2024-03-11T13:30:00.000ZBTC-USDBuy0.002077172587293719$72213.55$72213.55$1.05

Exact drawdown measurement

Read the exact snapshot timestamps and measurement comparison

The largest decline between exported snapshots was 14.14%, from $10900.84 at 2024-06-05T20:00:00.000Z to $9359.13 at 2024-08-05T13:30:00.000Z. The reported maximum drawdown is 14.14%. Explore the trades and holdings around those dates.

Continue exploring

Discussion

Sign in or create a free account to join the discussion.

No comments yet.

Aurora · AI research assistant

Try this in Aurora

Edit the request, then open it in Aurora. You choose when to send it.