trading-matrix-dashboard 1.0.0__tar.gz
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.
- trading_matrix_dashboard-1.0.0/LICENSE +22 -0
- trading_matrix_dashboard-1.0.0/PKG-INFO +22 -0
- trading_matrix_dashboard-1.0.0/README.md +3 -0
- trading_matrix_dashboard-1.0.0/pyproject.toml +29 -0
- trading_matrix_dashboard-1.0.0/setup.cfg +4 -0
- trading_matrix_dashboard-1.0.0/trading_matrix/__init__.py +0 -0
- trading_matrix_dashboard-1.0.0/trading_matrix/main.py +191 -0
- trading_matrix_dashboard-1.0.0/trading_matrix_dashboard.egg-info/PKG-INFO +22 -0
- trading_matrix_dashboard-1.0.0/trading_matrix_dashboard.egg-info/SOURCES.txt +11 -0
- trading_matrix_dashboard-1.0.0/trading_matrix_dashboard.egg-info/dependency_links.txt +1 -0
- trading_matrix_dashboard-1.0.0/trading_matrix_dashboard.egg-info/entry_points.txt +2 -0
- trading_matrix_dashboard-1.0.0/trading_matrix_dashboard.egg-info/requires.txt +6 -0
- trading_matrix_dashboard-1.0.0/trading_matrix_dashboard.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Your Name
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: trading-matrix-dashboard
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: An algorithmic crypto & commodities auto-execution Streamlit dashboard.
|
|
5
|
+
Author-email: Your Name <your.email@example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: streamlit>=1.35.0
|
|
13
|
+
Requires-Dist: ccxt>=4.2.0
|
|
14
|
+
Requires-Dist: pandas>=2.0.0
|
|
15
|
+
Requires-Dist: numpy>=1.24.0
|
|
16
|
+
Requires-Dist: plotly>=5.15.0
|
|
17
|
+
Requires-Dist: requests>=2.31.0
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# Trading Matrix Dashboard
|
|
21
|
+
Run `trading-matrix` in your terminal after installation to launch the algorithmic execution board!
|
|
22
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "trading-matrix-dashboard" # Change this if the name is taken on PyPI
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "An algorithmic crypto & commodities auto-execution Streamlit dashboard."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name = "Your Name", email = "your.email@example.com" }]
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
]
|
|
17
|
+
dependencies = [
|
|
18
|
+
"streamlit>=1.35.0",
|
|
19
|
+
"ccxt>=4.2.0",
|
|
20
|
+
"pandas>=2.0.0",
|
|
21
|
+
"numpy>=1.24.0",
|
|
22
|
+
"plotly>=5.15.0",
|
|
23
|
+
"requests>=2.31.0"
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
# This creates a global terminal command line shortcut for your users!
|
|
28
|
+
trading-matrix = "trading_matrix.main:run_app"
|
|
29
|
+
|
|
File without changes
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import streamlit as st
|
|
2
|
+
import ccxt
|
|
3
|
+
import pandas as pd
|
|
4
|
+
import numpy as np
|
|
5
|
+
import plotly.graph_objects as go
|
|
6
|
+
import time
|
|
7
|
+
import requests
|
|
8
|
+
|
|
9
|
+
# 1. Global Page Settings & Persistent Configurations
|
|
10
|
+
st.set_page_config(page_title="Automated Execution Matrix", layout="wide", page_icon="🤖")
|
|
11
|
+
|
|
12
|
+
# Initialize persistent configuration variables across re-runs
|
|
13
|
+
if "tg_token" not in st.session_state: st.session_state["tg_token"] = ""
|
|
14
|
+
if "tg_chat_id" not in st.session_state: st.session_state["tg_chat_id"] = ""
|
|
15
|
+
if "broker_api" not in st.session_state: st.session_state["broker_api"] = ""
|
|
16
|
+
if "broker_secret" not in st.session_state: st.session_state["broker_secret"] = ""
|
|
17
|
+
if "broker_connected" not in st.session_state: st.session_state["broker_connected"] = False
|
|
18
|
+
if "last_executed_signal" not in st.session_state: st.session_state["last_executed_signal"] = {}
|
|
19
|
+
|
|
20
|
+
REFRESH_INTERVAL = 30
|
|
21
|
+
|
|
22
|
+
# Helper: Telegram Dispatch API Request Wrapper
|
|
23
|
+
def send_telegram_alert(message):
|
|
24
|
+
token = st.session_state["tg_token"]
|
|
25
|
+
chat_id = st.session_state["tg_chat_id"]
|
|
26
|
+
if token and chat_id:
|
|
27
|
+
url = f"https://telegram.org{token}/sendMessage"
|
|
28
|
+
try:
|
|
29
|
+
requests.post(url, json={"chat_id": chat_id, "text": message, "parse_mode": "Markdown"}, timeout=5)
|
|
30
|
+
except Exception:
|
|
31
|
+
pass
|
|
32
|
+
|
|
33
|
+
# 2. Main Title Layout Header
|
|
34
|
+
st.title("🤖 Algorithmic Auto-Execution Dashboard")
|
|
35
|
+
tab_dashboard, tab_telegram, tab_broker = st.tabs(["📊 Live Market Matrix", "💬 Telegram Alerts Config", "💼 Broker API & Auto-Trade"])
|
|
36
|
+
|
|
37
|
+
# --- SIDEBAR INTERFACE ---
|
|
38
|
+
st.sidebar.title("🎮 Controls Console")
|
|
39
|
+
current_page = st.sidebar.radio("Select Target Index/Asset", ["Bitcoin (BTC)", "Ethereum (ETH)", "Gold Spot", "Silver Spot", "Crude Oil"])
|
|
40
|
+
timeframe = st.sidebar.selectbox("Candle Timeframe Interval", ["5m", "15m", "1h", "1d"], index=2)
|
|
41
|
+
angle_degrees = st.sidebar.slider("Trendline Vector Angle (°)", min_value=5.0, max_value=60.0, value=30.0, step=2.5)
|
|
42
|
+
|
|
43
|
+
st.sidebar.markdown("---")
|
|
44
|
+
st.sidebar.title("⚙️ Strategy Adjustments")
|
|
45
|
+
require_delta_check = st.sidebar.toggle("Require 10c Delta Confirmation", value=True)
|
|
46
|
+
|
|
47
|
+
# Ticker resolution map for Live execution
|
|
48
|
+
symbol_map = {"Bitcoin (BTC)": "BTC/USDT", "Ethereum (ETH)": "ETH/USDT"}
|
|
49
|
+
|
|
50
|
+
# 3. Resilient Data Aggregation Layer
|
|
51
|
+
@st.cache_data(ttl=15)
|
|
52
|
+
def fetch_unified_market_data(asset_name, interval):
|
|
53
|
+
real_world_spots = {"Gold Spot": 4166.40, "Silver Spot": 57.85, "Crude Oil": 108.50}
|
|
54
|
+
if asset_name in ["Bitcoin (BTC)", "Ethereum (ETH)"]:
|
|
55
|
+
exchange = ccxt.binance({'enableRateLimit': True})
|
|
56
|
+
ohlcv = exchange.fetch_ohlcv(symbol_map[asset_name], timeframe=interval, limit=200)
|
|
57
|
+
df = pd.DataFrame(ohlcv, columns=['Timestamp', 'Open', 'High', 'Low', 'Close', 'Volume'])
|
|
58
|
+
df['Datetime'] = pd.to_datetime(df['Timestamp'], unit='ms')
|
|
59
|
+
return df
|
|
60
|
+
else:
|
|
61
|
+
# Commodity high-fidelity simulation engine
|
|
62
|
+
base_price = real_world_spots[asset_name]
|
|
63
|
+
np.random.seed(42)
|
|
64
|
+
dates = pd.date_range(end=pd.Timestamp.now(), periods=200, freq='h' if interval=='1h' else 'd')
|
|
65
|
+
closes = base_price + np.cumsum(np.random.normal(0, base_price * 0.005, 200))
|
|
66
|
+
opens = closes + np.random.normal(0, base_price * 0.002, 200)
|
|
67
|
+
highs = np.maximum(opens, closes) + np.abs(np.random.normal(0, base_price * 0.003, 200))
|
|
68
|
+
lows = np.minimum(opens, closes) - np.abs(np.abs(np.random.normal(0, base_price * 0.003, 200)))
|
|
69
|
+
volumes = np.random.uniform(5000, 50000, 200)
|
|
70
|
+
return pd.DataFrame({'Datetime': dates, 'Open': opens, 'High': highs, 'Low': lows, 'Close': closes, 'Volume': volumes})
|
|
71
|
+
|
|
72
|
+
# Run Global Mathematical Operations
|
|
73
|
+
df = fetch_unified_market_data(current_page, timeframe)
|
|
74
|
+
|
|
75
|
+
if df is not None:
|
|
76
|
+
historical_df = df.iloc[:-1]
|
|
77
|
+
support_level = historical_df['Low'].min()
|
|
78
|
+
resistance_level = historical_df['High'].max()
|
|
79
|
+
|
|
80
|
+
# 20 and 50 EMA Calculations
|
|
81
|
+
df['EMA_20'] = df['Close'].ewm(span=20, adjust=False).mean()
|
|
82
|
+
df['EMA_50'] = df['Close'].ewm(span=50, adjust=False).mean()
|
|
83
|
+
|
|
84
|
+
# 30-Degree Trendline Calculation Model
|
|
85
|
+
lowest_idx = df['Low'].idxmin()
|
|
86
|
+
start_y = df.iloc[lowest_idx]['Low']
|
|
87
|
+
scale_factor = start_y * 0.0008
|
|
88
|
+
slope = np.tan(np.radians(angle_degrees)) * scale_factor
|
|
89
|
+
|
|
90
|
+
trendline = [None if x < lowest_idx else start_y + (slope * (x - lowest_idx)) for x in range(len(df))]
|
|
91
|
+
df['Trendline'] = trendline
|
|
92
|
+
|
|
93
|
+
# --- ANALYSIS ENGINE FOR LAST 10 CANDLES ---
|
|
94
|
+
last_10 = df.iloc[-10:]
|
|
95
|
+
avg_volume_200 = df['Volume'].mean()
|
|
96
|
+
current_volume = df['Volume'].iloc[-1]
|
|
97
|
+
|
|
98
|
+
current_close = df['Close'].iloc[-1]
|
|
99
|
+
current_open = df['Open'].iloc[-1]
|
|
100
|
+
current_low = df['Low'].iloc[-1]
|
|
101
|
+
current_high = df['High'].iloc[-1]
|
|
102
|
+
|
|
103
|
+
prev_close = df['Close'].iloc[-2]
|
|
104
|
+
prev_trend_val = df['Trendline'].iloc[-2] if df['Trendline'].iloc[-2] is not None else start_y
|
|
105
|
+
trend_now = df['Trendline'].iloc[-1] if df['Trendline'].iloc[-1] is not None else start_y
|
|
106
|
+
|
|
107
|
+
vol_threshold = avg_volume_200 * 0.30
|
|
108
|
+
is_vol_low = current_volume < vol_threshold
|
|
109
|
+
|
|
110
|
+
delta_momentum = (last_10['Close'] - last_10['Open']).sum()
|
|
111
|
+
delta_status = "🟩 POSITIVE DELTA" if delta_momentum >= 0 else "🟥 NEGATIVE DELTA"
|
|
112
|
+
|
|
113
|
+
delta_buy_valid = (not require_delta_check) or (delta_momentum > 0)
|
|
114
|
+
delta_sell_valid = (not require_delta_check) or (delta_momentum < 0)
|
|
115
|
+
|
|
116
|
+
# --- STRATEGY SIGNAL LOGIC ---
|
|
117
|
+
support_bounce = (current_low <= support_level * 1.002) and (current_close > current_open)
|
|
118
|
+
trendline_breakout = (prev_close <= prev_trend_val) and (current_close > trend_now)
|
|
119
|
+
resistance_rejection = (current_high >= resistance_level * 0.998) and (current_close < current_open)
|
|
120
|
+
|
|
121
|
+
strategy_buy_signal = (support_bounce or trendline_breakout) and delta_buy_valid
|
|
122
|
+
strategy_sell_signal = (resistance_rejection or (current_close < trend_now)) and delta_sell_valid
|
|
123
|
+
|
|
124
|
+
# ==========================================
|
|
125
|
+
# TAB 1: LIVE MARKET PROFILE DASHBOARD
|
|
126
|
+
# ==========================================
|
|
127
|
+
with tab_dashboard:
|
|
128
|
+
st.subheader(f"📊 Telemetry Board: {current_page} ({timeframe})")
|
|
129
|
+
|
|
130
|
+
kpi1, kpi2, kpi3, kpi4 = st.columns(4)
|
|
131
|
+
kpi1.metric("Current Spot Price", f"${current_close:,.2f}")
|
|
132
|
+
kpi2.metric("Last 10c Delta Power", f"{delta_momentum:+,.2f}", delta=delta_status)
|
|
133
|
+
kpi3.metric("Static Support Room", f"${support_level:,.2f}")
|
|
134
|
+
kpi4.metric("Static Resistance Room", f"${resistance_level:,.2f}")
|
|
135
|
+
|
|
136
|
+
alert_col1, alert_col2 = st.columns(2)
|
|
137
|
+
with alert_col1:
|
|
138
|
+
if is_vol_low:
|
|
139
|
+
st.error(f"⚠️ **VOLUME ANOMALY:** Volume Drop Identified! Current: {current_volume:,.0f}")
|
|
140
|
+
send_telegram_alert(f"🚨 *Volume Crash* on {current_page}!")
|
|
141
|
+
else:
|
|
142
|
+
st.success("🟢 Volume metrics holding inside standard deviations.")
|
|
143
|
+
|
|
144
|
+
with alert_col2:
|
|
145
|
+
if trendline_breakout and delta_buy_valid: st.success("🚀 **STRATEGY SIGNAL:** 30° Trendline Breakout!")
|
|
146
|
+
elif support_bounce and delta_buy_valid: st.success("🛡️ **STRATEGY SIGNAL:** Support Zone Bounce!")
|
|
147
|
+
elif resistance_rejection and delta_sell_valid: st.error("📉 **STRATEGY SIGNAL:** Resistance Ceiling Rejection!")
|
|
148
|
+
elif current_close < trend_now: st.error("⚠️ **TRENDLINE SLIPPAGE:** Market below trendline support.")
|
|
149
|
+
else: st.info("✅ Structural lines holding safely.")
|
|
150
|
+
|
|
151
|
+
fig = go.Figure()
|
|
152
|
+
fig.add_trace(go.Candlestick(x=df['Datetime'], open=df['Open'], high=df['High'], low=df['Low'], close=df['Close'], name='Price'))
|
|
153
|
+
fig.add_trace(go.Scatter(x=df['Datetime'], y=[support_level]*len(df), mode='lines', name='Support', line=dict(color='cyan', width=1.5, dash='dot')))
|
|
154
|
+
fig.add_trace(go.Scatter(x=df['Datetime'], y=[resistance_level]*len(df), mode='lines', name='Resistance', line=dict(color='magenta', width=1.5, dash='dot')))
|
|
155
|
+
fig.add_trace(go.Scatter(x=df['Datetime'], y=df['Trendline'], mode='lines', name='30° Trendline', line=dict(color='yellow', width=2.5, dash='dash')))
|
|
156
|
+
fig.add_trace(go.Scatter(x=df['Datetime'], y=df['EMA_20'], mode='lines', name='20 EMA', line=dict(color='orange', width=1.5)))
|
|
157
|
+
fig.add_trace(go.Scatter(x=df['Datetime'], y=df['EMA_50'], mode='lines', name='50 EMA', line=dict(color='deepskyblue', width=1.5)))
|
|
158
|
+
|
|
159
|
+
fig.update_layout(xaxis_rangeslider_visible=False, template='plotly_dark', height=500, margin=dict(l=10, r=10, t=10, b=10))
|
|
160
|
+
st.plotly_chart(fig, use_container_width=True)
|
|
161
|
+
|
|
162
|
+
# ==========================================
|
|
163
|
+
# TAB 2: TELEGRAM ALERTS CONTROL HUB
|
|
164
|
+
# ==========================================
|
|
165
|
+
with tab_telegram:
|
|
166
|
+
st.subheader("💬 Telegram Bot API Bridge Settings")
|
|
167
|
+
st.session_state["tg_token"] = st.text_input("Bot Token ID API String", value=st.session_state["tg_token"], type="password")
|
|
168
|
+
st.session_state["tg_chat_id"] = st.text_input("Target Group / Chat Destination ID Channel", value=st.session_state["tg_chat_id"])
|
|
169
|
+
if st.button("⚡ Dispatch Test System Sync Message"):
|
|
170
|
+
send_telegram_alert(f"🔔 *System Sync Confirmed*")
|
|
171
|
+
st.success("Test broadcast payload routed successfully.")
|
|
172
|
+
|
|
173
|
+
# ==========================================
|
|
174
|
+
# TAB 3: AUTOMATED BROKER TRADING STRATEGY
|
|
175
|
+
# ==========================================
|
|
176
|
+
with tab_broker:
|
|
177
|
+
st.subheader("💼 Execution Broker Router & Strategy Automation Engine")
|
|
178
|
+
|
|
179
|
+
if not st.session_state["broker_connected"]:
|
|
180
|
+
b_col1, b_col2 = st.columns(2)
|
|
181
|
+
with b_col1:
|
|
182
|
+
exchange_id = st.selectbox("Select Broker Engine Interface", [
|
|
183
|
+
"Delta Exchange India [REST Platform]",
|
|
184
|
+
"CoinDCX Exchange [Native API Core]",
|
|
185
|
+
"Shark Exchange [Prop MT5 Proxy]",
|
|
186
|
+
"binance", "bybit"
|
|
187
|
+
])
|
|
188
|
+
st.session_state["broker_api"] = st.text_input("Account API Public Key", value=st.session_state["broker_api"])
|
|
189
|
+
|
|
190
|
+
# Dynamic Key Input Labeling Adjustments for Delta Exchange
|
|
191
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: trading-matrix-dashboard
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: An algorithmic crypto & commodities auto-execution Streamlit dashboard.
|
|
5
|
+
Author-email: Your Name <your.email@example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: streamlit>=1.35.0
|
|
13
|
+
Requires-Dist: ccxt>=4.2.0
|
|
14
|
+
Requires-Dist: pandas>=2.0.0
|
|
15
|
+
Requires-Dist: numpy>=1.24.0
|
|
16
|
+
Requires-Dist: plotly>=5.15.0
|
|
17
|
+
Requires-Dist: requests>=2.31.0
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# Trading Matrix Dashboard
|
|
21
|
+
Run `trading-matrix` in your terminal after installation to launch the algorithmic execution board!
|
|
22
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
trading_matrix/__init__.py
|
|
5
|
+
trading_matrix/main.py
|
|
6
|
+
trading_matrix_dashboard.egg-info/PKG-INFO
|
|
7
|
+
trading_matrix_dashboard.egg-info/SOURCES.txt
|
|
8
|
+
trading_matrix_dashboard.egg-info/dependency_links.txt
|
|
9
|
+
trading_matrix_dashboard.egg-info/entry_points.txt
|
|
10
|
+
trading_matrix_dashboard.egg-info/requires.txt
|
|
11
|
+
trading_matrix_dashboard.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
trading_matrix
|