136 lines
6.3 KiB
Python
136 lines
6.3 KiB
Python
"""Standalone check of the core claim: is a $150 LucidPro 50K evaluation worth more than $150 with
|
|
coin-flip trading? No project code, no market data: just Lucid's rules, a random-walk price, a coin.
|
|
|
|
Rules (LucidPro 50K, daily loss limit off), as in the handoff's rule table:
|
|
start $50,000, floor $48,000; the floor trails end-of-day balance by $2,000, and locks at $50,100 for good
|
|
once an end-of-day balance is above $52,100. Breach = touching the floor during the day.
|
|
Evaluation passes at $53,000. Funded payouts: cycle profit >= $500, largest day <= 40% of cycle profit,
|
|
balance >= $52,100 + cap; caps $2,000 then $2,500 x 4; 90% to you. Payout 5 ends the account (+$900 buyout).
|
|
Play (bold): one trade a day, direction by coin flip, stop at the floor, target at the next milestone
|
|
(as the project's simulator: sim/lucid.py run_eval / run_funded).
|
|
|
|
Run: python lucid_check.py (about 1-3 min)
|
|
python lucid_check.py 5000 (fewer evaluations, faster, noisier)
|
|
"""
|
|
import sys
|
|
import numpy as np
|
|
|
|
START, MLL, EVAL_TARGET = 50_000.0, 2_000.0, 53_000.0
|
|
LOCK_TRIGGER, LOCK_FLOOR, BUFFER, CONS = 52_100.0, 50_100.0, 52_100.0, 0.40
|
|
CAPS = [2_000.0, 2_500.0, 2_500.0, 2_500.0, 2_500.0]
|
|
FEE, SPLIT, BUYOUT = 150.0, 0.90, 900.0
|
|
|
|
|
|
def trade(rng, target, stop, day_sd, cost, steps=2000, step_usd=25.0):
|
|
"""One bracket for one day. The price is a random walk in small steps; the coin picks long or short.
|
|
Returns (P&L, resolved). Target fills exactly at the level (cost charged on top, so the
|
|
target is set to need + cost); the stop is the floor, so the account ends there.
|
|
day_sd=None: the day never ends, so every bracket finishes (the hand calculation's assumption)."""
|
|
coin = rng.choice([-1.0, 1.0])
|
|
if day_sd is None:
|
|
level = 0.0
|
|
while True:
|
|
pnl = level + coin * np.cumsum(rng.normal(0.0, step_usd, 4096))
|
|
up = np.flatnonzero(pnl >= target + cost); dn = np.flatnonzero(pnl <= -stop)
|
|
t_up = up[0] if up.size else 4096; t_dn = dn[0] if dn.size else 4096
|
|
if t_up < t_dn:
|
|
return target, True
|
|
if t_dn < t_up:
|
|
return -stop, True
|
|
level = pnl[-1]
|
|
pnl = coin * np.cumsum(rng.normal(0.0, day_sd / np.sqrt(steps), steps))
|
|
up = np.flatnonzero(pnl >= target + cost)
|
|
dn = np.flatnonzero(pnl <= -stop)
|
|
t_up = up[0] if up.size else steps
|
|
t_dn = dn[0] if dn.size else steps
|
|
if t_up < t_dn:
|
|
return target, True
|
|
if t_dn < t_up:
|
|
return -stop, True
|
|
return max(pnl[-1] - cost, -stop), False # unresolved: flat at the close
|
|
|
|
|
|
def eod_floor(floor, bal):
|
|
if bal > LOCK_TRIGGER:
|
|
return LOCK_FLOOR
|
|
return min(max(floor, bal - MLL), LOCK_FLOOR)
|
|
|
|
|
|
def evaluation(rng, day_sd, cost):
|
|
bal, floor = START, START - MLL
|
|
while True:
|
|
pnl, _ = trade(rng, EVAL_TARGET - bal, bal - floor, day_sd, cost)
|
|
bal += pnl
|
|
if bal <= floor:
|
|
return False
|
|
if bal >= EVAL_TARGET:
|
|
return True
|
|
floor = eod_floor(floor, bal)
|
|
|
|
|
|
def funded(rng, day_sd, cost):
|
|
"""Returns (gross withdrawn, payouts, locked)."""
|
|
bal, floor = START, START - MLL
|
|
cyc_start, max_day, n, paid = START, 0.0, 0, 0.0
|
|
while True:
|
|
if floor < LOCK_FLOOR: # before the lock: aim exactly at it
|
|
tgt = LOCK_TRIGGER - bal + 1
|
|
else: # after: next payout, within the 40% rule
|
|
b_star = max(cyc_start + max_day / CONS, BUFFER + CAPS[n])
|
|
tgt = max(min(b_star - bal, CONS * (b_star - cyc_start)), 50.0)
|
|
pnl, _ = trade(rng, tgt, bal - floor, day_sd, cost)
|
|
bal += pnl
|
|
if bal <= floor:
|
|
return paid, n, floor == LOCK_FLOOR
|
|
max_day = max(max_day, pnl)
|
|
floor = eod_floor(floor, bal)
|
|
cyc = bal - cyc_start
|
|
if floor == LOCK_FLOOR and cyc >= 500 and max_day <= CONS * cyc and bal - BUFFER >= CAPS[n]:
|
|
bal -= CAPS[n]; paid += CAPS[n]; n += 1
|
|
cyc_start, max_day = bal, 0.0
|
|
if n == 5:
|
|
return paid, n, True
|
|
|
|
|
|
def run(n_evals, day_sd, cost, seed=1):
|
|
rng = np.random.default_rng(seed)
|
|
net = np.empty(n_evals); passed = locked = paid_any = 0
|
|
for i in range(n_evals):
|
|
value = -FEE
|
|
if evaluation(rng, day_sd, cost):
|
|
passed += 1
|
|
paid, n, lk = funded(rng, day_sd, cost)
|
|
locked += lk; paid_any += n > 0
|
|
value += SPLIT * paid + (BUYOUT if n == 5 else 0.0)
|
|
net[i] = value
|
|
return passed / n_evals, locked / max(passed, 1), paid_any / max(passed, 1), net.mean(), net.std() / np.sqrt(n_evals)
|
|
|
|
|
|
def hand():
|
|
p_pass, p_lock = 2_000 / 5_000, 2_000 / 4_100
|
|
q1, q = 2_000 / 4_000, 2_000 / 4_500
|
|
w = q1 * (2_000 + 2_500 * (q + q**2 + q**3 + q**4)) # expected gross withdrawals once locked
|
|
per_eval = p_pass * p_lock * SPLIT * w - FEE
|
|
return p_pass, p_lock, w, per_eval
|
|
|
|
|
|
if __name__ == '__main__':
|
|
n = int(sys.argv[1]) if len(sys.argv) > 1 else 20_000
|
|
hp, hl, hw, he = hand()
|
|
print("Hand calculation (fair game, every bracket finishes the day it is placed, no costs, one big bracket per payout):")
|
|
print(f" P(pass) {hp:.1%} P(lock | funded) {hl:.1%} expected withdrawals once locked ${hw:,.0f} "
|
|
f"value per $150 evaluation {he:+,.0f}\n")
|
|
print(f"Simulation, {n:,} evaluations each (coin-flip direction, random-walk price, Lucid's rules incl. the 40% rule):")
|
|
print(f" {'setting':48s} {'P(pass)':>8s} {'P(lock|funded)':>15s} {'P(payout|funded)':>17s} {'net per eval':>13s}")
|
|
settings = [
|
|
("no costs, every bracket finishes", None, 0.0),
|
|
("$74 per trade (4 NQ at 1.5 ticks), all finish", None, 74.0),
|
|
("$74 per trade, day sd $4,000 (some unfinished days)", 4_000.0, 74.0),
|
|
("$148 per trade (double costs), day sd $4,000", 4_000.0, 148.0),
|
|
]
|
|
for label, sd, cost in settings:
|
|
p, l, pa, m, se = run(n, sd, cost)
|
|
print(f" {label:48s} {p:8.1%} {l:15.1%} {pa:17.1%} {m:+8,.0f} ± {1.96 * se:,.0f}")
|
|
print("\nWhat to look for: the first row should match the hand calculation within its error band; costs and unfinished")
|
|
print("days lower it but leave it above $0. This uses no signal and no market forecast: the value comes from the rules.")
|