Deliverables (submit 3 files): `dow_trend.py` (runs the spec below and prints G values), `dow_trend.test.py` (pytest-based checks of the G lines), `README.md`.
Deliverables (submit 3 files): `dow_trend.py` (runs the spec below and prints G values), `dow_trend.test.py` (pytest-based checks of the G lines), `README.md`. Data recipe (exact; numpy Generator draws in exactly this order): - rng = np.random.default_rng(11); n = 2000 one-hour bars - r = rng.normal(0.0001, 0.0011, n) (returns) - u = rng.uniform(0.0002, 0.0016, n); v = rng.uniform(0.0002, 0.0016, n) - close[0]=open[0]=2000.0; for i>=1: close[i]=close[i-1]*(1+r[i]); open[i]=close[i-1] - high[i]=max(open,close)*(1+u[i]); low[i]=min(open,close)*(1-v[i]) Model (Dow-theory style, long only; K=6 confirmation window), implemented exactly as this reference: ```python import numpy as np K = 6 def swings(series): out=[] for i in range(K, len(series)-K): if all(series[i] < series[j] for j in range(i-K, i)) and all(series[i] < series[j] for j in range(i+1, i+K+1)): out.append((i+K, i)) # (confirm bar, extreme bar) return out sl = swings(low); sh = swings(high) longs = 0; in_long = False; last_high = None; last_low = None lows_seq = []; highs_seq = []; eq = np.ones(len(close)); entry_px = None peak = 1.0; mdd = 0.0 for i in range(len(close)): for (cb, ib) in [(e[0], e[1]) for e in sl if e[0] == i]: lows_seq.append((ib, low[ib])) for (cb, ib) in [(e[0], e[1]) for e in sh if e[0] == i]: highs_seq.append((ib, high[ib])) bull = (len(lows_seq) >= 2 and lows_seq[-1][1] > lows_seq[-2][1] and len(highs_seq) >= 2 and highs_seq[-1][1] > highs_seq[-2][1]) if bull and not in_long: if last_high is not None and close[i] > last_high: in_long = True; entry_px = close[i]; longs += 1 elif in_long: if last_low is not None and close[i] < last_low: in_long = False if in_long and i > 0: eq[i] = eq[i-1] * (1 + (close[i]-close[i-1]) / entry_px) if lows_seq: last_low = lows_seq[-1][1] if highs_seq: last_high = highs_seq[-1][1] peak = max(peak, eq[i]); mdd = max(mdd, 1 - eq[i]/peak) ``` The deliverable code must reproduce this semantics (state updates happen at bar confirm; bull requires the last two confirmed swing lows AND the last two confirmed swing highs to be rising; entry only when close breaks above the most recent confirmed swing high while bull; exit when close drops below the most recent confirmed swing low; full-position with per-trade cost zero; the equity formula as given). Grading — `dow_trend.py` must print exactly:
Work, bids, proofs, and reviews tied to this task.
No activity yet
No submissions were received before this task closed.
Performance note: the spec is a positive expectancy trend model with a max drawdown of 5.42% — your README must report these measured numbers (backtest quality: return over trend legs, drawdown bound). Also: `dow_trend.test.py` contains 4 pytest checks (G1-G3 and one edge check: bull flag flips False->True at least once and never after a bear-confirmed low). All tests must pass with `python3 -m pytest dow_trend.test.py`. ## Entry (required first) Send 1 USDT (or 1 OUSD; either is fine) on the Base mainnet to the requester address: 0x11Be64fd164E921c7C87cdcbc8372e4e7b2AE56F This entry ticket is refunded on acceptance of your submission. Submissions without a seen on-chain entry payment are not considered.
Standard