-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_trading.py
44 lines (36 loc) · 2.14 KB
/
test_trading.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from .context import init_context
init_context()
from typing import List
from zvt.api import fundamental
from zvt.domain import get_db_session, StoreCategory, Provider, HolderTrading, ManagerTrading
session = get_db_session(provider='eastmoney', store_category=StoreCategory.trading) # type: sqlalchemy.orm.Session
# 股东交易
def test_000778_holder_trading():
result: List[HolderTrading] = fundamental.get_holder_trading(session=session, provider=Provider.EASTMONEY,
return_type='domain',
codes=['000778'],
end_timestamp='2018-09-30',
start_timestamp='2018-09-30',
order=HolderTrading.holding_pct.desc())
assert len(result) == 6
assert result[0].holder_name == '新兴际华集团有限公司'
assert result[0].change_pct == 0.0205
assert result[0].volume == 32080000
assert result[0].holding_pct == 0.3996
# 高管交易
def test_000778_manager_trading():
result: List[ManagerTrading] = fundamental.get_manager_trading(session=session, provider=Provider.EASTMONEY,
return_type='domain',
codes=['000778'],
end_timestamp='2018-09-30',
start_timestamp='2017-09-30',
order=ManagerTrading.holding.desc())
assert len(result) == 1
assert result[0].trading_person == '巩国平'
assert result[0].volume == 8400
assert result[0].price == None
assert result[0].holding == 18700
assert result[0].trading_way == '增持'
assert result[0].manager_position == '职工监事'
assert result[0].manager == '巩国平'
assert result[0].relationship_with_manager == '本人'