URGENT : Please HELP

Greetings Folks ,

I have a problem with this APP

I want that each time that Click on START button , I save those selected parameters in a new table or in a csv file that I can check each time in the sidebar (I wanted being updated of course each time I select my parameters and click On START button)

Also , I want that once I click that Start Button a new Line appears in the table that it was displayed (I have used plotly) but as you can see , it is poorly displayed and a new line is not added after selecting the parameters and click on the START button.

Thanks a lot for your help

To make it easy for you , here is the code :

import streamlit as st
import pandas as pd
import numpy as np
from datetime import datetime as dt

import plotly.graph_objects as go

coins_list = [‘LTC’,‘ETH’,‘BTC’]
FIXED = 1e5
coin = st.selectbox(‘Search COIN’ ,coins_list)
X1 = st.number_input(‘Select your X1’, min_value = 1e-5 , max_value = 999999999.999999 , step = 1e-5)
Y1 = st.number_input(‘Select your Y1’, min_value = 1e-5 , max_value = 999999999.999999 , step = 1e-5)
Z1 = st.number_input(‘Select your Quantity’, min_value = 1e-5, max_value = 9999999999.9999 , step = 1e-5)

I want each time that I select these parameters to SAVE them in a new table (A time component wil be interesting maybe)

col1,col2,col3,col4,col5 = st.columns(5)
with col3 :
st.button(“START”) # I want that each time a press the START Button there is a line which is added with the coin selected previously
if coin :

	# I want to the figure to be displayed correctly , taking all the width for example than I can adjust font and cells size by myself (please add them as arguments to try them out)

	fig2 = go.Figure(data=[go.Table(
			header=dict(values=['','','',['BOT - Status'],'',''],
					fill_color = 'green',
					line_color = 'green',
					align = 'center',
					font=dict(color='black', family="Lato", size=15)
					),
							
			cells = dict(values=[
					["Name of the BOT (as per the coin pair selected)",coin],  
					["Status"],
					["Start/Stop of BOT"],
					["Purchased Price",],
					["Current Price of the coin pair"],
					["Completed Loop"],
					["Comission Dedected"],
					["Profit made"]],
					line_color = 'darkslategray',
					fill_color = 'white',
					align = ['center'],
					font=dict(color='black', family="Lato", size=15))
					)]
			)

													   
	fig2.update_layout(margin=dict(l=20, r=20, t=20, b=20),
					   width=1200,
					   height=300)
	st.write(fig2)

Thanks for your asnwer

import streamlit as st
import pandas as pd
import numpy as np
from datetime import datetime as dt

import plotly.graph_objects as go

coins_list = [‘LTC’,‘ETH’,‘BTC’]
FIXED = 1e5
coin = st.selectbox(‘Search COIN’ ,coins_list)
X1 = st.number_input(‘Select your X1’, min_value = 1e-5 , max_value = 999999999.999999 , step = 1e-5)
Y1 = st.number_input(‘Select your Y1’, min_value = 1e-5 , max_value = 999999999.999999 , step = 1e-5)
Z1 = st.number_input(‘Select your Quantity’, min_value = 1e-5, max_value = 9999999999.9999 , step = 1e-5)

I want each time that I select these parameters to SAVE them in a new table (A time component wil be interesting maybe)

col1,col2,col3,col4,col5 = st.columns(5)
with col3 :
st.button(“START”) # I want that each time a press the START Button there is a line which is added with the coin selected previously
if coin :
# I want to the figure to be displayed correctly , taking all the width for example than I can adjust font and cells size by myself (please add them as arguments to try them out)

	fig2 = go.Figure(data=[go.Table(
			header=dict(values=['','','',['BOT - Status'],'',''],
					fill_color = 'green',
					line_color = 'green',
					align = 'center',
					font=dict(color='black', family="Lato", size=15)
					),
							
			cells = dict(values=[
					["Name of the BOT (as per the coin pair selected)",coin],
					["Status"],
					["Start/Stop of BOT"],
					["Purchased Price",],
					["Current Price of the coin pair"],
					["Completed Loop"],
					["Comission Dedected"],
					["Profit made"]],
					line_color = 'darkslategray',
					fill_color = 'white',
					align = ['center'],
					font=dict(color='black', family="Lato", size=15))
					)]
			)

													   
	fig2.update_layout(margin=dict(l=20, r=20, t=20, b=20),
					   width=1200,
					   height=300)
	st.plotly_chart(fig2,use_container_width=True)

issue_community

Here is what I get if I put under the “if coin :” after the fig2 , that way I create a connection 


Also , I have figured out that if I find a way with the dictionary , it’s easy but didn’t find a solution is as the following :

if I put this “fig2[‘data’][0][“cells”][“values”][0]” , I will as an output the following :

add

which means if I find a way to put that “complex” code in the place of “coin” here

[“Name of the BOT (as per the coin pair selected)”,coin],

A line will be added , it’s the only way that I founded 


can you try to find a solution for me for this ?

Also , what’s the story of Table , what’s the diffrence with Figure ?..

Figure in plotly as far as i know is the place holder to plot where you can add, in this case the Table, so Figure is just a place where Table can live in

ok but now I need to add a line with a coin in that table once I choose my parameters and click on start button . Any idea ? I think I got the idea and have to choose maybe a while TRUE with that “complex” command.

Also , How do you suggest to save in a csv when selecting those parameters and click on START button ?

Sorry, I was driving to my campus, I’ll make a dummy test app for you to play with, I’ll get to you a.s.a.p!

Thanks for this.

However , I didn’t appreciate the fact that you put this on your github without asking as 80% of it is my code.

Thank you to delete it

Also , I didn’t like the fact that it’s in CSV , it takes too much memory. I want something that will be add line by line at each submit

The code is not working by the way

Okay I’ll delete it, good luck

Maybe you can learn using some sql or use some nosql base database such as firestore and such

You suppose to use the csv in the file

Regarding the 80% thing, I already deleted it, but just so you know I was adding functionality to your code to make it simpler to understand, its just a simple “put input data in csv” scheme so I don’t think that was infringing on your right as that type of scheme is all over the place, but I’ll comply with your demands as yes I was using your code so no hard feeling okay.

With that out of the way, with the scheme that you are making, try using the firebase storage or google sheet if you want a super fast database, I currently don’t know the gist of “super fast database” maybe someone else can help. Streamlit itself got a whole lot tutorial regarding database usage with Streamlit, you can start there, and with the add things to database thingy, you can use the st.form (like the one I use in the now deleted repo) so that the program won’t run when you change the input

and sorry, I can’t help you further, Good Luck!

2 Likes

It has been a while but I suggest u can embedde your app with the database so that on click the database fields are updated as required.
see my beow app which i did some time back with streamlit, CSV and sqlite and if you need the code, I can share with you and the requirements.txt
username : admin
pasword : admin
http://104.129.128.98:8501/
thanks


Hello ,

Please leave me your email adress so that I can send you my source code.

Thank you
Iheb

Kasibanteg@gmail.com
Please send I will fix some time and go through it
Thanks

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.