-
Notifications
You must be signed in to change notification settings - Fork 881
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
864 additions
and
1,591 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- coding: utf-8 -*- | ||
from datetime import datetime | ||
from typing import Any, Dict | ||
|
||
from pydantic import BaseModel, ConfigDict, Json | ||
from sqlalchemy import Column, String, JSON | ||
from sqlalchemy.orm import declarative_base | ||
|
||
from zvt.contract.api import get_db_session | ||
from zvt.contract.register import register_schema | ||
from zvt.contract.schema import Mixin | ||
|
||
ZvtInfoBase = declarative_base() | ||
|
||
|
||
class User(Mixin, ZvtInfoBase): | ||
__tablename__ = "user" | ||
added_col = Column(String) | ||
json_col = Column(JSON) | ||
|
||
|
||
class UserModel(BaseModel): | ||
model_config = ConfigDict(from_attributes=True) | ||
|
||
id: str | ||
entity_id: str | ||
timestamp: datetime | ||
added_col: str | ||
json_col: Dict | ||
|
||
|
||
register_schema(providers=["zvt"], db_name="test", schema_base=ZvtInfoBase) | ||
|
||
if __name__ == "__main__": | ||
user_model = UserModel( | ||
id="user_cn_jack_2020-01-01", | ||
entity_id="user_cn_jack", | ||
timestamp="2020-01-01", | ||
added_col="test", | ||
json_col={"a": 1}, | ||
) | ||
session = get_db_session(provider="zvt", data_schema=User) | ||
|
||
user = session.query(User).filter(User.id == "user_cn_jack_2020-01-01").first() | ||
print(UserModel.validate(user)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
requests==2.31.0 | ||
SQLAlchemy==2.0.28 | ||
pandas==2.0.3 | ||
pydantic==2.6.4 | ||
arrow==1.2.3 | ||
openpyxl==3.1.1 | ||
demjson3==3.0.6 | ||
marshmallow-sqlalchemy==1.0.0 | ||
marshmallow==3.21.1 | ||
plotly==5.13.0 | ||
dash==2.8.1 | ||
jqdatapy==0.1.8 | ||
dash-bootstrap-components==1.3.1 | ||
dash_daq==0.5.0 | ||
scikit-learn==1.2.1 | ||
scikit-learn==1.2.1 | ||
fastapi==0.110.0 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
import json | ||
|
||
from examples.data_runner.kdata_runner import record_stock_data, record_stock_news, record_stock_events | ||
from examples.reports.report_tops import report_top_stocks, report_top_blocks | ||
from examples.reports.report_vol_up import report_vol_up_stocks | ||
from examples.utils import get_hot_topics | ||
from zvt import zvt_config | ||
from zvt.factors.top_stocks import compute_top_stocks | ||
from zvt.informer import EmailInformer | ||
from zvt.utils import current_date | ||
|
||
if __name__ == "__main__": | ||
|
||
# record_stock_news() | ||
|
||
record_stock_data() | ||
# record_stock_events() | ||
compute_top_stocks() | ||
|
||
report_top_stocks() | ||
# report_top_blocks() | ||
report_vol_up_stocks() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
from examples.data_runner.kdata_runner import record_stockhk_data | ||
from examples.reports.report_tops import report_top_stockhks | ||
from examples.reports.report_vol_up import report_vol_up_stockhks | ||
|
||
if __name__ == "__main__": | ||
record_stockhk_data() | ||
|
||
report_top_stockhks() | ||
report_vol_up_stockhks() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# -*- coding: utf-8 -*- | ||
from datetime import datetime | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
|
||
|
||
class MixinModel(BaseModel): | ||
model_config = ConfigDict(from_attributes=True) | ||
|
||
id: str | ||
entity_id: str | ||
timestamp: datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
from sqlalchemy.orm import declarative_base | ||
|
||
from zvt.contract.register import register_schema, register_entity | ||
from zvt.contract.register import register_schema | ||
from zvt.contract.schema import TradableEntity | ||
|
||
FutureMetaBase = declarative_base() | ||
|
||
|
||
@register_entity(entity_type="future") | ||
class Future(FutureMetaBase, TradableEntity): | ||
__tablename__ = "future" | ||
|
||
|
||
register_schema(providers=["em"], db_name="future_meta", schema_base=FutureMetaBase) | ||
register_schema(providers=["em"], db_name="future_meta", schema_base=FutureMetaBase, entity_type="future") | ||
|
||
# the __all__ is generated | ||
__all__ = ["Future"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.