-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
40 lines (29 loc) · 1.39 KB
/
Copy pathconfig.py
File metadata and controls
40 lines (29 loc) · 1.39 KB
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
"""ABOUTME: Global config for CrossSectionCN.
ABOUTME: Paths, date ranges, universe filters."""
import os
from datetime import date
from pathlib import Path
from dotenv import load_dotenv
load_dotenv()
ROOT = Path(__file__).parent
DATA_RAW_VENDOR = ROOT / "pyData" / "raw_vendor"
DATA_CANONICAL = ROOT / "pyData" / "canonical"
# Backward-compatible alias: existing intermediate/factor code reads canonical tables here.
DATA_RAW = DATA_CANONICAL
DATA_INTERMEDIATE = ROOT / "pyData" / "intermediate"
DATA_FACTORS = ROOT / "pyData" / "factors"
START_DATE = date(2010, 1, 1)
END_DATE = date.today()
UNIVERSE_EXCHANGES = ["SH", "SZ"]
UNIVERSE_BOARDS = ["MAIN", "GEM", "STAR"]
FACTOR_DOC_PATH = ROOT / "factor_doc.csv"
DATA_SOURCE = os.environ.get("CNCS_DATA_SOURCE", "tushare").lower()
TUSHARE_TOKEN = os.environ.get("TUSHARE_TOKEN") or os.environ.get("TS_TOKEN")
# Dry-run / smoke: limit universe size (0 = no limit)
MAX_STOCKS = int(os.environ.get("CNCS_MAX_STOCKS", "0") or "0")
# Parallel-ish batch size for OHLCV downloads (symbols per HTTP batch call)
OHLCV_BATCH = int(os.environ.get("CNCS_OHLCV_BATCH", "25") or "25")
# Tushare official limits vary by endpoint/account; default leaves room below 500/min.
TUSHARE_MAX_REQUESTS_PER_MINUTE = int(os.environ.get("CNCS_TUSHARE_RPM", "450") or "450")
for d in (DATA_RAW_VENDOR, DATA_CANONICAL, DATA_INTERMEDIATE, DATA_FACTORS):
d.mkdir(parents=True, exist_ok=True)