File size: 1,685 Bytes
7a4e48d
bce57b8
 
 
7a4e48d
 
 
 
bce57b8
 
7a4e48d
13836e0
 
7a4e48d
 
 
 
bce57b8
 
 
 
 
7a4e48d
13836e0
 
 
 
 
 
 
 
 
 
 
 
 
bce57b8
7a4e48d
 
bce57b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
63
64
65
# config/settings.py

import os
from pathlib import Path
import streamlit as st

# Check if we're running on HuggingFace Space
IS_HF_SPACE = os.getenv('SPACE_ID') is not None

# Base directories
if IS_HF_SPACE:
    # Use a directory in the HF space
    BASE_DIR = Path('/data')
else:
    BASE_DIR = Path(__file__).resolve().parent.parent

# Data directories
DATA_DIR = BASE_DIR / "data"
CHAT_HISTORIES_DIR = DATA_DIR / "chat_histories"
CHAT_IMAGES_DIR = DATA_DIR / "chat_images"

# Create directories if they don't exist
for directory in [DATA_DIR, CHAT_HISTORIES_DIR, CHAT_IMAGES_DIR]:
    try:
        directory.mkdir(parents=True, exist_ok=True)
        # Ensure directories are writable
        if directory.exists():
            os.chmod(directory, 0o777)
    except Exception as e:
        st.warning(f"Could not create or modify directory {directory}: {str(e)}")
        # Fallback to temporary directory if needed
        if str(directory).startswith(str(BASE_DIR)):
            new_path = Path('/tmp') / directory.relative_to(BASE_DIR)
            new_path.mkdir(parents=True, exist_ok=True)
            if IS_HF_SPACE:
                directory = new_path

# API Settings - Get from HuggingFace secrets
ANTHROPIC_API_KEY = os.getenv('ANTHROPIC_API_KEY')
CLAUDE_MODEL = "claude-3-opus-20240229"

# App Settings
APP_NAME = "Stock Chart Assistant"
APP_EMOJI = "📈"

# Analysis Options
CHART_PATTERNS = [
    "Double Top/Bottom",
    "Head and Shoulders",
    "Triangle",
    "Flag",
    "Wedge",
    "Channel",
    "Support/Resistance"
]

TECHNICAL_INDICATORS = [
    "Moving Averages",
    "RSI",
    "MACD",
    "Bollinger Bands",
    "Volume",
    "Stochastic",
    "ADX"
]