let binanceUSDTList = new Set();
let allData = [];
let selectedSymbol = null;
let isHold = false;
let selectedTimeframe = "5m";
let currentFilter = null;
const Wp = [0.5, 1, 1.5];
const Wr = [0.5, 1, 1.5];
// Profit Score Calculations
function calculateProfitScore(changePercent, volume, lastPrice) {
const pricePenalty = lastPrice > 1000 ? 0.8 : 1;
return ((changePercent * 3) + (Math.log10(volume) * 2)) * pricePenalty;
}
function calculateAXTargets(lastPrice, atr) {
const S = 1.2, M = 1.5, N = 0.8;
const multipliers = [0.5, 1, 2, 3, 4];
let targets = [];
for (let i = 0; i < multipliers.length; i++) {
targets[i] = lastPrice + (atr * S * M * N * multipliers[i]);
}
return targets;
}
// --- Fetch Data, Normalize, Risk/Reward Helpers (unchanged) ---
// (fetchBinanceUSDTList, fetchBinanceData, etc…)
// --- King 1000 Cr $ Filter Logic ---
// Formula: kingScore = profitScore^1.3 * (1 + momentumVal/100) * (1 + marketSentimentScore/100) * (1 + volatilityFactor/200)
// Only coins with no stop loss triggered
function filterKing1000Cr() {
currentFilter = "filterKing1000Cr";
allData.forEach(d => {
if (!d.stopLossTriggered) {
d.kingScore = Math.pow(d.profitScore, 1.3) *
(1 + d.momentumVal / 100) *
(1 + d.marketSentimentScore / 100) *
(1 + d.volatilityFactor / 200);
} else {
d.kingScore = 0;
}
});
const filtered = allData.filter(d => d.kingScore > 0);
filtered.sort((a, b) => b.kingScore - a.kingScore);
renderTable(filtered.slice(0, 10), "King 1000 Cr $");
}
// --- Render Table: Includes King Score column in ---
function renderTable(data, filterName = "") {
const tbody = document.getElementById("table-body");
tbody.innerHTML = "";
if (!data || data.length === 0) {
tbody.innerHTML = ` No Data `;
return;
}
data.forEach((d, i) => {
const row = document.createElement("tr");
if (filterName === "King 1000 Cr $") {
if (i === 0) row.classList.add("top-king-highlight");
else if (i < 5) row.classList.add("highlight");
}
row.onclick = () => selectRow(d.symbol);
row.innerHTML = `
${i + 1}
${d.symbol}
${d.lastPrice.toFixed(6)}
${d.momentum.toFixed(2)}
${d.signalConfidence.toFixed(2)}
${d.profitScore.toFixed(2)}
${d.kingScore !== undefined ? d.kingScore.toFixed(2) : '-'}
`;
tbody.appendChild(row);
});
}
function selectRow(symbol) {
selectedSymbol = symbol;
}
function applyFilter(name) {
currentFilter = name;
if(typeof window[name] === "function") {
window[name]();
} else {
renderTable(allData);
}
}
async function initialize() {
await fetchBinanceUSDTList();
await fetchBinanceData();
setInterval(() => {
if(!isHold) fetchBinanceData();
}, 60000);
}
initialize();
# app.py from flask import Flask, jsonify import numpy as np import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import LSTM, Dense import requests app = Flask(__name__) # Binance se last 60 minute price data fetch karna def fetch_binance_data(): url = "https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=1m&limit=60" data = requests.get(url).json() closes = [float(item[4]) for item in data] return closes # LSTM input prepare karna sliding window ke form me def prepare_data(series, n_steps): X, y = [], [] for i in range(len(series) - n_steps): X.append(series[i:i+n_steps]) y.append(series[i+n_steps]) return np.array(X), np.array(y) # LSTM model train karna def train_model(series): n_steps = 10 X, y = prepare_data(series, n_steps) X = X.reshape((X.shape[0], X.shape[1], 1)) model = Sequential([ LSTM(50, activation='relu', input_shape=...
Comments
Post a Comment