Skip to content

Commit 6b51a89

Browse files
first commit
0 parents  commit 6b51a89

File tree

8 files changed

+6343
-0
lines changed

8 files changed

+6343
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
research/
2+
secret.py
3+
*.csv
4+
bot_state.json
5+
symbols.yaml
6+
trades_detailed.csv
7+
__pycache__

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# High Risk Auto Trade
2+
3+
| File Name | Description |
4+
|----------------------------|----------------------------------------------|
5+
| high_risk_autotrade.py | Main bot (do NOT import/run in Streamlit!) |
6+
| streamlit_dashboard.py | Dashboard ONLY |
7+
| secret.py | API Keys |
8+
| bot_state.json | Shared state file |
9+
| usdc_symbol_updater.py | Fetches USDC crypto state |
10+
| symbols.yaml | USDC cryptos state |
11+
12+
<br />
13+
Requirements:
14+
pip install python-telegram-bot==22.2 (Previous 13.5)
15+
sudo apt install ntpdate
16+
sudo ntpdate pool.ntp.org
17+
<br />
18+
19+
### How does it work
20+
- Generate symbols.yaml
21+
- Run the bot
22+
- Keep usdc_symbol_updater on
23+
<br />
24+
25+
## Momentum Detection
26+
The function has_recent_momentum() requires positive price changes on 1m, 5m, and 15m candles (default: +0.3%, +0.6%, +1.0%).
27+
<br />
28+
29+
## Entry
30+
The bot will consider buying only if all these timeframes show strong upward movement. This is like what’s shown on the chart—buying during the clear uptrend.
31+
<br />
32+
33+
## Auto-Sell
34+
The bot uses both trailing stop logic and a maximum hold time, so if the price reverses sharply (like those red candles after the top in the image), the bot should try to exit quickly.
35+
<br />
36+
37+
![Example](https://i.imgur.com/7oMaPLM.jpeg)
38+
39+
40+
### Summary
41+
42+
If the trend is very short (just 2-3 candles), the bot might enter late or get faked out.
43+
<br />
44+
If a strong reversal happens quickly (as in the sharp red drop), the trailing stop might trigger and exit, but very fast drops can result in some slippage.

streamlit_dashboard.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# streamlit_dashboard.py
2+
import json
3+
import streamlit as st
4+
import time
5+
6+
st.set_page_config(page_title="Crypto Bot Dashboard", layout="wide")
7+
8+
st.title("Crypto Bot Dashboard")
9+
10+
def load_state():
11+
try:
12+
with open("bot_state.json", "r") as f:
13+
return json.load(f)
14+
except Exception:
15+
return {"balance": 0, "positions": {}}
16+
17+
state = load_state()
18+
last_update = time.strftime("%Y-%m-%d %H:%M:%S")
19+
20+
st.subheader(f"USDC Balance: ${state.get('balance', 0):,.2f}")
21+
positions = state.get("positions", {})
22+
if positions:
23+
st.subheader("Open Positions")
24+
data = []
25+
for sym, pos in positions.items():
26+
data.append({
27+
"Symbol": sym,
28+
"Qty": pos.get("qty", 0),
29+
"Entry": pos.get("entry", 0),
30+
"Timestamp": pos.get("timestamp", 0),
31+
})
32+
st.table(data)
33+
else:
34+
st.write("No open positions.")
35+
st.caption(f"Last updated: {last_update}")

0 commit comments

Comments
 (0)