@farazirfan/costar-server-executor 1.7.17 → 1.7.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/pi-embedded-runner/system-prompt.d.ts.map +1 -1
- package/dist/agent/pi-embedded-runner/system-prompt.js +11 -24
- package/dist/agent/pi-embedded-runner/system-prompt.js.map +1 -1
- package/dist/cli/skill-cmd.d.ts.map +1 -1
- package/dist/cli/skill-cmd.js +6 -2
- package/dist/cli/skill-cmd.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +19 -1
- package/dist/server.js.map +1 -1
- package/dist/skills/index.d.ts +1 -0
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +2 -0
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/sync.d.ts +29 -0
- package/dist/skills/sync.d.ts.map +1 -0
- package/dist/skills/sync.js +107 -0
- package/dist/skills/sync.js.map +1 -0
- package/dist/workspace/templates.d.ts +1 -1
- package/dist/workspace/templates.d.ts.map +1 -1
- package/dist/workspace/templates.js +23 -0
- package/dist/workspace/templates.js.map +1 -1
- package/package.json +1 -1
- package/skills/trading/LEARNING.md +171 -0
- package/skills/trading/SKILL.md +244 -0
- package/skills/trading/references/crypto.md +74 -0
- package/skills/trading/references/forex.md +75 -0
- package/skills/trading/references/metals.md +54 -0
- package/skills/trading/references/risk-management.md +74 -0
- package/skills/trading/references/stocks.md +74 -0
- package/skills/trading/references/strategies.md +98 -0
- package/skills/trading/scripts/position-sizer.py +125 -0
- package/skills/commit/SKILL.md +0 -69
- package/skills/review-pr/SKILL.md +0 -105
- package/skills/skill-creator/SKILL.md +0 -236
- package/skills/test/SKILL.md +0 -57
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Precious Metals Trading Reference
|
|
2
|
+
|
|
3
|
+
> **This file is agent-editable.** Update it as you learn from real trades.
|
|
4
|
+
|
|
5
|
+
## Gold (XAU/USD)
|
|
6
|
+
|
|
7
|
+
- Safe haven — rallies during uncertainty and currency debasement
|
|
8
|
+
- Inverse DXY correlation (-0.7 to -0.9)
|
|
9
|
+
- Central banks are net buyers (structural demand floor)
|
|
10
|
+
- Daily range: 1-3%, spikes 3-5% on crises
|
|
11
|
+
|
|
12
|
+
## Silver (XAG/USD)
|
|
13
|
+
|
|
14
|
+
- Dual role: precious metal + industrial (50% industrial demand)
|
|
15
|
+
- Moves 1.5-2x gold's percentage move
|
|
16
|
+
- Gold/Silver ratio: 60-80 range (above 80 = silver undervalued)
|
|
17
|
+
|
|
18
|
+
## Data to Fetch via APIs
|
|
19
|
+
|
|
20
|
+
- **Commodity quotes**: Gold, silver real-time prices
|
|
21
|
+
- **Historical prices**: EOD for trend analysis
|
|
22
|
+
- **Economic data**: Treasury rates (real yields = #1 gold driver), CPI
|
|
23
|
+
- **Economic calendar**: FOMC, CPI, NFP dates
|
|
24
|
+
- **Forex data**: DXY as leading indicator
|
|
25
|
+
|
|
26
|
+
## Drivers
|
|
27
|
+
|
|
28
|
+
### Bullish: Falling real yields, rising inflation, geopolitical crises, dollar weakness, central bank buying
|
|
29
|
+
### Bearish: Rising real yields, strong dollar, risk-on sentiment, hawkish central banks
|
|
30
|
+
|
|
31
|
+
## Strategies
|
|
32
|
+
|
|
33
|
+
### Gold/Silver Ratio Trade
|
|
34
|
+
- Above 85: buy silver, sell gold → close at 70-75
|
|
35
|
+
- Below 65: buy gold, sell silver → close at 70-75
|
|
36
|
+
- Historical win rate ~70% over 1-3 months
|
|
37
|
+
|
|
38
|
+
### DXY Correlation Trade
|
|
39
|
+
- DXY breakdown → buy gold. DXY breakout → short gold.
|
|
40
|
+
|
|
41
|
+
### Macro Events
|
|
42
|
+
- Dovish FOMC → buy gold. Hawkish → sell short-term.
|
|
43
|
+
- CPI higher than expected → buy gold (inflation hedge)
|
|
44
|
+
|
|
45
|
+
## Risk Rules
|
|
46
|
+
|
|
47
|
+
- Size down during FOMC weeks
|
|
48
|
+
- Don't fight strong DXY with long gold
|
|
49
|
+
- Silver drops 30%+ in crashes (industrial collapse)
|
|
50
|
+
- Weekend gap risk ($30-50 gold gaps)
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
*Last updated: Initial version. Agent should update after real metals trades.*
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Risk Management Reference
|
|
2
|
+
|
|
3
|
+
> **Most important file.** Violating these rules is the primary reason traders lose. Agent-editable but only to make rules STRICTER, never looser.
|
|
4
|
+
|
|
5
|
+
## Position Sizing
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Position Size = (Account Balance x Risk %) / (Entry Price - Stop Loss Price)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Use `python3 scripts/position-sizer.py` for calculations.
|
|
12
|
+
|
|
13
|
+
## Hard Limits (NEVER VIOLATE)
|
|
14
|
+
|
|
15
|
+
| Rule | Limit | Action When Hit |
|
|
16
|
+
|------|-------|-----------------|
|
|
17
|
+
| Per-trade risk | 1% max | Reduce size or skip |
|
|
18
|
+
| Total open risk | 3% | No new trades |
|
|
19
|
+
| Daily loss | 2% | Stop for the day |
|
|
20
|
+
| Weekly loss | 5% | Reduce sizes 50% |
|
|
21
|
+
| Max drawdown | 10% | Pause, full review |
|
|
22
|
+
| Critical drawdown | 15% | Stop trading, rebuild |
|
|
23
|
+
|
|
24
|
+
## R:R Requirements
|
|
25
|
+
|
|
26
|
+
| Quality | Min R:R |
|
|
27
|
+
|---------|---------|
|
|
28
|
+
| A+ (high confluence) | 2:1 |
|
|
29
|
+
| B (moderate) | 3:1 |
|
|
30
|
+
| C (speculative) | Skip it |
|
|
31
|
+
|
|
32
|
+
## Stop-Loss Rules
|
|
33
|
+
|
|
34
|
+
- Place at technical invalidation point BEFORE entry
|
|
35
|
+
- NEVER move stop away from entry
|
|
36
|
+
- Move to breakeven after 1R profit
|
|
37
|
+
- Trail by 1.5-2 ATR for trend trades
|
|
38
|
+
|
|
39
|
+
## Leverage
|
|
40
|
+
|
|
41
|
+
| Asset | Max |
|
|
42
|
+
|-------|-----|
|
|
43
|
+
| Crypto spot | 1x |
|
|
44
|
+
| Crypto futures | 3-5x |
|
|
45
|
+
| Forex | 10-20x |
|
|
46
|
+
| Stocks | 1-2x |
|
|
47
|
+
| Gold/Silver | 5-10x |
|
|
48
|
+
|
|
49
|
+
## Correlation: Max 2 same-direction on correlated assets (> 0.7)
|
|
50
|
+
|
|
51
|
+
## Drawdown Recovery
|
|
52
|
+
|
|
53
|
+
| Drawdown | Action |
|
|
54
|
+
|----------|--------|
|
|
55
|
+
| 0-3% | Normal |
|
|
56
|
+
| 3-5% | -25% size, A+ only |
|
|
57
|
+
| 5-8% | -50% size, 1 trade/day |
|
|
58
|
+
| 8-10% | Paper trade, review |
|
|
59
|
+
| 10%+ | Full stop |
|
|
60
|
+
|
|
61
|
+
## Pre-Trade Checklist
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
[ ] Regime identified? [ ] 2+ confluence signals?
|
|
65
|
+
[ ] R:R >= 2:1? [ ] Risk <= 1%?
|
|
66
|
+
[ ] Open risk < 3%? [ ] Not correlated?
|
|
67
|
+
[ ] Stop at tech level? [ ] No news in 2h?
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
ANY check fails → DO NOT TRADE.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
*Agent may make rules STRICTER only. NEVER looser.*
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Stocks Trading Reference
|
|
2
|
+
|
|
3
|
+
> **This file is agent-editable.** Update it as you learn from real trades.
|
|
4
|
+
|
|
5
|
+
## Market Characteristics
|
|
6
|
+
|
|
7
|
+
- Regular hours: NYSE/NASDAQ 9:30-16:00 ET, Mon-Fri
|
|
8
|
+
- Pre-market 4:00-9:30 ET, After-hours 16:00-20:00 ET
|
|
9
|
+
- Fundamentals + sentiment drive price
|
|
10
|
+
- Index moves (SPY/QQQ) drag individual stocks
|
|
11
|
+
- Sector rotation is a major theme
|
|
12
|
+
|
|
13
|
+
## Key Indices
|
|
14
|
+
|
|
15
|
+
| Index | Tracks | Signal |
|
|
16
|
+
|-------|--------|--------|
|
|
17
|
+
| SPY | S&P 500 large-cap | Broad market health |
|
|
18
|
+
| QQQ | NASDAQ 100 tech | Growth/tech sentiment |
|
|
19
|
+
| IWM | Russell 2000 small-cap | Risk appetite |
|
|
20
|
+
| VIX | Implied volatility | Fear gauge (> 25 = fear) |
|
|
21
|
+
|
|
22
|
+
## Data to Fetch via APIs
|
|
23
|
+
|
|
24
|
+
Your FMP APIs give you massive edge here:
|
|
25
|
+
- **Stock quotes**: real-time, after-hours, batch
|
|
26
|
+
- **Historical prices**: EOD and intraday (1min-4hr)
|
|
27
|
+
- **Technical indicators**: SMA, EMA, RSI, MACD, Williams, ADX from API directly
|
|
28
|
+
- **Fundamentals**: Income statements, balance sheets, key metrics, financial scores
|
|
29
|
+
- **Earnings**: Calendar, estimates, transcripts, surprises
|
|
30
|
+
- **Analyst data**: Ratings, price targets, grades, consensus
|
|
31
|
+
- **Institutional**: 13F filings, insider trades, fund holdings
|
|
32
|
+
- **Market breadth**: Sector performance, gainers/losers, most active
|
|
33
|
+
- **Screener**: Filter by 100+ criteria
|
|
34
|
+
- **News**: Stock-specific news, press releases
|
|
35
|
+
|
|
36
|
+
## Key Signals
|
|
37
|
+
|
|
38
|
+
### Market Internals
|
|
39
|
+
- Advance/Decline: more advancing = healthy rally
|
|
40
|
+
- % above 200 SMA: > 60% bullish, < 40% bearish
|
|
41
|
+
- VIX term structure: contango = complacent, backwardation = panic
|
|
42
|
+
|
|
43
|
+
### Sector Rotation Cycle
|
|
44
|
+
- Early expansion: tech, consumer discretionary
|
|
45
|
+
- Mid: industrials, materials
|
|
46
|
+
- Late: energy, staples
|
|
47
|
+
- Recession: utilities, healthcare
|
|
48
|
+
|
|
49
|
+
### Earnings
|
|
50
|
+
- Guidance matters more than results
|
|
51
|
+
- Pre-earnings: IV rises, range-bound
|
|
52
|
+
- Post-earnings: gap based on beat/miss vs expectations
|
|
53
|
+
|
|
54
|
+
## Stock-Specific Strategies
|
|
55
|
+
|
|
56
|
+
### Relative Strength
|
|
57
|
+
- Buy stocks outperforming sector AND SPY on pullbacks to 20 EMA
|
|
58
|
+
|
|
59
|
+
### Gap and Go
|
|
60
|
+
- Pre-market gaps > 3% on volume → trade first candle break
|
|
61
|
+
|
|
62
|
+
### ETF Sector Rotation
|
|
63
|
+
- Buy top 2-3 sectors by relative performance, avoid bottom 2-3
|
|
64
|
+
|
|
65
|
+
## Risk Rules (Stock-Specific)
|
|
66
|
+
|
|
67
|
+
- No single stock > 5% of portfolio
|
|
68
|
+
- Cut size 50% before earnings
|
|
69
|
+
- PDT rule: < $25K = max 3 day trades per 5 days
|
|
70
|
+
- Avoid penny stocks under $5
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
*Last updated: Initial version. Agent should update after real stock trades.*
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Trading Strategies Reference
|
|
2
|
+
|
|
3
|
+
> **This file is agent-editable.** Add new strategies you discover, refine existing ones based on performance, mark declining strategies.
|
|
4
|
+
|
|
5
|
+
## Strategy Selection
|
|
6
|
+
|
|
7
|
+
| Timeframe | Trending | Ranging | High Volatility |
|
|
8
|
+
|-----------|----------|---------|-----------------|
|
|
9
|
+
| Scalp (min) | Momentum scalp | Range scalp | Avoid |
|
|
10
|
+
| Day (hours) | Breakout, trend-follow | Mean reversion, VWAP | News fade |
|
|
11
|
+
| Swing (days) | Momentum, breakout | S/R bounce | Vol contraction |
|
|
12
|
+
| Position (weeks) | Trend-follow, macro | Accumulation | Hedged |
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Day Trading
|
|
17
|
+
|
|
18
|
+
### Breakout
|
|
19
|
+
- Consolidation → volume spike > 2x on break → enter on candle CLOSE
|
|
20
|
+
- Stop below range, target = measured move (range height)
|
|
21
|
+
|
|
22
|
+
### VWAP Mean Reversion
|
|
23
|
+
- Extended deviation from VWAP → reversion entry with RSI divergence
|
|
24
|
+
- Avoid strong trending days
|
|
25
|
+
|
|
26
|
+
### Opening Range Breakout (ORB)
|
|
27
|
+
- First 15-30 min high/low → trade the break, stop at opposite side
|
|
28
|
+
- Filter: trade in direction of pre-market bias
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Swing Trading
|
|
33
|
+
|
|
34
|
+
### EMA Trend Following
|
|
35
|
+
- Price > 20 > 50 > 200 EMA → buy pullback to 20 EMA
|
|
36
|
+
- Stop below 50 EMA, target previous high or 2-3x risk, hold 3-15 days
|
|
37
|
+
|
|
38
|
+
### Support/Resistance Bounce
|
|
39
|
+
- Bounce at S/R with candlestick confirmation, stop 0.5-1% beyond level
|
|
40
|
+
|
|
41
|
+
### Fibonacci Retracement
|
|
42
|
+
- Key levels: 38.2%, 50%, 61.8% — enter at confluence with S/R + EMA
|
|
43
|
+
- Stop below 78.6%
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Momentum
|
|
48
|
+
|
|
49
|
+
### Relative Strength
|
|
50
|
+
- Buy top 20% RS ranking on pullbacks, exit when RS drops below 50th pctile
|
|
51
|
+
|
|
52
|
+
### MACD Momentum
|
|
53
|
+
- MACD crosses signal + histogram growing + price above EMA → enter
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Mean Reversion
|
|
58
|
+
|
|
59
|
+
### RSI Extreme
|
|
60
|
+
- Long: RSI < 25 crosses back above 30. Short: RSI > 75 crosses below 70
|
|
61
|
+
- Avoid in strong trends
|
|
62
|
+
|
|
63
|
+
### Bollinger Squeeze
|
|
64
|
+
- Bands contract → breakout imminent → trade the direction when bands expand
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Arbitrage
|
|
69
|
+
|
|
70
|
+
### Cross-Exchange (Crypto)
|
|
71
|
+
- Same asset different prices → buy cheap, sell expensive simultaneously
|
|
72
|
+
|
|
73
|
+
### Pairs/Statistical
|
|
74
|
+
- Correlated assets diverge → long underperformer, short outperformer → close on mean reversion
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## News/Events
|
|
79
|
+
|
|
80
|
+
### Scheduled Events
|
|
81
|
+
- Wait 5-15 min post-release, trade new direction after noise settles
|
|
82
|
+
|
|
83
|
+
### Earnings Gap (Stocks)
|
|
84
|
+
- Gap with trend = trade it. Gap against = wait (60%+ fill rate). 0.5% max risk.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Rules
|
|
89
|
+
|
|
90
|
+
1. Max 2 strategies simultaneously on same asset
|
|
91
|
+
2. Strategies must confirm, not contradict
|
|
92
|
+
3. If indicators conflict → stay flat
|
|
93
|
+
4. Track each strategy separately in LEARNING.md
|
|
94
|
+
5. Retire strategies declining over 20+ trades
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
*Last updated: Initial version. Agent should add and refine based on real performance.*
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Position Sizer - Calculate exact position size based on risk parameters.
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
python3 scripts/position-sizer.py --account 1000 --risk-pct 1 --entry 50000 --stop 48500
|
|
7
|
+
python3 scripts/position-sizer.py --account 1000 --risk-pct 1 --entry 50000 --stop 48500 --target 53000
|
|
8
|
+
python3 scripts/position-sizer.py --account 1000 --risk-pct 1 --entry 50000 --stop 48500 --leverage 5
|
|
9
|
+
|
|
10
|
+
Output: Position size, dollar risk, units, and trade validation.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
import sys
|
|
15
|
+
import argparse
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def calculate_position(account, risk_pct, entry, stop, target=None, leverage=1):
|
|
19
|
+
"""Calculate position size and trade parameters."""
|
|
20
|
+
# Validate inputs
|
|
21
|
+
if account <= 0:
|
|
22
|
+
return {"error": "Account balance must be positive"}
|
|
23
|
+
if risk_pct <= 0 or risk_pct > 5:
|
|
24
|
+
return {"error": "Risk percentage must be between 0 and 5%"}
|
|
25
|
+
if entry <= 0 or stop <= 0:
|
|
26
|
+
return {"error": "Entry and stop prices must be positive"}
|
|
27
|
+
if entry == stop:
|
|
28
|
+
return {"error": "Entry and stop cannot be the same price"}
|
|
29
|
+
|
|
30
|
+
# Determine direction
|
|
31
|
+
is_long = stop < entry
|
|
32
|
+
direction = "LONG" if is_long else "SHORT"
|
|
33
|
+
|
|
34
|
+
# Calculate risk per unit
|
|
35
|
+
risk_per_unit = abs(entry - stop)
|
|
36
|
+
risk_pct_of_entry = risk_per_unit / entry * 100
|
|
37
|
+
|
|
38
|
+
# Dollar risk
|
|
39
|
+
dollar_risk = account * (risk_pct / 100)
|
|
40
|
+
|
|
41
|
+
# Position size (in units of the asset)
|
|
42
|
+
units = dollar_risk / risk_per_unit
|
|
43
|
+
|
|
44
|
+
# Position value (in dollars)
|
|
45
|
+
position_value = units * entry
|
|
46
|
+
|
|
47
|
+
# Account percentage used
|
|
48
|
+
account_pct_used = position_value / account * 100
|
|
49
|
+
|
|
50
|
+
# With leverage
|
|
51
|
+
margin_required = position_value / leverage
|
|
52
|
+
margin_pct = margin_required / account * 100
|
|
53
|
+
|
|
54
|
+
result = {
|
|
55
|
+
"direction": direction,
|
|
56
|
+
"entry_price": entry,
|
|
57
|
+
"stop_loss": stop,
|
|
58
|
+
"risk_per_unit": round(risk_per_unit, 6),
|
|
59
|
+
"risk_pct_of_entry": round(risk_pct_of_entry, 2),
|
|
60
|
+
"dollar_risk": round(dollar_risk, 2),
|
|
61
|
+
"units": round(units, 8),
|
|
62
|
+
"position_value": round(position_value, 2),
|
|
63
|
+
"account_pct_used": round(account_pct_used, 2),
|
|
64
|
+
"leverage": leverage,
|
|
65
|
+
"margin_required": round(margin_required, 2),
|
|
66
|
+
"margin_pct_of_account": round(margin_pct, 2),
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# Take-profit analysis
|
|
70
|
+
if target:
|
|
71
|
+
reward_per_unit = abs(target - entry)
|
|
72
|
+
reward_dollars = units * reward_per_unit
|
|
73
|
+
rr_ratio = reward_per_unit / risk_per_unit
|
|
74
|
+
|
|
75
|
+
result["take_profit"] = target
|
|
76
|
+
result["reward_per_unit"] = round(reward_per_unit, 6)
|
|
77
|
+
result["reward_dollars"] = round(reward_dollars, 2)
|
|
78
|
+
result["risk_reward_ratio"] = round(rr_ratio, 2)
|
|
79
|
+
result["rr_assessment"] = (
|
|
80
|
+
"EXCELLENT" if rr_ratio >= 3 else
|
|
81
|
+
"GOOD" if rr_ratio >= 2 else
|
|
82
|
+
"ACCEPTABLE" if rr_ratio >= 1.5 else
|
|
83
|
+
"POOR - DO NOT TAKE"
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Breakeven win rate needed
|
|
87
|
+
breakeven_wr = 1 / (1 + rr_ratio) * 100
|
|
88
|
+
result["breakeven_win_rate"] = round(breakeven_wr, 1)
|
|
89
|
+
|
|
90
|
+
# Validation warnings
|
|
91
|
+
warnings = []
|
|
92
|
+
|
|
93
|
+
if risk_pct > 2:
|
|
94
|
+
warnings.append("RISK TOO HIGH: Risking more than 2% per trade. Reduce to 1% or less.")
|
|
95
|
+
if account_pct_used > 30 and leverage == 1:
|
|
96
|
+
warnings.append(f"LARGE POSITION: Using {account_pct_used:.1f}% of account on one trade.")
|
|
97
|
+
if margin_pct > 50:
|
|
98
|
+
warnings.append(f"HIGH MARGIN: Using {margin_pct:.1f}% of account as margin.")
|
|
99
|
+
if leverage > 10:
|
|
100
|
+
warnings.append(f"EXTREME LEVERAGE: {leverage}x leverage is very risky.")
|
|
101
|
+
if target and result.get("risk_reward_ratio", 0) < 2:
|
|
102
|
+
warnings.append(f"LOW R:R: {result['risk_reward_ratio']}:1 is below minimum 2:1 threshold.")
|
|
103
|
+
|
|
104
|
+
result["warnings"] = warnings
|
|
105
|
+
result["trade_approved"] = len([w for w in warnings if "TOO HIGH" in w or "DO NOT TAKE" in w or "EXTREME" in w]) == 0
|
|
106
|
+
|
|
107
|
+
return result
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def main():
|
|
111
|
+
parser = argparse.ArgumentParser(description="Calculate trading position size")
|
|
112
|
+
parser.add_argument("--account", type=float, required=True, help="Account balance in USD")
|
|
113
|
+
parser.add_argument("--risk-pct", type=float, required=True, help="Risk percentage per trade (e.g., 1 for 1%%)")
|
|
114
|
+
parser.add_argument("--entry", type=float, required=True, help="Entry price")
|
|
115
|
+
parser.add_argument("--stop", type=float, required=True, help="Stop-loss price")
|
|
116
|
+
parser.add_argument("--target", type=float, help="Take-profit price (optional)")
|
|
117
|
+
parser.add_argument("--leverage", type=float, default=1, help="Leverage multiplier (default: 1)")
|
|
118
|
+
|
|
119
|
+
args = parser.parse_args()
|
|
120
|
+
result = calculate_position(args.account, args.risk_pct, args.entry, args.stop, args.target, args.leverage)
|
|
121
|
+
print(json.dumps(result, indent=2))
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
if __name__ == "__main__":
|
|
125
|
+
main()
|
package/skills/commit/SKILL.md
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: commit
|
|
3
|
-
description: Create git commits with proper formatting and commit messages. Follows Conventional Commits standard.
|
|
4
|
-
homepage: https://www.conventionalcommits.org/
|
|
5
|
-
metadata:
|
|
6
|
-
emoji: "📝"
|
|
7
|
-
requires:
|
|
8
|
-
bins: ["git"]
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Commit Skill
|
|
12
|
-
|
|
13
|
-
Create well-formatted git commits following best practices.
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
Before committing:
|
|
18
|
-
1. Check git status to see what's changed
|
|
19
|
-
2. Review the diff to understand changes
|
|
20
|
-
3. Stage only related files together
|
|
21
|
-
4. Write clear, concise commit messages
|
|
22
|
-
|
|
23
|
-
## Commit Message Format
|
|
24
|
-
|
|
25
|
-
Follow Conventional Commits:
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
<type>(<scope>): <description>
|
|
29
|
-
|
|
30
|
-
[optional body]
|
|
31
|
-
|
|
32
|
-
[optional footer]
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Types:
|
|
36
|
-
- `feat`: New feature
|
|
37
|
-
- `fix`: Bug fix
|
|
38
|
-
- `docs`: Documentation
|
|
39
|
-
- `style`: Formatting (no code change)
|
|
40
|
-
- `refactor`: Code refactoring
|
|
41
|
-
- `test`: Adding tests
|
|
42
|
-
- `chore`: Maintenance
|
|
43
|
-
|
|
44
|
-
## Examples
|
|
45
|
-
|
|
46
|
-
Simple commit:
|
|
47
|
-
```bash
|
|
48
|
-
git add src/tools/new-tool.ts
|
|
49
|
-
git commit -m "feat(tools): add new-tool for API calls"
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Commit with body:
|
|
53
|
-
```bash
|
|
54
|
-
git commit -m "fix(auth): handle expired tokens
|
|
55
|
-
|
|
56
|
-
Tokens are now refreshed automatically when they expire.
|
|
57
|
-
Previously this would cause auth failures.
|
|
58
|
-
|
|
59
|
-
Fixes #123"
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Best Practices
|
|
63
|
-
|
|
64
|
-
1. **Atomic commits**: Each commit should be a single logical change
|
|
65
|
-
2. **Clear messages**: Describe what and why, not how
|
|
66
|
-
3. **Present tense**: "Add feature" not "Added feature"
|
|
67
|
-
4. **Imperative mood**: "Fix bug" not "Fixes bug"
|
|
68
|
-
5. **Reference issues**: Include issue numbers when relevant
|
|
69
|
-
6. **Review before commit**: Always check `git diff --staged`
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: review-pr
|
|
3
|
-
description: Review pull requests using GitHub CLI. Check code changes, CI status, and provide feedback.
|
|
4
|
-
homepage: https://cli.github.com/manual/gh_pr
|
|
5
|
-
metadata:
|
|
6
|
-
emoji: "👀"
|
|
7
|
-
requires:
|
|
8
|
-
bins: ["gh"]
|
|
9
|
-
install:
|
|
10
|
-
- id: brew
|
|
11
|
-
kind: brew
|
|
12
|
-
formula: gh
|
|
13
|
-
bins: ["gh"]
|
|
14
|
-
label: "Install GitHub CLI (brew)"
|
|
15
|
-
- id: apt
|
|
16
|
-
kind: apt
|
|
17
|
-
package: gh
|
|
18
|
-
bins: ["gh"]
|
|
19
|
-
label: "Install GitHub CLI (apt)"
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
# Review PR Skill
|
|
23
|
-
|
|
24
|
-
Review pull requests efficiently using GitHub CLI.
|
|
25
|
-
|
|
26
|
-
## Viewing PRs
|
|
27
|
-
|
|
28
|
-
**List open PRs:**
|
|
29
|
-
```bash
|
|
30
|
-
gh pr list
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**View specific PR:**
|
|
34
|
-
```bash
|
|
35
|
-
gh pr view 123
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**View PR diff:**
|
|
39
|
-
```bash
|
|
40
|
-
gh pr diff 123
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
**Checkout PR locally:**
|
|
44
|
-
```bash
|
|
45
|
-
gh pr checkout 123
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Checking CI Status
|
|
49
|
-
|
|
50
|
-
**View checks:**
|
|
51
|
-
```bash
|
|
52
|
-
gh pr checks 123
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
**Watch checks (live updates):**
|
|
56
|
-
```bash
|
|
57
|
-
gh pr checks 123 --watch
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Reviewing
|
|
61
|
-
|
|
62
|
-
**View review comments:**
|
|
63
|
-
```bash
|
|
64
|
-
gh pr view 123 --comments
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
**Leave review comment:**
|
|
68
|
-
```bash
|
|
69
|
-
gh pr review 123 --comment --body "LGTM!"
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
**Request changes:**
|
|
73
|
-
```bash
|
|
74
|
-
gh pr review 123 --request-changes --body "Please fix..."
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**Approve:**
|
|
78
|
-
```bash
|
|
79
|
-
gh pr review 123 --approve
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Best Practices
|
|
83
|
-
|
|
84
|
-
1. **Check CI first**: Ensure tests pass before detailed review
|
|
85
|
-
2. **Review diff**: Look at `gh pr diff` for context
|
|
86
|
-
3. **Test locally**: Check out the PR if needed
|
|
87
|
-
4. **Constructive feedback**: Be specific and helpful
|
|
88
|
-
5. **Approve or request changes**: Don't leave hanging PRs
|
|
89
|
-
|
|
90
|
-
## Advanced
|
|
91
|
-
|
|
92
|
-
**View specific files:**
|
|
93
|
-
```bash
|
|
94
|
-
gh pr diff 123 --name-only
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
**Check review status:**
|
|
98
|
-
```bash
|
|
99
|
-
gh pr view 123 --json reviewDecision
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
**Merge after approval:**
|
|
103
|
-
```bash
|
|
104
|
-
gh pr merge 123 --squash
|
|
105
|
-
```
|