File size: 1,545 Bytes
069fbff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a1ad9ef
 
 
069fbff
6ac33e3
069fbff
6ac33e3
069fbff
6ac33e3
a1ad9ef
 
 
6ac33e3
 
 
 
a1ad9ef
5d1cac4
 
 
 
 
 
 
 
 
069fbff
 
5d1cac4
069fbff
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import ssl
import logging
import gradio as gr
import matplotlib.pyplot as plt
from io import BytesIO
import base64
from datetime import datetime

# 둜그 μ„€μ •
#logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')

# SSL μΈμ¦μ„œ 검증 λΉ„ν™œμ„±ν™”
ssl._create_default_https_context = ssl._create_unverified_context

current_time = datetime.now().strftime("%b-%d-%Y")

def load_css():
    with open('style.css', 'r', encoding='utf-8') as file:
        css = file.read()
    return f"<style>{css}</style>"


def format_quantity(quantity):
    # μ•„μ£Ό μž‘μ€ 값을 0으둜 처리
    if abs(quantity) < 1e-5:  # μž„κ³„κ°’μ„ μ‘°μ •ν•˜μ—¬ 더 μ μ ˆν•œ 값을 μ„€μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
        quantity = 0    
    if quantity < 0:
        return f"({-quantity:,.1f})"
    else:
        return f"{quantity:,.1f}"

def format_value(value):
    # μ•„μ£Ό μž‘μ€ 값을 0으둜 처리
    if abs(value) < 1e-5:  # μž„κ³„κ°’μ„ μ‘°μ •ν•˜μ—¬ 더 μ μ ˆν•œ 값을 μ„€μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
        value = 0
    if value < 0:
        return f"({-value:,.0f})"
    else:
        return f"{value:,.0f}"

# currency_symbols = {
#     "KRW": "β‚©",
#     "USD": "$",
#     "CAD": "$",
#     "EUR": "€",
#     "JPY": "Β₯",
#     "GBP": "Β£"
# }

currency_symbols = {
    "KRW": "β‚©",
    "USD": "$"
}
def get_currency_symbol(currency_code):
    return currency_symbols.get(currency_code.upper(), "")

def get_currency_codes():
    return list(currency_symbols.keys())

currency_codes = get_currency_codes()