beast-agent 2.76.5 → 2.77.0

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.
Files changed (54) hide show
  1. package/package.json +1 -1
  2. package/src/agent/bots.js +669 -664
  3. package/src/agent/customtools.js +6 -19
  4. package/src/agent/engine.js +55 -307
  5. package/src/agent/seeds/tool-yazma/SKILL.md +13 -16
  6. package/src/agent/skills.js +14 -35
  7. package/src/agent/supertonic.js +622 -0
  8. package/src/agent/tools.js +3 -7
  9. package/src/main.js +77 -6068
  10. package/src/preload.js +2 -17
  11. package/src/renderer/i18n.js +14 -8
  12. package/src/renderer/index.html +0 -297
  13. package/src/renderer/renderer.js +142 -2280
  14. package/src/renderer/style.css +3 -825
  15. package/src/agent/defaulttools/mt5_barlar2/run.js +0 -188
  16. package/src/agent/defaulttools/mt5_barlar2/tool.json +0 -23
  17. package/src/agent/defaulttools/mt5_bekleyen/run.js +0 -105
  18. package/src/agent/defaulttools/mt5_bekleyen/tool.json +0 -18
  19. package/src/agent/defaulttools/mt5_durum/run.js +0 -93
  20. package/src/agent/defaulttools/mt5_durum/tool.json +0 -10
  21. package/src/agent/defaulttools/mt5_emir/run.js +0 -98
  22. package/src/agent/defaulttools/mt5_emir/tool.json +0 -17
  23. package/src/agent/defaulttools/mt5_emir_iptal/run.js +0 -90
  24. package/src/agent/defaulttools/mt5_emir_iptal/tool.json +0 -12
  25. package/src/agent/defaulttools/mt5_fiyat/run.js +0 -87
  26. package/src/agent/defaulttools/mt5_fiyat/tool.json +0 -16
  27. package/src/agent/defaulttools/mt5_gecmis/run.js +0 -87
  28. package/src/agent/defaulttools/mt5_gecmis/tool.json +0 -12
  29. package/src/agent/defaulttools/mt5_kapat/run.js +0 -108
  30. package/src/agent/defaulttools/mt5_kapat/tool.json +0 -15
  31. package/src/agent/defaulttools/mt5_m15_m5/m15m5.py +0 -60
  32. package/src/agent/defaulttools/mt5_m15_m5/run.js +0 -73
  33. package/src/agent/defaulttools/mt5_m15_m5/tool.json +0 -10
  34. package/src/agent/defaulttools/mt5_pozisyon_gecmis/run.js +0 -144
  35. package/src/agent/defaulttools/mt5_pozisyon_gecmis/tool.json +0 -12
  36. package/src/agent/defaulttools/mt5_shot/run.js +0 -649
  37. package/src/agent/defaulttools/mt5_shot/stitch.js +0 -151
  38. package/src/agent/defaulttools/mt5_shot/tool.json +0 -25
  39. package/src/agent/defaulttools/mt5_sltp/run.js +0 -92
  40. package/src/agent/defaulttools/mt5_sltp/tool.json +0 -14
  41. package/src/agent/financetools.js +0 -1025
  42. package/src/agent/finindicators.js +0 -254
  43. package/src/agent/finrisk.js +0 -289
  44. package/src/agent/finstats.js +0 -239
  45. package/src/agent/finwatch.js +0 -302
  46. package/src/agent/mt5/BeastFinance.mq5 +0 -498
  47. package/src/agent/mt5/BeastShot.tpl +0 -0
  48. package/src/agent/mt5setup.js +0 -542
  49. package/src/agent/scripts/mt5_bridge.py +0 -575
  50. package/src/agent/seeds/haber-duygu/SKILL.md +0 -49
  51. package/src/agent/seeds/mql5/SKILL.md +0 -154
  52. package/src/agent/seeds/price-action/SKILL.md +0 -60
  53. package/src/agent/seeds/risk-yonetimi/SKILL.md +0 -52
  54. package/src/mt5bridge.js +0 -215
@@ -1,188 +0,0 @@
1
- 'use strict';
2
- /* mt5_barlar2 - KOPRUSUZ OHLC bari.
3
- Giris (stdin JSON): {"symbol":"GOLD","timeframe":"M1","count":60}
4
- Cikis (stdout JSON): {"ok":true,"symbol","timeframe","count","bars":[{t,ts,o,h,l,c,v}]}
5
- Yol: MT5 koprusune DOKUNMAZ; ayri bir python surecinde MetaTrader5 modulunu dogrudan cagirir.
6
- SALT-OKUNUR: emir / pending / close cagrisi YOK. */
7
-
8
- const fs = require('fs');
9
- const os = require('os');
10
- const path = require('path');
11
- const { spawnSync } = require('child_process');
12
-
13
- const DEFAULT_SYMBOL = 'GOLD';
14
- const DEFAULT_TF = 'M1';
15
- const DEFAULT_COUNT = 60;
16
- const TF_ALLOWED = ['M1', 'M5', 'M15', 'M30', 'H1', 'H4', 'D1'];
17
- const TERMINALS = [
18
- 'C:\\Program Files\\FxPro - MetaTrader 5\\terminal64.exe',
19
- 'C:\\Program Files\\MetaTrader 5\\terminal64.exe',
20
- ];
21
-
22
- function emit(obj) {
23
- process.stdout.write(JSON.stringify(obj));
24
- process.exit(obj.ok ? 0 : 1);
25
- }
26
-
27
- /* ---------- args: stdin JSON (argv / env yedek) ---------- */
28
- function readArgs() {
29
- return new Promise((resolve) => {
30
- let buf = '';
31
- let settled = false;
32
- const finish = () => {
33
- if (settled) return;
34
- settled = true;
35
- clearTimeout(timer);
36
- try { process.stdin && process.stdin.pause(); } catch {}
37
- const a = process.argv.slice(2).find((x) => String(x).trim().startsWith('{'));
38
- if (!buf && a) return resolve({ raw: a, source: 'argv' });
39
- if (!buf && process.env.BEAST_TOOL_ARGS) return resolve({ raw: process.env.BEAST_TOOL_ARGS, source: 'env' });
40
- resolve({ raw: buf, source: buf ? 'stdin' : 'none' });
41
- };
42
- const timer = setTimeout(finish, 800);
43
- try {
44
- process.stdin.setEncoding('utf8');
45
- process.stdin.on('data', (c) => { buf += c; });
46
- process.stdin.on('end', finish);
47
- process.stdin.on('error', finish);
48
- process.stdin.resume();
49
- } catch { finish(); }
50
- });
51
- }
52
-
53
- function normSymbol(s) {
54
- const t = String(s || DEFAULT_SYMBOL).toUpperCase().replace(/[^A-Z0-9.]/g, '');
55
- if (!t) return DEFAULT_SYMBOL;
56
- if (t === 'XAUUSD') return 'GOLD';
57
- if (t === 'BTCUSD' || t === 'BTC') return 'BITCOIN';
58
- return t;
59
- }
60
- function normTf(v) {
61
- const t = String(v || DEFAULT_TF).toUpperCase();
62
- return TF_ALLOWED.includes(t) ? t : DEFAULT_TF;
63
- }
64
- function normCount(v) {
65
- let n = Math.round(Number(v));
66
- if (!isFinite(n) || n <= 0) n = DEFAULT_COUNT;
67
- return Math.max(1, Math.min(500, n));
68
- }
69
-
70
- function pythonCandidates() {
71
- return [
72
- 'python', 'py', 'python3',
73
- (process.env.APPDATA || '') + '\\\\beast\\\\py\\\\python.exe',
74
- 'C:\\Python314\\python.exe',
75
- 'C:\\Python313\\python.exe', 'C:\\Python312\\python.exe',
76
- 'C:\\Python311\\python.exe', 'C:\\Python310\\python.exe',
77
- ];
78
- }
79
-
80
- function buildPy(SYMBOL, TIMEFRAME, COUNT) {
81
- return `
82
- import json, sys, datetime
83
- try:
84
- import MetaTrader5 as mt5
85
- except Exception as e:
86
- print("ERR_MODULE " + type(e).__name__ + ": " + str(e)); sys.exit(2)
87
-
88
- SYMBOL = ${JSON.stringify(SYMBOL)}
89
- TFNAME = ${JSON.stringify(TIMEFRAME)}
90
- COUNT = ${COUNT}
91
- TF = {"M1": mt5.TIMEFRAME_M1, "M5": mt5.TIMEFRAME_M5, "M15": mt5.TIMEFRAME_M15,
92
- "M30": mt5.TIMEFRAME_M30, "H1": mt5.TIMEFRAME_H1, "H4": mt5.TIMEFRAME_H4,
93
- "D1": mt5.TIMEFRAME_D1}[TFNAME]
94
-
95
- if not mt5.initialize():
96
- for t in ${JSON.stringify(TERMINALS)}:
97
- if mt5.initialize(path=t):
98
- break
99
- if mt5.terminal_info() is None:
100
- print("ERR_INITIALIZE " + str(mt5.last_error())); sys.exit(3)
101
-
102
- info = mt5.symbol_info(SYMBOL)
103
- if info is None:
104
- print("ERR_SYMBOL yok: " + SYMBOL); sys.exit(4)
105
- if not info.visible:
106
- mt5.symbol_select(SYMBOL, True)
107
-
108
- rates = mt5.copy_rates_from_pos(SYMBOL, TF, 0, COUNT)
109
- if rates is None or len(rates) == 0:
110
- print("ERR_RATES " + str(mt5.last_error())); sys.exit(5)
111
-
112
- bars = [{"t": int(r["time"]),
113
- "ts": datetime.datetime.utcfromtimestamp(int(r["time"])).strftime("%Y-%m-%d %H:%M"),
114
- "o": float(r["open"]), "h": float(r["high"]), "l": float(r["low"]),
115
- "c": float(r["close"]), "v": int(r["tick_volume"])} for r in rates]
116
- tick = mt5.symbol_info_tick(SYMBOL)
117
- print("###BARS###" + json.dumps({"bars": bars, "digits": int(info.digits),
118
- "bid": float(tick.bid) if tick else None, "ask": float(tick.ask) if tick else None}))
119
- mt5.shutdown()
120
- `;
121
- }
122
-
123
- (async () => {
124
- const received = await readArgs();
125
- let args = {};
126
- try { args = JSON.parse(String(received.raw || '').trim() || '{}'); } catch { args = {}; }
127
- if (!args || typeof args !== 'object' || Array.isArray(args)) args = {};
128
-
129
- try {
130
- const log = path.join(__dirname, 'args.log');
131
- if (fs.existsSync(log) && fs.statSync(log).size > 20000) fs.rmSync(log);
132
- fs.appendFileSync(log, JSON.stringify({ at: new Date().toISOString(), source: received.source, raw: String(received.raw).slice(0, 200) }) + '\n');
133
- } catch {}
134
-
135
- const SYMBOL = normSymbol(args.symbol);
136
- const TIMEFRAME = normTf(args.timeframe);
137
- const COUNT = normCount(args.count);
138
-
139
- const scriptPath = path.join(os.tmpdir(), 'beast_mt5_barlar2_' + process.pid + '.py');
140
- try { fs.writeFileSync(scriptPath, buildPy(SYMBOL, TIMEFRAME, COUNT)); }
141
- catch (e) { return emit({ ok: false, error: 'script yazilamadi: ' + String(e && e.message) }); }
142
-
143
- let lastErr = '';
144
- const tried = [];
145
- for (const cmd of pythonCandidates()) {
146
- tried.push(cmd);
147
- let r;
148
- try { r = spawnSync(cmd, [scriptPath], { encoding: 'utf8', timeout: 60000, windowsHide: true }); }
149
- catch (e) { lastErr = cmd + ': ' + String(e && e.message); continue; }
150
- const text = String((r && r.stdout) || '');
151
- const err = String((r && r.stderr) || '');
152
- const idx = text.indexOf('###BARS###');
153
- if (idx >= 0) {
154
- let data = null;
155
- try { data = JSON.parse(text.slice(idx + 10).trim()); }
156
- catch (e) { lastErr = cmd + ' json: ' + String(e && e.message); continue; }
157
- return emit({
158
- ok: true,
159
- symbol: SYMBOL,
160
- timeframe: TIMEFRAME,
161
- count: data.bars.length,
162
- requested: COUNT,
163
- digits: data.digits,
164
- bid: data.bid,
165
- ask: data.ask,
166
- interpreter: cmd,
167
- route: 'BYPASS - dogrudan MetaTrader5 python (kopru kullanilmadi)',
168
- args_source: received.source,
169
- bars: data.bars,
170
- });
171
- }
172
- lastErr = (err || text || ('cikis kodu ' + (r && r.status))).trim().slice(0, 400);
173
- }
174
-
175
- emit({
176
- ok: false,
177
- error: 'python MetaTrader5 ile bar okunamadi',
178
- symbol: SYMBOL, timeframe: TIMEFRAME, count: COUNT,
179
- args_received: String(received.raw).slice(0, 200),
180
- args_source: received.source,
181
- tried,
182
- last_error: lastErr.slice(0, 600),
183
- });
184
- })();
185
-
186
- /* PATCH 2026-09-10b: electron app-mode cocuk prosesi kapanmiyordu (90sn timeout).
187
- stdout'un boruya bosalmasi icin kisa bekleme, sonra zorla cik. */
188
- setTimeout(() => process.exit(0), 1500);
@@ -1,23 +0,0 @@
1
- {
2
- "name": "mt5_barlar2",
3
- "description": "MT5'ten GERCEK OHLC mum verisi ceker - KOPRUSUZ yol: ayri bir python surecinde MetaTrader5 modulunu dogrudan cagirir (koprunun 'bars' handler'i olmadigi icin calisan yol). SALT-OKUNUR, islem acmaz. Girdi: {\"symbol\":\"GOLD\"|\"BITCOIN\",\"timeframe\":\"M1\"|\"M5\"|\"M15\"|\"M30\"|\"H1\"|\"H4\"|\"D1\",\"count\":60} (max 500). Cikti: {ok,symbol,timeframe,count,bars:[{t,ts,o,h,l,c,v}]} en eskiden yeniye.",
4
- "parameters": {
5
- "type": "object",
6
- "properties": {
7
- "symbol": {
8
- "type": "string",
9
- "description": "Broker sembol adi: GOLD veya BITCOIN (XAUUSD/BTCUSD DEGIL). Varsayilan GOLD."
10
- },
11
- "timeframe": {
12
- "type": "string",
13
- "description": "M1 | M5 | M15 | M30 | H1 | H4 | D1. Varsayilan M1."
14
- },
15
- "count": {
16
- "type": "number",
17
- "description": "Kac bar isteniyor (1-500, varsayilan 60)."
18
- }
19
- },
20
- "required": []
21
- },
22
- "updatedAt": "2026-09-10T10:26:00.000Z"
23
- }
@@ -1,105 +0,0 @@
1
- 'use strict';
2
- // MT5 BEKLEYEN EMIR KOY — stdin: JSON args · stdout: JSON sonuç
3
- const { spawn } = require('child_process');
4
- const fs = require('fs');
5
- const path = require('path');
6
-
7
- /* TAŞINABİLİR YOL ÇÖZÜMÜ: Beast gömülü python → sistem python'ları → PATH.
8
- Köprü dosyası %APPDATA%\beast\finance\mt5_bridge.py'den (veya BEAST_FINANCE_DIR)
9
- okunur; ortam değişkenleriyle geçersiz kılınabilir. */
10
- function resolvePython() {
11
- const cands = [];
12
- if (process.env.BEAST_PYTHON) cands.push({ exe: String(process.env.BEAST_PYTHON), args: [] });
13
- if (process.env.APPDATA) cands.push({ exe: path.join(process.env.APPDATA, 'beast', 'py', 'python.exe'), args: [] });
14
- for (const v of ['314', '313', '312', '311', '310']) cands.push({ exe: 'C:\\Python' + v + '\\python.exe', args: [] });
15
- cands.push({ exe: 'python', args: [] }, { exe: 'py', args: ['-3'] });
16
- for (const c of cands) {
17
- if (c.exe === 'python' || c.exe === 'py') return c;
18
- try { if (fs.existsSync(c.exe)) return c; } catch (e) {}
19
- }
20
- return { exe: 'python', args: [] };
21
- }
22
- function resolveBridge() {
23
- const cands = [];
24
- if (process.env.BEAST_BRIDGE) cands.push(String(process.env.BEAST_BRIDGE));
25
- if (process.env.BEAST_FINANCE_DIR) cands.push(path.join(String(process.env.BEAST_FINANCE_DIR), 'mt5_bridge.py'));
26
- if (process.env.APPDATA) cands.push(path.join(process.env.APPDATA, 'beast', 'finance', 'mt5_bridge.py'));
27
- for (const p of cands) { try { if (p && fs.existsSync(p)) return p; } catch (e) {} }
28
- return cands[0] || '';
29
- }
30
- const PYSPEC = resolvePython();
31
- const PY = PYSPEC.exe;
32
- const PY_ARGS = PYSPEC.args;
33
- const BRIDGE = resolveBridge();
34
-
35
- const TIMEOUT = 35000;
36
-
37
- function call(requests) {
38
- return new Promise((resolve) => {
39
- let py;
40
- try { py = spawn(PY, [...PY_ARGS, BRIDGE], { windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] }); }
41
- catch (e) { return resolve({ ok: false, error: 'python baslatilamadi: ' + e.message }); }
42
- const results = {};
43
- let buf = '';
44
- let errTail = '';
45
- let settled = false;
46
- const finish = (obj) => { if (!settled) { settled = true; clearTimeout(timer); try { py.kill(); } catch (e) {} resolve(obj); } };
47
- const timer = setTimeout(() => finish({ ok: false, error: 'zaman asimi: MT5 terminali acik ve yanit veriyor mu?' }), TIMEOUT);
48
- py.stdout.on('data', (d) => {
49
- buf += d.toString('utf8');
50
- let i;
51
- while ((i = buf.indexOf('\n')) >= 0) {
52
- const line = buf.slice(0, i).trim(); buf = buf.slice(i + 1);
53
- if (!line) continue;
54
- let o = null;
55
- try { o = JSON.parse(line); } catch (e) { continue; }
56
- if (o && o.event) continue;
57
- if (o && typeof o.id === 'number' && Object.prototype.hasOwnProperty.call(o, 'ok')) {
58
- results[o.id] = o;
59
- if (Object.keys(results).length >= requests.length) {
60
- const arr = requests.map((_, k) => results[k + 1]);
61
- finish(arr.length === 1 ? arr[0] : { ok: true, results: arr });
62
- }
63
- }
64
- }
65
- });
66
- py.stderr.on('data', (d) => { errTail = (errTail + d.toString('utf8')).slice(-800); });
67
- py.on('error', (e) => finish({ ok: false, error: 'python baslatilamadi: ' + e.message }));
68
- py.on('close', (code) => { if (Object.keys(results).length < requests.length) finish({ ok: false, error: 'bridge erken cikti code=' + code + ' ' + errTail }); });
69
- requests.forEach((r, k) => py.stdin.write(JSON.stringify({ id: k + 1, method: r.method, params: r.params || {} }) + '\n'));
70
- py.stdin.end();
71
- });
72
- }
73
-
74
- (async function main() {
75
- let args = {};
76
- try { args = JSON.parse(fs.readFileSync(0, 'utf8') || '{}'); } catch (e) {}
77
- const symbol = String(args.symbol || '').trim().toUpperCase();
78
- const type = String(args.type || '').trim().toLowerCase();
79
- const volume = Number(args.volume || 0);
80
- const price = Number(args.price || 0);
81
- /* 6 TİP: 4 bekleyen (limit/stop) + 2 ANLIK piyasa (buy_market/sell_market) */
82
- const izin = ['buy_limit', 'sell_limit', 'buy_stop', 'sell_stop', 'buy_market', 'sell_market'];
83
- if (!symbol) return console.log(JSON.stringify({ ok: false, error: 'symbol zorunlu' }));
84
- if (!izin.includes(type)) return console.log(JSON.stringify({ ok: false, error: 'type: buy_limit|sell_limit|buy_stop|sell_stop|buy_market|sell_market' }));
85
- if (!(volume > 0)) return console.log(JSON.stringify({ ok: false, error: 'volume (lot) zorunlu ve 0 dan buyuk' }));
86
- const isMarket = type === 'buy_market' || type === 'sell_market';
87
- if (!isMarket && !(price > 0)) return console.log(JSON.stringify({ ok: false, error: 'price limit/stop emri icin zorunlu ve 0 dan buyuk' }));
88
- const method = isMarket ? 'market' : 'pending';
89
- const params = isMarket
90
- ? { symbol: symbol, side: type.startsWith('buy') ? 'buy' : 'sell', volume: volume }
91
- : { symbol: symbol, type: type, volume: volume, price: price };
92
- if (args.sl) params.sl = Number(args.sl);
93
- if (args.tp) params.tp = Number(args.tp);
94
- const r = await call([{ method: method, params: params }]);
95
- if (r.ok && r.data && r.data.result) {
96
- const res = r.data.result;
97
- console.log(JSON.stringify({ ok: true, ticket: res.order, retcode: res.retcode, comment: res.comment, detay: r.data }));
98
- } else {
99
- console.log(JSON.stringify({ ok: false, error: r.error || (isMarket ? 'piyasa emri reddedildi' : 'bekleyen emir reddedildi') }));
100
- }
101
- })();
102
-
103
- /* PATCH 2026-09-10b: electron app-mode cocuk prosesi kapanmiyordu (90sn timeout).
104
- stdout'un boruya bosalmasi icin kisa bekleme, sonra zorla cik. */
105
- setTimeout(() => process.exit(0), 1500);
@@ -1,18 +0,0 @@
1
- {
2
- "name": "mt5_bekleyen",
3
- "description": "MT5 EMİR açar (6 tip): buy_limit, sell_limit, buy_stop, sell_stop (bekleyen; price zorunlu) ve buy_market, sell_market (ANLIK piyasa emri; price gerekmez). symbol, type, volume zorunlu; sl/tp opsiyonel. Başarıda emir ticket'ı döner.",
4
- "parameters": {
5
- "type": "object",
6
- "properties": {
7
- "symbol": { "type": "string", "description": "Broker sembol adi: GOLD veya BITCOIN (XAUUSD degil)" },
8
- "type": { "type": "string", "description": "buy_limit | sell_limit | buy_stop | sell_stop | buy_market | sell_market" },
9
- "volume": { "type": "number", "description": "Lot (0.01-0.1)" },
10
- "price": { "type": "number", "description": "Tetiklenme/limit fiyati (limit/stop icin zorunlu; market tiplerinde yok sayilir)" },
11
- "sl": { "type": "number", "description": "Stop loss (opsiyonel)" },
12
- "tp": { "type": "number", "description": "Take profit (opsiyonel)" }
13
- },
14
- "required": ["symbol", "type", "volume"]
15
- },
16
- "defaultsVersion": 2,
17
- "updatedAt": "2026-09-15T14:00:00.000Z"
18
- }
@@ -1,93 +0,0 @@
1
- 'use strict';
2
- // MT5 DURUM ENVANTERİ — hesap + pozisyonlar + bekleyen emirler (tek köprü oturumunda)
3
- const { spawn } = require('child_process');
4
- const fs = require('fs');
5
- const path = require('path');
6
-
7
- /* TAŞINABİLİR YOL ÇÖZÜMÜ: Beast gömülü python → sistem python'ları → PATH.
8
- Köprü dosyası %APPDATA%\beast\finance\mt5_bridge.py'den (veya BEAST_FINANCE_DIR)
9
- okunur; ortam değişkenleriyle geçersiz kılınabilir. */
10
- function resolvePython() {
11
- const cands = [];
12
- if (process.env.BEAST_PYTHON) cands.push({ exe: String(process.env.BEAST_PYTHON), args: [] });
13
- if (process.env.APPDATA) cands.push({ exe: path.join(process.env.APPDATA, 'beast', 'py', 'python.exe'), args: [] });
14
- for (const v of ['314', '313', '312', '311', '310']) cands.push({ exe: 'C:\\Python' + v + '\\python.exe', args: [] });
15
- cands.push({ exe: 'python', args: [] }, { exe: 'py', args: ['-3'] });
16
- for (const c of cands) {
17
- if (c.exe === 'python' || c.exe === 'py') return c;
18
- try { if (fs.existsSync(c.exe)) return c; } catch (e) {}
19
- }
20
- return { exe: 'python', args: [] };
21
- }
22
- function resolveBridge() {
23
- const cands = [];
24
- if (process.env.BEAST_BRIDGE) cands.push(String(process.env.BEAST_BRIDGE));
25
- if (process.env.BEAST_FINANCE_DIR) cands.push(path.join(String(process.env.BEAST_FINANCE_DIR), 'mt5_bridge.py'));
26
- if (process.env.APPDATA) cands.push(path.join(process.env.APPDATA, 'beast', 'finance', 'mt5_bridge.py'));
27
- for (const p of cands) { try { if (p && fs.existsSync(p)) return p; } catch (e) {} }
28
- return cands[0] || '';
29
- }
30
- const PYSPEC = resolvePython();
31
- const PY = PYSPEC.exe;
32
- const PY_ARGS = PYSPEC.args;
33
- const BRIDGE = resolveBridge();
34
-
35
- const TIMEOUT = 35000;
36
-
37
- function call(requests) {
38
- return new Promise((resolve) => {
39
- let py;
40
- try { py = spawn(PY, [...PY_ARGS, BRIDGE], { windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] }); }
41
- catch (e) { return resolve({ ok: false, error: 'python baslatilamadi: ' + e.message }); }
42
- const results = {};
43
- let buf = '';
44
- let errTail = '';
45
- let settled = false;
46
- const finish = (obj) => { if (!settled) { settled = true; clearTimeout(timer); try { py.kill(); } catch (e) {} resolve(obj); } };
47
- const timer = setTimeout(() => finish({ ok: false, error: 'zaman asimi: MT5 terminali acik ve yanit veriyor mu?' }), TIMEOUT);
48
- py.stdout.on('data', (d) => {
49
- buf += d.toString('utf8');
50
- let i;
51
- while ((i = buf.indexOf('\n')) >= 0) {
52
- const line = buf.slice(0, i).trim(); buf = buf.slice(i + 1);
53
- if (!line) continue;
54
- let o = null;
55
- try { o = JSON.parse(line); } catch (e) { continue; }
56
- if (o && o.event) continue;
57
- if (o && typeof o.id === 'number' && Object.prototype.hasOwnProperty.call(o, 'ok')) {
58
- results[o.id] = o;
59
- if (Object.keys(results).length >= requests.length) {
60
- const arr = requests.map((_, k) => results[k + 1]);
61
- finish(arr.length === 1 ? arr[0] : { ok: true, results: arr });
62
- }
63
- }
64
- }
65
- });
66
- py.stderr.on('data', (d) => { errTail = (errTail + d.toString('utf8')).slice(-800); });
67
- py.on('error', (e) => finish({ ok: false, error: 'python baslatilamadi: ' + e.message }));
68
- py.on('close', (code) => { if (Object.keys(results).length < requests.length) finish({ ok: false, error: 'bridge erken cikti code=' + code + ' ' + errTail }); });
69
- requests.forEach((r, k) => py.stdin.write(JSON.stringify({ id: k + 1, method: r.method, params: r.params || {} }) + '\n'));
70
- py.stdin.end();
71
- });
72
- }
73
-
74
- (async function main() {
75
- const r = await call([
76
- { method: 'account', params: {} },
77
- { method: 'positions', params: {} },
78
- { method: 'orders', params: {} }
79
- ]);
80
- if (!r.ok) return console.log(JSON.stringify({ ok: false, error: r.error || 'durum alinamadi' }));
81
- const out = { ok: true };
82
- if (r.results && r.results[0] && r.results[0].ok) out.account = r.results[0].data.account;
83
- else out.account_hata = (r.results && r.results[0] && r.results[0].error) || '?';
84
- if (r.results && r.results[1] && r.results[1].ok) out.positions = r.results[1].data.positions;
85
- else out.positions_hata = (r.results && r.results[1] && r.results[1].error) || '?';
86
- if (r.results && r.results[2] && r.results[2].ok) out.orders = r.results[2].data.orders;
87
- else out.orders_hata = (r.results && r.results[2] && r.results[2].error) || '?';
88
- console.log(JSON.stringify(out));
89
- })();
90
-
91
- /* PATCH 2026-09-10b: electron app-mode cocuk prosesi kapanmiyordu (90sn timeout).
92
- stdout'un boruya bosalmasi icin kisa bekleme, sonra zorla cik. */
93
- setTimeout(() => process.exit(0), 1500);
@@ -1,10 +0,0 @@
1
- {
2
- "name": "mt5_durum",
3
- "description": "MT5 tur başı envanteri TEK çağrıda: köprü bağlantısı + hesap özeti (bakiye/özkaynak/serbest marj) + açık pozisyonlar + bekleyen emirler. Parametre almaz. Trader ajanları karar öncesi bununla durum okur.",
4
- "parameters": {
5
- "type": "object",
6
- "properties": {},
7
- "required": []
8
- },
9
- "updatedAt": "2026-09-09T18:42:00.000Z"
10
- }
@@ -1,98 +0,0 @@
1
- 'use strict';
2
- // MT5 PİYASA EMİRİ AÇ — stdin: JSON args · stdout: JSON sonuç
3
- const { spawn } = require('child_process');
4
- const fs = require('fs');
5
- const path = require('path');
6
-
7
- /* TAŞINABİLİR YOL ÇÖZÜMÜ: Beast gömülü python → sistem python'ları → PATH.
8
- Köprü dosyası %APPDATA%\beast\finance\mt5_bridge.py'den (veya BEAST_FINANCE_DIR)
9
- okunur; ortam değişkenleriyle geçersiz kılınabilir. */
10
- function resolvePython() {
11
- const cands = [];
12
- if (process.env.BEAST_PYTHON) cands.push({ exe: String(process.env.BEAST_PYTHON), args: [] });
13
- if (process.env.APPDATA) cands.push({ exe: path.join(process.env.APPDATA, 'beast', 'py', 'python.exe'), args: [] });
14
- for (const v of ['314', '313', '312', '311', '310']) cands.push({ exe: 'C:\\Python' + v + '\\python.exe', args: [] });
15
- cands.push({ exe: 'python', args: [] }, { exe: 'py', args: ['-3'] });
16
- for (const c of cands) {
17
- if (c.exe === 'python' || c.exe === 'py') return c;
18
- try { if (fs.existsSync(c.exe)) return c; } catch (e) {}
19
- }
20
- return { exe: 'python', args: [] };
21
- }
22
- function resolveBridge() {
23
- const cands = [];
24
- if (process.env.BEAST_BRIDGE) cands.push(String(process.env.BEAST_BRIDGE));
25
- if (process.env.BEAST_FINANCE_DIR) cands.push(path.join(String(process.env.BEAST_FINANCE_DIR), 'mt5_bridge.py'));
26
- if (process.env.APPDATA) cands.push(path.join(process.env.APPDATA, 'beast', 'finance', 'mt5_bridge.py'));
27
- for (const p of cands) { try { if (p && fs.existsSync(p)) return p; } catch (e) {} }
28
- return cands[0] || '';
29
- }
30
- const PYSPEC = resolvePython();
31
- const PY = PYSPEC.exe;
32
- const PY_ARGS = PYSPEC.args;
33
- const BRIDGE = resolveBridge();
34
-
35
- const TIMEOUT = 35000;
36
-
37
- function call(requests) {
38
- return new Promise((resolve) => {
39
- let py;
40
- try { py = spawn(PY, [...PY_ARGS, BRIDGE], { windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] }); }
41
- catch (e) { return resolve({ ok: false, error: 'python baslatilamadi: ' + e.message }); }
42
- const results = {};
43
- let buf = '';
44
- let errTail = '';
45
- let settled = false;
46
- const finish = (obj) => { if (!settled) { settled = true; clearTimeout(timer); try { py.kill(); } catch (e) {} resolve(obj); } };
47
- const timer = setTimeout(() => finish({ ok: false, error: 'zaman asimi: MT5 terminali acik ve yanit veriyor mu?' }), TIMEOUT);
48
- py.stdout.on('data', (d) => {
49
- buf += d.toString('utf8');
50
- let i;
51
- while ((i = buf.indexOf('\n')) >= 0) {
52
- const line = buf.slice(0, i).trim(); buf = buf.slice(i + 1);
53
- if (!line) continue;
54
- let o = null;
55
- try { o = JSON.parse(line); } catch (e) { continue; }
56
- if (o && o.event) continue; // bridge olay satiri (baglanti raporu)
57
- if (o && typeof o.id === 'number' && Object.prototype.hasOwnProperty.call(o, 'ok')) {
58
- results[o.id] = o;
59
- if (Object.keys(results).length >= requests.length) {
60
- const arr = requests.map((_, k) => results[k + 1]);
61
- finish(arr.length === 1 ? arr[0] : { ok: true, results: arr });
62
- }
63
- }
64
- }
65
- });
66
- py.stderr.on('data', (d) => { errTail = (errTail + d.toString('utf8')).slice(-800); });
67
- py.on('error', (e) => finish({ ok: false, error: 'python baslatilamadi: ' + e.message }));
68
- py.on('close', (code) => { if (Object.keys(results).length < requests.length) finish({ ok: false, error: 'bridge erken cikti code=' + code + ' ' + errTail }); });
69
- requests.forEach((r, k) => py.stdin.write(JSON.stringify({ id: k + 1, method: r.method, params: r.params || {} }) + '\n'));
70
- py.stdin.end();
71
- });
72
- }
73
-
74
- (async function main() {
75
- let args = {};
76
- try { args = JSON.parse(fs.readFileSync(0, 'utf8') || '{}'); } catch (e) {}
77
- const symbol = String(args.symbol || '').trim().toUpperCase();
78
- const side = String(args.side || '').trim().toLowerCase();
79
- const volume = Number(args.volume || 0);
80
- if (!symbol) return console.log(JSON.stringify({ ok: false, error: 'symbol zorunlu (örn XAUUSD)' }));
81
- if (side !== 'buy' && side !== 'sell') return console.log(JSON.stringify({ ok: false, error: 'side: buy | sell' }));
82
- if (!(volume > 0)) return console.log(JSON.stringify({ ok: false, error: 'volume (lot) zorunlu ve 0 dan buyuk olmali' }));
83
- const params = { symbol: symbol, side: side, volume: volume };
84
- if (args.sl) params.sl = Number(args.sl);
85
- if (args.tp) params.tp = Number(args.tp);
86
- if (args.comment) params.comment = String(args.comment);
87
- const r = await call([{ method: 'market', params: params }]);
88
- if (r.ok && r.data && r.data.result) {
89
- const res = r.data.result;
90
- console.log(JSON.stringify({ ok: true, ticket: res.order, retcode: res.retcode, comment: res.comment, fiyat: r.data.price, detay: r.data }));
91
- } else {
92
- console.log(JSON.stringify({ ok: false, error: (r.error || 'emir reddedildi') }));
93
- }
94
- })();
95
-
96
- /* PATCH 2026-09-10b: electron app-mode cocuk prosesi kapanmiyordu (90sn timeout).
97
- stdout'un boruya bosalmasi icin kisa bekleme, sonra zorla cik. */
98
- setTimeout(() => process.exit(0), 1500);
@@ -1,17 +0,0 @@
1
- {
2
- "name": "mt5_emir",
3
- "description": "MT5 köprüsüyle PİYASA EMİRİ açar (işlem açma). symbol (broker adı: GOLD veya BITCOIN — XAUUSD/BTCUSD DEĞİL), side (buy|sell), volume (lot) zorunlu; sl/tp/comment opsiyonel. Başarıda ticket/retcode döner. NOT: Bu tool tüm oturumlarda çalışır — Trader ajanları da işlem açmak için bunu kullanır.",
4
- "parameters": {
5
- "type": "object",
6
- "properties": {
7
- "symbol": { "type": "string", "description": "Broker sembol adi: GOLD veya BITCOIN (XAUUSD degil)" },
8
- "side": { "type": "string", "description": "buy | sell" },
9
- "volume": { "type": "number", "description": "Lot büyüklüğü (0.01-0.1)" },
10
- "sl": { "type": "number", "description": "Stop loss fiyatı (opsiyonel)" },
11
- "tp": { "type": "number", "description": "Take profit fiyatı (opsiyonel)" },
12
- "comment": { "type": "string", "description": "Kısa işlem notu (opsiyonel)" }
13
- },
14
- "required": ["symbol", "side", "volume"]
15
- },
16
- "updatedAt": "2026-09-09T18:40:00.000Z"
17
- }
@@ -1,90 +0,0 @@
1
- 'use strict';
2
- // MT5 BEKLEYEN EMIR IPTAL — stdin: JSON args · stdout: JSON sonuç
3
- const { spawn } = require('child_process');
4
- const fs = require('fs');
5
- const path = require('path');
6
-
7
- /* TAŞINABİLİR YOL ÇÖZÜMÜ: Beast gömülü python → sistem python'ları → PATH.
8
- Köprü dosyası %APPDATA%\beast\finance\mt5_bridge.py'den (veya BEAST_FINANCE_DIR)
9
- okunur; ortam değişkenleriyle geçersiz kılınabilir. */
10
- function resolvePython() {
11
- const cands = [];
12
- if (process.env.BEAST_PYTHON) cands.push({ exe: String(process.env.BEAST_PYTHON), args: [] });
13
- if (process.env.APPDATA) cands.push({ exe: path.join(process.env.APPDATA, 'beast', 'py', 'python.exe'), args: [] });
14
- for (const v of ['314', '313', '312', '311', '310']) cands.push({ exe: 'C:\\Python' + v + '\\python.exe', args: [] });
15
- cands.push({ exe: 'python', args: [] }, { exe: 'py', args: ['-3'] });
16
- for (const c of cands) {
17
- if (c.exe === 'python' || c.exe === 'py') return c;
18
- try { if (fs.existsSync(c.exe)) return c; } catch (e) {}
19
- }
20
- return { exe: 'python', args: [] };
21
- }
22
- function resolveBridge() {
23
- const cands = [];
24
- if (process.env.BEAST_BRIDGE) cands.push(String(process.env.BEAST_BRIDGE));
25
- if (process.env.BEAST_FINANCE_DIR) cands.push(path.join(String(process.env.BEAST_FINANCE_DIR), 'mt5_bridge.py'));
26
- if (process.env.APPDATA) cands.push(path.join(process.env.APPDATA, 'beast', 'finance', 'mt5_bridge.py'));
27
- for (const p of cands) { try { if (p && fs.existsSync(p)) return p; } catch (e) {} }
28
- return cands[0] || '';
29
- }
30
- const PYSPEC = resolvePython();
31
- const PY = PYSPEC.exe;
32
- const PY_ARGS = PYSPEC.args;
33
- const BRIDGE = resolveBridge();
34
-
35
- const TIMEOUT = 35000;
36
-
37
- function call(requests) {
38
- return new Promise((resolve) => {
39
- let py;
40
- try { py = spawn(PY, [...PY_ARGS, BRIDGE], { windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] }); }
41
- catch (e) { return resolve({ ok: false, error: 'python baslatilamadi: ' + e.message }); }
42
- const results = {};
43
- let buf = '';
44
- let errTail = '';
45
- let settled = false;
46
- const finish = (obj) => { if (!settled) { settled = true; clearTimeout(timer); try { py.kill(); } catch (e) {} resolve(obj); } };
47
- const timer = setTimeout(() => finish({ ok: false, error: 'zaman asimi: MT5 terminali acik ve yanit veriyor mu?' }), TIMEOUT);
48
- py.stdout.on('data', (d) => {
49
- buf += d.toString('utf8');
50
- let i;
51
- while ((i = buf.indexOf('\n')) >= 0) {
52
- const line = buf.slice(0, i).trim(); buf = buf.slice(i + 1);
53
- if (!line) continue;
54
- let o = null;
55
- try { o = JSON.parse(line); } catch (e) { continue; }
56
- if (o && o.event) continue;
57
- if (o && typeof o.id === 'number' && Object.prototype.hasOwnProperty.call(o, 'ok')) {
58
- results[o.id] = o;
59
- if (Object.keys(results).length >= requests.length) {
60
- const arr = requests.map((_, k) => results[k + 1]);
61
- finish(arr.length === 1 ? arr[0] : { ok: true, results: arr });
62
- }
63
- }
64
- }
65
- });
66
- py.stderr.on('data', (d) => { errTail = (errTail + d.toString('utf8')).slice(-800); });
67
- py.on('error', (e) => finish({ ok: false, error: 'python baslatilamadi: ' + e.message }));
68
- py.on('close', (code) => { if (Object.keys(results).length < requests.length) finish({ ok: false, error: 'bridge erken cikti code=' + code + ' ' + errTail }); });
69
- requests.forEach((r, k) => py.stdin.write(JSON.stringify({ id: k + 1, method: r.method, params: r.params || {} }) + '\n'));
70
- py.stdin.end();
71
- });
72
- }
73
-
74
- (async function main() {
75
- let args = {};
76
- try { args = JSON.parse(fs.readFileSync(0, 'utf8') || '{}'); } catch (e) {}
77
- const ticket = Number(args.ticket || 0);
78
- if (!ticket) return console.log(JSON.stringify({ ok: false, error: 'ticket zorunlu' }));
79
- const r = await call([{ method: 'cancel', params: { ticket: ticket } }]);
80
- if (r.ok && r.data && r.data.result) {
81
- const res = r.data.result;
82
- console.log(JSON.stringify({ ok: true, retcode: res.retcode, comment: res.comment, detay: r.data }));
83
- } else {
84
- console.log(JSON.stringify({ ok: false, error: r.error || 'iptal reddedildi' }));
85
- }
86
- })();
87
-
88
- /* PATCH 2026-09-10b: electron app-mode cocuk prosesi kapanmiyordu (90sn timeout).
89
- stdout'un boruya bosalmasi icin kisa bekleme, sonra zorla cik. */
90
- setTimeout(() => process.exit(0), 1500);
@@ -1,12 +0,0 @@
1
- {
2
- "name": "mt5_emir_iptal",
3
- "description": "Bekleyen emri İPTAL eder: ticket zorunlu (mt5_bekleyen veya durum/emir listesinden gelen ticket no).",
4
- "parameters": {
5
- "type": "object",
6
- "properties": {
7
- "ticket": { "type": "number", "description": "Iptal edilecek bekleyen emrin ticket numarasi" }
8
- },
9
- "required": ["ticket"]
10
- },
11
- "updatedAt": "2026-09-09T18:50:00.000Z"
12
- }