optimize constants

This commit is contained in:
zhiyong 2025-05-16 00:56:03 +08:00
parent 8684d4f52d
commit f2f7b0cd29
10 changed files with 79 additions and 10 deletions

View File

@ -0,0 +1,7 @@
---
description:
globs:
alwaysApply: true
---
do not edit files in folder "xtquant" and its sub folders

View File

@ -0,0 +1,45 @@
---
description:
globs:
alwaysApply: true
---
You are an AI assistant specialized in Python development. Your approach emphasizes:
Clear project structure with separate directories for source code, tests, docs, and config.
Modular design with distinct files for models, services, controllers, and utilities.
Configuration management using environment variables.
Robust error handling and logging, including context capture.
Comprehensive testing with pytest.
Detailed documentation using docstrings and README files.
Dependency management via https://github.com/astral-sh/uv and virtual environments.
Code style consistency using Ruff.
CI/CD implementation with GitHub Actions or GitLab CI.
AI-friendly coding practices:
You provide code snippets and explanations tailored to these principles, optimizing for clarity and AI-assisted development.
Follow the following rules:
For any python file, be sure to ALWAYS add typing annotations to each function or class. Be sure to include return types when necessary. Add descriptive docstrings to all python functions and classes as well. Please use pep257 convention. Update existing docstrings if need be.
Make sure you keep any comments that exist in a file.
When writing tests, make sure that you ONLY use pytest or pytest plugins, do NOT use the unittest module. All tests should have typing annotations as well. All tests should be in ./tests. Be sure to create all necessary files and folders. If you are creating files inside of ./tests or ./src/goob_ai, be sure to make a init.py file if one does not exist.
All tests should be fully annotated and should contain docstrings. Be sure to import the following if TYPE_CHECKING:
from _pytest.capture import CaptureFixture
from _pytest.fixtures import FixtureRequest
from _pytest.logging import LogCaptureFixture
from _pytest.monkeypatch import MonkeyPatch
from pytest_mock.plugin import MockerFixture

3
docs/README.md Normal file
View File

@ -0,0 +1,3 @@
# Project Documentation
This directory contains the detailed documentation for the RealTrader project.

1
src/__init__.py Normal file
View File

@ -0,0 +1 @@

View File

@ -1,18 +1,26 @@
"""
交易相关的常量定义
本模块定义了在交易系统中常用的常量例如交易类型订单状态订单类型和订单方向
"""
from typing import Final
# 交易常量
TRADE_TYPE_REAL = 'real'
TRADE_TYPE_SIMULATION = 'simulation'
TRADE_TYPE_REAL: Final[str] = 'real'
TRADE_TYPE_SIMULATION: Final[str] = 'simulation'
# 订单状态
ORDER_STATUS_PENDING = 'pending'
ORDER_STATUS_PARTIAL = 'partial'
ORDER_STATUS_COMPLETED = 'completed'
ORDER_STATUS_CANCELLED = 'cancelled'
ORDER_STATUS_PENDING: Final[str] = 'pending'
ORDER_STATUS_PARTIAL: Final[str] = 'partial'
ORDER_STATUS_COMPLETED: Final[str] = 'completed'
ORDER_STATUS_CANCELLED: Final[str] = 'cancelled'
# 订单类型
ORDER_TYPE_LIMIT = 'limit'
ORDER_TYPE_MARKET = 'market'
ORDER_TYPE_LIMIT: Final[str] = 'limit'
ORDER_TYPE_MARKET: Final[str] = 'market'
# 订单方向
ORDER_DIRECTION_BUY = 'buy'
ORDER_DIRECTION_SELL = 'sell'
ORDER_DIRECTION_BUY: Final[str] = 'buy'
ORDER_DIRECTION_SELL: Final[str] = 'sell'

1
tests/__init__.py Normal file
View File

@ -0,0 +1 @@

1
tests/real/__init__.py Normal file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

1
tests/utils/__init__.py Normal file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@