Skip to content

Commit

Permalink
support add stockhk, stockus
Browse files Browse the repository at this point in the history
  • Loading branch information
foolcage committed Nov 25, 2021
1 parent b4b5faa commit de44632
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ eastmoneypy是使用python来对[东方财富](http://www.eastmoney.com/)进行
- [x] 管理组合
- [x] 添加A股标的到组合
- [x] 添加板块到组合
- [x] 添加港股
- [x] 添加美股
- [ ] 添加ETF
- [ ] 添加港股


## 安装
Expand Down Expand Up @@ -59,9 +60,10 @@ Out[3]: (True, {'gid': '350518464', 'msg': '添加组合成功'})

### 添加股票到组合
```
In [4]: add_to_group('000999',group_name='tmp')
2020-02-14 23:34:55,287 INFO MainThread ret:{'re': True, 'message': '', 'result': {'ver': '1', 'msg': '添加股票成功'}}
Out[4]: True
>>> add_to_group('000999', group_name='tmp')
>>> add_to_group('BK1003', group_name='概念',entity_type='block')
>>> add_to_group('MSFT', group_name='tmp', entity_type='stockus')
>>> add_to_group('00700', group_name='tmp' entity_type='stockhk')
```

### 删除组合
Expand Down
8 changes: 7 additions & 1 deletion eastmoneypy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,15 @@ def to_eastmoney_code(code, entity_type='stock'):
return f'0%24{code}'
if entity_type == 'block':
return f'90${code}'
if entity_type == 'stockhk':
return f'116%24{code}'
if entity_type == 'stockus':
return f'105%24{code}'
assert False


__all__ = ['create_group', 'get_groups', 'rename_group', 'del_group', 'add_to_group', 'to_eastmoney_code']

if __name__ == '__main__':
print(add_to_group('BK1003', group_name='bull',entity_type='block'))
print(add_to_group('MSFT', group_name='自选股', entity_type='stockus'))
# print(add_to_group('BK1003', group_name='概念',entity_type='block'))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# For a discussion on single-sourcing the version across setup.py and the
# project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.0.8', # Required
version='0.0.9', # Required

# This is a one-line description or tagline of what your project does. This
# corresponds to the "Summary" metadata field:
Expand Down

0 comments on commit de44632

Please sign in to comment.