Files
invest-copilot/src/backend/routers/__pycache__/strategies.cpython-314.pyc
T

94 lines
11 KiB
Plaintext
Raw Normal View History

2026-05-30 11:28:59 -04:00
+
îjðãóž€Rt^RIt^RIHt^RIHtHtHt^RIHtH t H
t
^RI H t H
t
HtHtHtHt^RIHt^RIHt]P,!]4t]!RR .R
7tR R lt]P7R
R]],R7]!]43RRll4t]P=R
R]^ÉR7]!]43RRll4t]P7RR]R7]!]43RRll4t ]PCRR]R7]!]43RRll4t"]PGRR^ÌR7]!]43RR ll4t$]P=R!R"]R7R]!]43R#R$ll4t%R#)%zStrategy CRUD endpoints.N)Údatetime)Ú APIRouterÚDependsÚ
HTTPException)Ú
execute_queryÚexecute_commandÚ execute_one)ÚStrategyCreateÚStrategyUpdateÚStrategyResponseÚBacktestParamsÚBacktestResultÚBacktestResponse)Úget_current_user)Úbacktest_servicez /strategiesÚ
strategies)ÚprefixÚtagscó0€V^8„dQhR\R\/#)éÚ strategy_idÚuser_id)Ústr)Úformats"ÚN/home/laptran/ai-env/projects/invest-copilot/src/backend/routers/strategies.pyÚ __annotate__rs€÷JñJ¬sðJ¼SñJócƒóf"€\RW34GRjx€L
pV'g\RRR7hR#L5i)z0Verify the authenticated user owns the strategy.z8SELECT id FROM strategies WHERE id = $1 AND user_id = $2Né”úStrategy not found©Ú status_codeÚdetail)rr)rrÚss&& rÚ_require_strategy_ownerr$s:é€äØBØ Ðó÷ €A÷
ܨÐ4HÔIÐIñ
ñ  ùs‚1“/” 1 1ÚzGet all user strategies)ÚsummaryÚresponse_modelcó$€V^8„dQhR\/#)rÚ current_user)Údict)rs"rrr&s€÷ñ¬Dñrcƒóˆ"€VR,p\RV34GRjx€L
pVUu.uF�p\VR,VR,VPR4VR,\VR,\4'd
VR,M\ VR,4VPR4VR ,VR
,R 7NK� up#Lžuupi5i) z.Get all strategies for the authenticated user.ÚidzÍ
SELECT id, name, description, type, conditions,
backtest_results, created_at, updated_at
FROM strategies
WHERE user_id = $1
ORDER BY updated_at DESC
NÚnameÚ descriptionÚtypeÚ
conditionsÚbacktest_resultsÚ
created_atÚ
updated_at©r,r-r.r/r0ÚbacktestResultsÚ createdAtÚ updatedAt)rr ÚgetÚ
isinstancer*)r)rÚrowsÚrs& rÚget_user_strategiesr<!sÃé€ð˜4Õ €GÜð ð
ˆ
ó ÷ €Dñ,ó ñˆAô Ø��wØ�6•ØŸ™˜mÓ,Ø�6•Ü*4°Q°|µ_Äd×*KÒ*K�q˜–ÔQUÐVWÐXdÕVeÓQfØŸE™EÐ"4Ó5ؘ •oؘ •o÷
ññ ð ñ ùò ùs!‚CœB;�C¥BB=Â8CÂ=CzCreate a new strategy)r&r'r!có0€V^8„dQhR\R\/#)rÚbodyr))r r*)rs"rrrIs€÷ñ¤ð¼dñrc ƒó´"€VR,p\RW PVPVPVP34GRjx€L
p\ VR,VR,VP
R4VR,\VR,\4'd
VR,M\VR,4VP
R4VR ,VR
,R 7#LŽ5i) zCreate a new strategy.r,zß
INSERT INTO strategies (user_id, name, description, type, conditions)
VALUES ($1, $2, $3, $4, $5)
RETURNING id, name, description, type, conditions, backtest_results, created_at, updated_at
Nr-r.r/r0r1r2r3r4) rr-r.r/r0r r8r9r*)r>r)rÚrows&& rÚcreate_strategyrACs¿é€ð˜4Õ €GÜð ð
—)‘)˜T×-Ñ-¨t¯y©y¸$¿/¹/ÐJó
÷ €Cô Ø ˆt�9Ø
��[Ø—G‘G˜MÓ*Ø
��[Ü(2°3°|Õ3DÄd×(KÒ(K�3�|Ö$ÔQUÐVYÐZfÕVgÓQhØŸ™Ð 2Ó3Ø�lÕ#Ø�lÕ#ô ð ñ ùs‚ACÁCÁBCz/{strategy_id}zGet strategy detailscó0€V^8„dQhR\R\/#©rrr)©rr*)rs"rrrfs€÷ñ¤Cð´tñrc ƒó²"€VR,p\W4GRjx€L
\RV34GRjx€L
pV'g\RRR7h\VR,VR,VP R4VR ,\ VR
,\ 4'd
VR
,M\
VR
,4VP R 4VR ,VR
,R7#L¸L¥5i)z$Get details for a specific strategy.r,NzŸ
SELECT id, name, description, type, conditions,
backtest_results, created_at, updated_at
FROM strategies WHERE id = $1
rrr r-r.r/r0r1r2r3r4)r$rrr r8r9r*)rr)rr@s&& rÚ get_strategyrFasÊé€ð˜4Õ €GÜ
! +Ó
7×7Ð7äð ð
ˆó
÷ €C÷ ܨÐ4HÔIÐIä Ø ˆt�9Ø
��[Ø—G‘G˜MÓ*Ø
��[Ü(2°3°|Õ3DÄd×(KÒ(K�3�|Ö$ÔQUÐVYÐZfÕVgÓQhØŸ™Ð 2Ó3Ø�lÕ#Ø�lÕ#ô ð ñ8ñ ùs%‚CšC›C¯C° C¼BCÃCzUpdate strategycó<€V^8„dQhR\R\R\/#)rrr>r))rr
r*)rs"rrr‡s&€÷3ñ3Üð3ä
ð3ôñ3rc ƒóX"€VR,p\W4GRjx€L
.p.p^pVPe9VPRV 24VPVP4V^,
pVPe9VPRV 24VPVP4V^,
pVPe9VPRV 24VPVP4V^,
pV'g6\ RV34GRjx€L
pV'g\
RRR 7h\R/VB#VPV4R
R PV4 R \V4 R
2p\ V\V44GRjx€L
pV'g\
RRR 7h\VR,VR,VPR4VR,\VR,\4'd
VR,M\VR,4VPR4VR,VR,R7#ELELL©5i)zUpdate a strategy.r,Nzname = $zdescription = $zconditions = $zvSELECT id, name, description, type, conditions, backtest_results, created_at, updated_at FROM strategies WHERE id = $1rrr zUPDATE strategies SET z, z!, updated_at = NOW() WHERE id = $z RETURNING *r-r.r/r0r1r2r3r4©)r$r-Úappendr.r0rrr ÚjoinÚlenÚtupler8r9r*) rr>r)rÚupdatesÚparamsÚ param_idxr@Úsqls &&& rÚupdate_strategyrR‚sìé€ð˜4Õ €GÜ
! +Ó
7×7Ð7à€GØ
€FØ€Ià ‡y�yÒØ�‰˜ ) Ð-Ô.Ø�
‰
�d—i‘iÔ Ø�Q�ˆ Ø ×ÑÒ#Ø�‰˜¨¨ Ð4Ô5Ø�
‰
�d×&Ñ&Ô'Ø�Q�ˆ Ø ‡�Ò"Ø�‰˜¨  {Ð3Ô4Ø�
‰
�d—o‘oÔ&Ø�Q�ˆ ç Üð
,à
ˆNó
÷
ˆ÷
ܨCÐ8LÔMÐ MÜÑ& #Ñ&Ð&à
‡M�M�+ÔØ " 4§9¡9¨WÓ#5Ð"6Ð6WÔX[Ð\bÓXcÐWdÐdpÐ
q€CܘC¤ v£Ó/×
/€Cß Ü¨Ð4HÔIÐIä Ø ˆt�9Ø