| """ |
| 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 |
| exchange: str |
| category: str |
| name_cn: str |
|
|
|
|
| EXCHANGES = { |
| "CFFEX": "δΈε½ιθζθ΄§δΊ€ζζ", |
| "SHFE": "δΈζ΅·ζθ΄§δΊ€ζζ", |
| "INE": "δΈζ΅·ε½ι
θ½ζΊδΊ€ζδΈεΏ", |
| "DCE": "ε€§θΏεεδΊ€ζζ", |
| "CZCE": "ιε·εεδΊ€ζζ", |
| "GFEX": "εΉΏε·ζθ΄§δΊ€ζζ", |
| } |
|
|
| CATEGORIES = { |
| "financial": "ιθζθ΄§", |
| "precious_metal": "θ΄΅ιε±", |
| "base_metal": "ζθ²ιε±", |
| "ferrous": "ι»θ²η³»", |
| "energy": "θ½ζΊεε·₯", |
| "agriculture": "εδΊ§ε", |
| "shipping": "θͺθΏζζ°", |
| } |
|
|
| CONTRACTS: list[ContractInfo] = [ |
| |
| 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εΉ΄ε½εΊ"), |
|
|
| |
| ContractInfo("ι»ι", "SHFE", "precious_metal", "ι»ι"), |
| ContractInfo("η½ιΆ", "SHFE", "precious_metal", "η½ιΆ"), |
| ContractInfo("ι", "GFEX", "precious_metal", "ι"), |
| ContractInfo("ι―", "GFEX", "precious_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("ιΈι ιειζθ΄§", "SHFE", "base_metal", "ιΈι ιει"), |
| ContractInfo("ε·₯δΈη‘
", "GFEX", "base_metal", "ε·₯δΈη‘
"), |
| ContractInfo("η’³ι
Έι", "GFEX", "base_metal", "η’³ι
Έι"), |
| ContractInfo("ε€ζΆη‘
", "GFEX", "base_metal", "ε€ζΆη‘
"), |
|
|
| |
| 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", "ε¨εη
€"), |
|
|
| |
| 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", "δΈη―"), |
|
|
| |
| 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", "εζ¨"), |
|
|
| |
| 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] |
|
|