File size: 7,670 Bytes
590a501 | 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | """
All supported futures contracts β covers every symbol available via akshare (86 total).
Organized by exchange and category.
"""
from dataclasses import dataclass
@dataclass
class ContractInfo:
symbol: str # akshare query name
exchange: str # exchange code
category: str # category key
name_cn: str # display name
EXCHANGES = {
"CFFEX": "δΈε½ιθζθ΄§δΊ€ζζ",
"SHFE": "δΈζ΅·ζθ΄§δΊ€ζζ",
"INE": "δΈζ΅·ε½ι
θ½ζΊδΊ€ζδΈεΏ",
"DCE": "ε€§θΏεεδΊ€ζζ",
"CZCE": "ιε·εεδΊ€ζζ",
"GFEX": "εΉΏε·ζθ΄§δΊ€ζζ",
}
CATEGORIES = {
"financial": "ιθζθ΄§",
"precious_metal": "θ΄΅ιε±",
"base_metal": "ζθ²ιε±",
"ferrous": "ι»θ²η³»",
"energy": "θ½ζΊεε·₯",
"agriculture": "εδΊ§ε",
"shipping": "θͺθΏζζ°",
}
CONTRACTS: list[ContractInfo] = [
# ββ ιθζθ΄§ (CFFEX) βββββββββββββββββββββββββββββββββ
ContractInfo("ζ²ͺζ·±300ζζ°ζθ΄§", "CFFEX", "financial", "ζ²ͺζ·±300"),
ContractInfo("δΈθ―50ζζ°ζθ΄§", "CFFEX", "financial", "δΈθ―50"),
ContractInfo("δΈθ―500ζζ°ζθ΄§", "CFFEX", "financial", "δΈθ―500"),
ContractInfo("δΈθ―1000θ‘ζζθ΄§", "CFFEX", "financial", "δΈθ―1000"),
ContractInfo("2εΉ΄ζε½εΊζθ΄§", "CFFEX", "financial", "2εΉ΄ε½εΊ"),
ContractInfo("5εΉ΄ζε½εΊζθ΄§", "CFFEX", "financial", "5εΉ΄ε½εΊ"),
ContractInfo("10εΉ΄ζε½εΊζθ΄§", "CFFEX", "financial", "10εΉ΄ε½εΊ"),
# ββ θ΄΅ιε± (SHFE / GFEX) ββββββββββββββββββββββββββββ
ContractInfo("ι»ι", "SHFE", "precious_metal", "ι»ι"),
ContractInfo("η½ιΆ", "SHFE", "precious_metal", "η½ιΆ"),
ContractInfo("ι", "GFEX", "precious_metal", "ι"),
ContractInfo("ι―", "GFEX", "precious_metal", "ι―"),
# ββ ζθ²ιε± (SHFE) ββββββββββββββββββββββββββββββββββ
ContractInfo("ζ²ͺι", "SHFE", "base_metal", "ζ²ͺι"),
ContractInfo("ζ²ͺι", "SHFE", "base_metal", "ζ²ͺι"),
ContractInfo("ζ²ͺι", "SHFE", "base_metal", "ζ²ͺι"),
ContractInfo("ζ²ͺι
", "SHFE", "base_metal", "ζ²ͺι
"),
ContractInfo("ζ²ͺι", "SHFE", "base_metal", "ζ²ͺι"),
ContractInfo("ζ²ͺι‘", "SHFE", "base_metal", "ζ²ͺι‘"),
ContractInfo("δΈιι’", "SHFE", "base_metal", "δΈιι’"),
ContractInfo("ε½ι
ι", "SHFE", "base_metal", "ε½ι
ι"),
ContractInfo("ζ°§ει", "SHFE", "base_metal", "ζ°§ει"),
ContractInfo("ιΈι ιειζθ΄§", "SHFE", "base_metal", "ιΈι ιει"),
ContractInfo("ε·₯δΈη‘
", "GFEX", "base_metal", "ε·₯δΈη‘
"),
ContractInfo("η’³ι
Έι", "GFEX", "base_metal", "η’³ι
Έι"),
ContractInfo("ε€ζΆη‘
", "GFEX", "base_metal", "ε€ζΆη‘
"),
# ββ ι»θ²η³» (SHFE / DCE / CZCE) ββββββββββββββββββββββ
ContractInfo("θΊηΊΉι’", "SHFE", "ferrous", "θΊηΊΉι’"),
ContractInfo("ηθ½§ε·ζΏ", "SHFE", "ferrous", "ηε·"),
ContractInfo("ηΊΏζ", "SHFE", "ferrous", "ηΊΏζ"),
ContractInfo("ιηΏη³", "DCE", "ferrous", "ιηΏη³"),
ContractInfo("η¦η
€", "DCE", "ferrous", "η¦η
€"),
ContractInfo("η¦η", "DCE", "ferrous", "η¦η"),
ContractInfo("ι°η‘
", "CZCE", "ferrous", "ι°η‘
"),
ContractInfo("η‘
ι", "CZCE", "ferrous", "η‘
ι"),
ContractInfo("ε¨εη
€", "CZCE", "ferrous", "ε¨εη
€"),
# ββ θ½ζΊεε·₯ (SHFE / INE / DCE / CZCE) ββββββββββββββ
ContractInfo("εζ²Ή", "INE", "energy", "εζ²Ή"),
ContractInfo("ηζ²Ή", "SHFE", "energy", "ηζ²Ή"),
ContractInfo("ζ²₯ι", "SHFE", "energy", "ζ²₯ι"),
ContractInfo("ζ©‘θΆ", "SHFE", "energy", "ζ©‘θΆ"),
ContractInfo("20ε·θΆ", "SHFE", "energy", "20ε·θΆ"),
ContractInfo("δΈδΊη―ζ©‘θΆ", "SHFE", "energy", "δΈδΊη―ζ©‘θΆ"),
ContractInfo("ηΊΈζ΅", "SHFE", "energy", "ηΊΈζ΅"),
ContractInfo("θΆηε°ε·ηΊΈζθ΄§", "SHFE", "energy", "θΆηε°ε·ηΊΈ"),
ContractInfo("δ½η‘«ηζζ²Ή", "SHFE", "energy", "δ½η‘«ηζ²Ή"),
ContractInfo("PTA", "CZCE", "energy", "PTA"),
ContractInfo("ιι", "CZCE", "energy", "η²ι"),
ContractInfo("δΉδΊι", "DCE", "energy", "δΉδΊι"),
ContractInfo("ε°Ώη΄ ", "CZCE", "energy", "ε°Ώη΄ "),
ContractInfo("ηΊ―η’±", "CZCE", "energy", "ηΊ―η’±"),
ContractInfo("η»η", "CZCE", "energy", "η»η"),
ContractInfo("ε‘ζ", "DCE", "energy", "ε‘ζ(LLDPE)"),
ContractInfo("PP", "DCE", "energy", "θδΈη―(PP)"),
ContractInfo("PVC", "DCE", "energy", "θζ°―δΉη―(PVC)"),
ContractInfo("θ―δΉη―", "DCE", "energy", "θ―δΉη―"),
ContractInfo("ηηΊ€", "CZCE", "energy", "ηηΊ€"),
ContractInfo("ζΆ²εη³ζ²Ήζ°", "DCE", "energy", "ζΆ²εζ°(LPG)"),
ContractInfo("ηΊ―θ―", "DCE", "energy", "ηΊ―θ―"),
ContractInfo("η§η’±", "CZCE", "energy", "η§η’±"),
ContractInfo("δΊη²θ―", "CZCE", "energy", "δΊη²θ―(PX)"),
ContractInfo("ηΆηΊ§θι
―εη", "CZCE", "energy", "ηΆη(PET)"),
ContractInfo("δΈη―", "CZCE", "energy", "δΈη―"),
# ββ εδΊ§ε (DCE / CZCE) ββββββββββββββββββββββββββββββ
ContractInfo("θ±δΈ", "DCE", "agriculture", "θ±δΈ"),
ContractInfo("θ±δΊ", "DCE", "agriculture", "θ±δΊ"),
ContractInfo("θ±η²", "DCE", "agriculture", "θ±η²"),
ContractInfo("θ±ζ²Ή", "DCE", "agriculture", "θ±ζ²Ή"),
ContractInfo("ζ£ζ¦", "DCE", "agriculture", "ζ£ζ¦ζ²Ή"),
ContractInfo("θζ²Ή", "CZCE", "agriculture", "θη±½ζ²Ή"),
ContractInfo("θη±½", "CZCE", "agriculture", "θη±½"),
ContractInfo("θη²", "CZCE", "agriculture", "θη²"),
ContractInfo("θ±η", "CZCE", "agriculture", "θ±η"),
ContractInfo("ζ£θ±", "CZCE", "agriculture", "ζ£θ±"),
ContractInfo("ζ£ηΊ±", "CZCE", "agriculture", "ζ£ηΊ±"),
ContractInfo("η½η³", "CZCE", "agriculture", "η½η³"),
ContractInfo("ι²θΉζ", "CZCE", "agriculture", "θΉζ"),
ContractInfo("ηΊ’ζ£", "CZCE", "agriculture", "ηΊ’ζ£"),
ContractInfo("ηη±³", "DCE", "agriculture", "ηη±³"),
ContractInfo("ηη±³ζ·η²", "DCE", "agriculture", "ηη±³ζ·η²"),
ContractInfo("ιΈ‘θ", "DCE", "agriculture", "ιΈ‘θ"),
ContractInfo("ηηͺ", "DCE", "agriculture", "ηηͺ"),
ContractInfo("η²³η±³", "DCE", "agriculture", "η²³η±³"),
ContractInfo("粳稻", "CZCE", "agriculture", "粳稻"),
ContractInfo("εΌΊιΊ¦", "CZCE", "agriculture", "εΌΊιΊ¦"),
ContractInfo("ζ©η±Όη¨»", "CZCE", "agriculture", "ζ©η±Όη¨»"),
ContractInfo("ζ籼稻", "CZCE", "agriculture", "ζ籼稻"),
ContractInfo("ηΊ€η»΄ζΏ", "DCE", "agriculture", "ηΊ€η»΄ζΏ"),
ContractInfo("θΆεζΏ", "DCE", "agriculture", "θΆεζΏ"),
ContractInfo("εζ¨", "DCE", "agriculture", "εζ¨"),
# ββ θͺθΏζζ° (SHFE) βββββββββββββββββββββββββββββββββ
ContractInfo("ιθΏζζ°(欧线)ζθ΄§", "SHFE", "shipping", "ιθΏζζ°(欧线)"),
]
SYMBOL_LOOKUP: dict[str, ContractInfo] = {c.symbol: c for c in CONTRACTS}
def get_contracts_by_category(category: str | None = None) -> list[ContractInfo]:
if category is None:
return CONTRACTS
return [c for c in CONTRACTS if c.category == category]
def get_contracts_by_exchange(exchange: str | None = None) -> list[ContractInfo]:
if exchange is None:
return CONTRACTS
return [c for c in CONTRACTS if c.exchange == exchange]
|