-
Notifications
You must be signed in to change notification settings - Fork 873
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some common feature from examples to main package
- Loading branch information
Showing
21 changed files
with
137 additions
and
82 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 |
---|---|---|
@@ -1,5 +1 @@ | ||
The examples is updating with master source code. | ||
Run with specific version e.g. v0.9.16 need to | ||
``` | ||
git checkout v0.10.1 | ||
``` | ||
The examples are updating with master source code. |
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,5 +1,4 @@ | ||
zvt >= 0.10.1 | ||
apscheduler >= 3.4.0 | ||
eastmoneypy == 0.1.5 | ||
tabulate>=0.8.8 | ||
ta |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# -*- coding: utf-8 -*- | ||
import eastmoneypy | ||
|
||
from zvt import zvt_config | ||
from zvt.contract.api import get_entities | ||
from zvt.informer import EmailInformer | ||
|
||
import requests | ||
|
||
|
||
def inform_email(entity_ids, entity_type, target_date, title, provider): | ||
msg = "no targets" | ||
if entity_ids: | ||
entities = get_entities(provider=provider, entity_type=entity_type, entity_ids=entity_ids, return_type="domain") | ||
assert len(entities) == len(entity_ids) | ||
|
||
infos = [f"{entity.name}({entity.code})" for entity in entities] | ||
msg = "\n".join(infos) + "\n" | ||
|
||
EmailInformer().send_message(zvt_config["email_username"], f"{target_date} {title}", msg) | ||
|
||
|
||
def add_to_eastmoney(codes, group, entity_type="stock", over_write=True): | ||
with requests.Session() as session: | ||
codes = list(set(codes)) | ||
if over_write: | ||
try: | ||
eastmoneypy.del_group(group_name=group, session=session) | ||
except: | ||
pass | ||
try: | ||
eastmoneypy.create_group(group_name=group, session=session) | ||
except: | ||
pass | ||
|
||
group_id = eastmoneypy.get_group_id(group, session=session) | ||
|
||
for code in codes: | ||
eastmoneypy.add_to_group(code=code, entity_type=entity_type, group_id=group_id, session=session) | ||
|
||
|
||
def clean_groups(keep): | ||
if keep is None: | ||
keep = ["自选股", "练气", "重要板块", "主线"] | ||
|
||
with requests.Session() as session: | ||
groups = eastmoneypy.get_groups(session=session) | ||
groups_to_clean = [group["gid"] for group in groups if group["gname"] not in keep] | ||
for gid in groups_to_clean: | ||
eastmoneypy.del_group(group_id=gid, session=session) | ||
|
||
|
||
# the __all__ is generated | ||
__all__ = ["inform_email", "add_to_eastmoney", "clean_groups"] |
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 was deleted.
Oops, something went wrong.
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,25 @@ | ||
# -*- coding: utf-8 -*- | ||
# the __all__ is generated | ||
__all__ = [] | ||
|
||
# __init__.py structure: | ||
# common code of the package | ||
# export interface in __all__ which contains __all__ of its sub modules | ||
|
||
# import all from submodule constants | ||
from .constants import * | ||
from .constants import __all__ as _constants_all | ||
|
||
__all__ += _constants_all | ||
|
||
# import all from submodule ztime | ||
from .ztime import * | ||
from .ztime import __all__ as _ztime_all | ||
|
||
__all__ += _ztime_all | ||
|
||
# import all from submodule zhdate | ||
from .zhdate import * | ||
from .zhdate import __all__ as _zhdate_all | ||
|
||
__all__ += _zhdate_all |
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 |
---|---|---|
|
@@ -422,3 +422,5 @@ | |
""" | ||
从1900年,至2100年每年的农历春节的公历日期 | ||
""" | ||
# the __all__ is generated | ||
__all__ = [] |
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