Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +28 -6
src/streamlit_app.py
CHANGED
|
@@ -5,6 +5,7 @@ import pandas as pd
|
|
| 5 |
import numpy as np
|
| 6 |
from io import BytesIO
|
| 7 |
import uuid
|
|
|
|
| 8 |
|
| 9 |
from huggingface_hub import snapshot_download
|
| 10 |
|
|
@@ -65,6 +66,7 @@ def main():
|
|
| 65 |
index=0
|
| 66 |
)
|
| 67 |
|
|
|
|
| 68 |
with col2:
|
| 69 |
global brokerages
|
| 70 |
brokerages = st.number_input(label="Brokerages",step=0.01,value=0.2644 ,format="%.4f")
|
|
@@ -91,16 +93,36 @@ def main():
|
|
| 91 |
|
| 92 |
with col3:
|
| 93 |
# File uploader
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
if selected_script == "Old":
|
| 97 |
-
from main4 import get_buy_signal, parse_date, get_sell_signal, year_wise_analysis, calculate_yearly_returns, calculate_mtf_returns, crypto_year_wise_analysis, crypto_calculate_mtf_returns, crypto_calculate_yearly_returns, find_sequences, generate_trade_signals
|
| 98 |
else:
|
| 99 |
-
from main6 import get_buy_signal, parse_date, get_sell_signal, year_wise_analysis, calculate_yearly_returns, calculate_mtf_returns, crypto_year_wise_analysis, crypto_calculate_mtf_returns, crypto_calculate_yearly_returns, find_sequences, generate_trade_signals
|
| 100 |
|
|
|
|
|
|
|
| 101 |
# st.divider()
|
| 102 |
-
if
|
| 103 |
-
df =
|
| 104 |
try:
|
| 105 |
df = df[['Date','Open','High', 'Low', 'Close']]
|
| 106 |
except:
|
|
@@ -544,7 +566,7 @@ def main():
|
|
| 544 |
buy_trades_mtf_yearly_compound.to_excel(writer, sheet_name='BUY MTF CMP Yearly', index=False)
|
| 545 |
|
| 546 |
|
| 547 |
-
file_name_ = f"{
|
| 548 |
|
| 549 |
excel_buffer.seek(0)
|
| 550 |
st.download_button(
|
|
|
|
| 5 |
import numpy as np
|
| 6 |
from io import BytesIO
|
| 7 |
import uuid
|
| 8 |
+
from tvDatafeed import TvDatafeed, Interval
|
| 9 |
|
| 10 |
from huggingface_hub import snapshot_download
|
| 11 |
|
|
|
|
| 66 |
index=0
|
| 67 |
)
|
| 68 |
|
| 69 |
+
|
| 70 |
with col2:
|
| 71 |
global brokerages
|
| 72 |
brokerages = st.number_input(label="Brokerages",step=0.01,value=0.2644 ,format="%.4f")
|
|
|
|
| 93 |
|
| 94 |
with col3:
|
| 95 |
# File uploader
|
| 96 |
+
|
| 97 |
+
if Exchange == 'Indian':
|
| 98 |
+
symbol = ['NIFTY', 'BANKNIFTY', 'FINNIFTY', 'NIFTYIT', 'NIFTYFMCG', 'NIFTYMETAL', 'NIFTYPSU', 'NIFTYAUTO', 'NIFTYMEDIA', 'NIFTYPVTBANK', 'NIFTYREALTY', 'NIFTYCONSUMER', 'NIFTYENERGY',
|
| 99 |
+
'NIFTYHEALTHCARE', 'NIFTYINFRA', 'NIFTYPHARMA', 'RELIANCE', 'TATAMOTORS', 'HDFCBANK', 'ICICIBANK', 'INFY', 'HINDUNILVR', 'LT', 'TCS', 'HDFC', 'KOTAKBANK', 'AXISBANK', 'ITC', 'SBIN', 'MARUTI', 'BAJFINANCE']
|
| 100 |
+
exchange_list = ['NSE', 'BSE', 'MCX', 'NFO', 'CDS']
|
| 101 |
+
else:
|
| 102 |
+
symbol = ['ETHUSDT', 'BTCUSDT', 'BNBUSDT', 'XRPUSDT', 'SOLUSDT', 'DOGEUSDT', 'ADAUSDT', 'MATICUSDT', 'DOTUSDT', 'TRXUSDT']
|
| 103 |
+
exchange_list = ['BINANCE', 'BITFINEX', 'COINBASE', 'BITSTAMP', 'OKEX', 'BYBIT', 'GEMINI']
|
| 104 |
+
|
| 105 |
+
## Add search functionality in selectbox
|
| 106 |
+
# symbol = st.selectbox("Select Symbol", symbol, index=0, key="symbol_select")
|
| 107 |
+
symbol = st.selectbox("Select Symbol", symbol, index=0, key="symbol_select", help="Search for a symbol by typing in the box")
|
| 108 |
+
symbol_exchange = st.selectbox("Select Exchange", exchange_list, index=0, key="exchange_select", help="Search for an exchange by typing in the box")
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
# symbol = st.selectbox("Select Symbol", symbol, index=0)
|
| 112 |
+
# symbol_exchange = st.selectbox("Select Exchange", exchange_list, index=0)
|
| 113 |
+
|
| 114 |
+
# uploaded_file = st.file_uploader("Upload your CSV file", type=["csv"])
|
| 115 |
|
| 116 |
if selected_script == "Old":
|
| 117 |
+
from main4 import get_buy_signal, parse_date, get_sell_signal, year_wise_analysis, calculate_yearly_returns, calculate_mtf_returns, crypto_year_wise_analysis, crypto_calculate_mtf_returns, crypto_calculate_yearly_returns, find_sequences, generate_trade_signals, data_collection
|
| 118 |
else:
|
| 119 |
+
from main6 import get_buy_signal, parse_date, get_sell_signal, year_wise_analysis, calculate_yearly_returns, calculate_mtf_returns, crypto_year_wise_analysis, crypto_calculate_mtf_returns, crypto_calculate_yearly_returns, find_sequences, generate_trade_signals, data_collection
|
| 120 |
|
| 121 |
+
HISTORICAL_DATA = data_collection(symbol = symbol, exchange = symbol_exchange)
|
| 122 |
+
|
| 123 |
# st.divider()
|
| 124 |
+
if HISTORICAL_DATA is not None:
|
| 125 |
+
df = HISTORICAL_DATA.copy()
|
| 126 |
try:
|
| 127 |
df = df[['Date','Open','High', 'Low', 'Close']]
|
| 128 |
except:
|
|
|
|
| 566 |
buy_trades_mtf_yearly_compound.to_excel(writer, sheet_name='BUY MTF CMP Yearly', index=False)
|
| 567 |
|
| 568 |
|
| 569 |
+
file_name_ = f"{symbol} Trailing {trail_offset} Target {target_sl}"
|
| 570 |
|
| 571 |
excel_buffer.seek(0)
|
| 572 |
st.download_button(
|