SQL models for day trading
Project description
Day Trading Models
This repository contains a collection of SQLAlchemy models for day trading analysis and data management. These models are designed to be used in various projects related to stock market analysis, particularly focusing on the Chinese A-share market.
Features
- Comprehensive set of models covering various aspects of day trading:
- Opening dates
- Fund flows
- Limit up (涨停) and limit down (跌停) stocks
- Large orders (龙虎榜)
- Quotations
- Strong stocks
- Sub-new stocks
- And more...
- SQLAlchemy ORM for easy database integration
- Designed for flexibility and reusability across different projects
Installation
You can install this package using pip:
pip install day_trading_models
Usage
Here's a basic example of how to use these models:
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from day_trading_models import OpeningDate, Dt, Zt, Lhb, Fund
# Create an engine and session
engine = create_engine('your_database_url')
Session = sessionmaker(bind=engine)
session = Session()
# Create tables
OpeningDate.__table__.create(engine, checkfirst=True)
Dt.__table__.create(engine, checkfirst=True)
Zt.__table__.create(engine, checkfirst=True)
Lhb.__table__.create(engine, checkfirst=True)
Fund.__table__.create(engine, checkfirst=True)
# Example: Add an opening date
new_date = OpeningDate(date='2023-05-01')
session.add(new_date)
# Example: Query Zt (limit up) stocks
zt_stocks = session.query(Zt).filter(Zt.date == '2023-05-01').all()
# Example: Add a new fund flow record
new_fund = Fund(
date='2023-05-01',
sse_close_price=3000.0,
sse_change=0.02,
# ... other fields ...
)
session.add(new_fund)
session.commit()
Models
OpeningDate: Trading calendar datesDt: Stocks hitting lower price limitsFund: Fund flow informationLhb: Large order ("龙虎榜") dataLhbHyyyb: Active brokerage branches in large ordersLhbPlayer: Individual players in large ordersQuotation: Stock quotationsStrong: Strong performing stocksSubnew: Newly listed stocksZb: Stocks that hit the upper price limit but failed to maintain it until market close (炸板股)Zt: Stocks hitting upper price limits
Development
To set up the development environment:
- Clone the repository
- Install development dependencies:
pip install -r requirements-dev.txt
- Run tests:
pytest
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file day_trading_models-0.1.0.tar.gz.
File metadata
- Download URL: day_trading_models-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dff467c82d0249e146c66725a395766e887b06af4452f00167f12366e01c4d59
|
|
| MD5 |
adb8a9293225d9f1185849cf24e719de
|
|
| BLAKE2b-256 |
aa44b45281b5462eafc15efa9dfe1d05b5896d9e4244f20f0a70036cc5bb2ff0
|
File details
Details for the file day_trading_models-0.1.0-py3-none-any.whl.
File metadata
- Download URL: day_trading_models-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36d084f99aa24ca20ba8477a1eb373e642aec409be316a61fc4f98deb74ce28e
|
|
| MD5 |
a3dc226c026c82e178f1b30cffc3477a
|
|
| BLAKE2b-256 |
4176fe09f3530127f40fe3df0da2615694ac39be97d81399499cca43f4b31c2d
|