import streamlit as st import math # Streamlit App st.set_page_config(page_title="OZ Cash and Gold Calculator", layout="wide") st.title("OZ Cash to Gold and Gold to OZ Cash Calculator") # --- Section 1: OZ CASH TO GOLD --- st.subheader("1. OZ Cash to Gold") # Input Fields oz_cash = st.number_input("OZ Cash", min_value=0, value=1280000, step=10000) tendon_price = st.number_input("Tendon Price", min_value=0, value=3760, step=10) eye_price = st.number_input("Eye Price", min_value=0, value=27500, step=1000) # Calculations num_tendons = math.floor(oz_cash / 120) num_eyes = math.floor(oz_cash / 900) oz_gold_value_tendon = tendon_price * num_tendons oz_gold_value_eye = eye_price * num_eyes php_value = (oz_cash / 120000) * 5000 # Results st.write("### Choose One to Sell") col1, col2, col3 = st.columns(3) with col1: st.metric("# of Tendons", num_tendons) st.metric("# of Eyes", num_eyes) with col2: st.metric("OZ Gold Value (Tendons)", oz_gold_value_tendon) st.metric("OZ Gold Value (Eyes)", oz_gold_value_eye) with col3: st.metric("PHP Value", f"{php_value:.2f}") # --- Section 2: GOLD TO OZ CASH --- st.subheader("2. Gold to OZ Cash") # Input Fields gold_needed = st.number_input("Gold Needed", min_value=0, value=3500000, step=10000) tendon_price_2 = st.number_input("Tendon Price (Gold to Cash)", min_value=0, value=3760, step=10) eye_price_2 = st.number_input("Eye Price (Gold to Cash)", min_value=0, value=27350, step=1000) # Calculations num_tendons_gold = math.floor(gold_needed / tendon_price_2) num_eyes_gold = math.floor(gold_needed / eye_price_2) oz_cash_value_tendon = 120 * num_tendons_gold oz_cash_value_eye = 900 * num_eyes_gold php_value_tendon = (oz_cash_value_tendon / 120000) * 5000 php_value_eye = (oz_cash_value_eye / 120000) * 5000 # Results st.write("### Choose One to Sell") col4, col5, col6 = st.columns(3) with col4: st.metric("# of Tendons", num_tendons_gold) st.metric("# of Eyes", num_eyes_gold) with col5: st.metric("OZ Cash Value (Tendons)", oz_cash_value_tendon) st.metric("OZ Cash Value (Eyes)", oz_cash_value_eye) with col6: st.metric("PHP Value (Tendons)", f"{php_value_tendon:.2f}") st.metric("PHP Value (Eyes)", f"{php_value_eye:.2f}")