• Stars
    star
    4,370
  • Rank 9,742 (Top 0.2 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created over 8 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

30天掌握量化交易 (持续更新)

更好的帮助自己炒股(亏钱-。-)

2022-12-08 更新

目前正在重构项目代码,目录结构可能与下面描述有些出入,后期会慢慢更新修改,感谢大家的关注与支持。


analysis/ 数据分析部分

datahub/ 数据采集部分

fund/ 基金相关的分析部分

*futu/ 富途牛牛接口的基本用法 *

hk_stock/ 港股部分

k-line/ K线技术形态部分

machine_learning/ 机器学习预测

trader/ 交易部分

ptrade/ ptrade自动交易实盘代码

log/ 存放日志

common/ 常用函数与库

configure 数据库连接与配置


使用教程:

  • 修改 configure/sample_config.json 配置文件名 为 configure/config.json,根据不同项目,并对着里面的字段进行修改,修改你的mysql,mongodb的用户名和密码,如果项目里面没有用到mysql,mongodb等,则不需要修改。 对应的映射关系可以看这个文件里面的源码。这个设置主要为了同一套代码便于切换线上和本地的数据库,并没有采用环境变量的方式存储用户密码。需要的朋友也可以自己改动。

configure/setting.py

    def config(self, db_type='mysql', local='ubuntu'):
        db_dict = self.json_data[db_type][local]
        user = db_dict['user']
        password = db_dict['password']
        host = db_dict['host']
        port = db_dict['port']
        return (user, password, host, port)

    def get_engine(self, db, type_='ubuntu'):
        from sqlalchemy import create_engine
        user, password, host, port = self.config(db_type='mysql', local=type_)
        try:
            engine = create_engine(
                'mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8'.format(user, password, host, port, db))
        except Exception as e:
            print(e)
            return None
        return engine

    def get_mysql_conn(self, db, type_='ubuntu'):
        import pymysql
        user, password, host, port = self.config(db_type='mysql', local=type_)
        try:
            conn = pymysql.connect(host=host, port=port, user=user, password=password, db=db, charset='utf8')
        except Exception as e:
            print(e)
            return None
        else:
            return conn

    def mongo(self, location_type='ubuntu', async_type=False):
        user, password, host, port = self.config('mongo', location_type)
        connect_uri = f'mongodb://{user}:{password}@{host}:{port}'
        if async_type:
            from motor.motor_asyncio import AsyncIOMotorClient
            client = AsyncIOMotorClient(connect_uri)
        else:
            import pymongo
            client = pymongo.MongoClient(connect_uri)
        return client

文末有券商福利:提供券商自动化下单接口


码农的量化交易,把经历写成代码推送到github。代码和策略会一直保持更新,如果你有好的策略或者想法和疑问想要交流,可以加文末微信。

新增:

analysis 目录 数据分析部分

  • analysis/get_zt_info 分析次新板块中的涨停强度
  • analysis/diagnose_stock 股票诊断,是否有黑历史和东北股
  • analysis/ipospeed IPO发行速度 与指数的相关性
  • analysis/fd_money A股某段日期内涨停板的封单金额

fund(基金)

  • fund/LOFShareDection.py 监控LOF、ETF场内份额变动
  • fund/ark_funds.py 获取ARK ETF每日持仓数据,并写入mongodb
  • fund/fund_share_update.py 上交所,深交所 基金场内基金份额监控
  • fund/fund_share_monitor.py 上交所,深交所 基金基金份额查询,规模变动
  • fund/fund_info_spider.py 集思录基金,腾讯证券基金折价率,溢价率 爬虫
  • fund/etf_info.py 市场指数基金的持仓股监控
  • fund/ttjj.py 天天基金数据获取
  • fund/xueqiu_private_fund.py 雪球私募私募获取
  • fund/danjuan_fund.py 雪球蛋卷基金数据获取
  • fund/danjuan_fund_data_analysis.py 雪球蛋卷基金分析

datahub(数据源)

  • datahub/foreignexchange.py 美元兑人民币汇率监控
  • datahub/niwen.py 宁稳可转债下载
  • datahub/public_private_fund_members.py 公墓私募基金成员数据
  • datahub/jucao_ammouncement.py 巨潮公告批量获取+PDF下载
  • datahub/bond_industry_info.py 可转债行业分布
  • datahub/ceiling_break.py 涨停板封榜监控

k-line (K线技术形态识别)

  • k-line/recognize_form.py 通过talib识别常见形态,如三只乌鸦等

已有:

  • datahub/black_list_sql.py 记录A股市场上所有有黑历史的股票名单,并存入数据库
  • big_deal.py 监控每天A股市场上的大单交易
  • bond_monitor 可转债监控
  • ceiling_break.py 新股一直板开板后多少天能够重新回到开板价格
  • delivery_order.py 把交割单导出到Mysql,便于查找某只清仓股的操作历史痕迹,对自己的操作记录一目了然
  • fetch_each_day.py --获取每天换手率前50的热门股
  • filter_stock.py 通过不同的因子策略选股,常见的如市盈率,流通量,股东数,基金持股数等
  • foreign_exchange.py 获取美元汇率的每天走势并存入Mysql
  • get_break_high.py --获取当天破50天新高的股票。为什么不获取60天呢? 因为大家都在用,用的人多了就不准了。
  • ipospeed.py 统计每天IPO新股发行速度与大盘的相关性
  • ipo_stock.py 新股统计
  • jisilu.py 获取集思录的可转债行情
  • jubi.py -获取国内山寨币平台的实时数据
  • new_stock_break 分析新股的开板时机
  • new_stock_fund 打新基金获取,并选出中签科创板的基金
  • pledgeed_validation.py 股权质押数据整理
  • push_msn.py -短信提醒自己 设定的某个股票价格或者涨幅达到自己 要求
  • relationship_case.py 每个月的解禁股与大盘指数的关系
  • select_stock.py - 选股策略, 根据自己的经验选出来的个股。
  • SPSIOP_PRICE.py - 华宝油气估值 通过爬虫获取数据然后计算
  • stockInfo.py 爬取市场股票新闻消息,并存储到ElasticSearch数据库中
  • strategy_verify.py 获取雪球的策略并验证
  • simulation.py 记录自己的模拟仓
  • strategy_verify.py -获取雪球的即时交易策略
  • win_or_lost_each_day.py --评估自己每天每只股票的盈亏情况 完成度100%
  • zdt.py --每天股票市场的涨停热度

福利

券商量化下单接口

支持python语言,可云端部署与本地运行两种模式,支持A股市场股票,转债,基金等品种。

实盘python下单接口

接口文档

费率

交易费率低:
股票万一; 可转债万0.4;基金ETF,LOF万0.5


开通量化接口后是不收取额外费用,可永久使用。

开通条件: 不同券商门槛不同

  • 券商一:开户后入金1W可开通
  • 券商二:开户后入金2W即可开通

当然也有其他主流券商可选,华泰,广发,华宝,招商,国金,银河证券等等,基本可以涵盖主流券商。


开通方式:

扫码


注明:开户。

关注开发者公众号: 可转债量化分析


公众号

More Repositories

1

zhihuToKindle

模拟登陆知乎,获取关注问题的id下 所有答案,并推送到kindle电子书
Python
148
star
2

convertible_bond

低风险投资之可转债 可转债量化分析
Python
145
star
3

xueqiu

登录并爬取雪球上的所有文章
Python
88
star
4

getProxy

爬虫获取http://www.xicidaili.com/ 代理服务器
Python
81
star
5

StockPredict

根据东财股吧爬虫数据进行自然语言分析,展示股市热度
Python
75
star
6

red_bag

支付宝红包/淘宝领喵币/雪球红包/苏宁易购/京东/淘宝自动签到 领取金币
Jupyter Notebook
72
star
7

house

自动抓取深圳新房和二手房的成交量
Python
40
star
8

zip_crash

爆破zip密码
Python
31
star
9

ScrapyBook

精通Scrapy网络爬虫
Python
30
star
10

jsl

集思录数据
Python
29
star
11

crashWordpressPassword

暴力破解wordpress博客后台登陆密码
Python
20
star
12

CodePool

代码池
Python
17
star
13

tiantian_fund

天天基金网基金数据爬取
Python
17
star
14

scan_host

多线程端口扫描器
Python
15
star
15

fetchXitek

获取色影无忌月赛入围照片 http://photo.xitek.com/
Python
13
star
16

learning_scrapy

精通python爬虫框架scrapy源码
Python
12
star
17

zhihu_daily__kindle

抓取知乎日报 中的 大误 文章,并推送到kindle
Python
11
star
18

CrawlMan

网络爬虫集合
Python
10
star
19

jubi_api

聚币网API demo
Python
9
star
20

cnstock

从http://ggjd.cnstock.com/ 抓取股票的午间公告
Python
9
star
21

JS-Reverse

JS逆向 记录。使用密码登录的网站的加密JS代码
JavaScript
8
star
22

GolangLearning

30天学会Golang,Go从零到一
Go
8
star
23

QMT

迅投QMT python自动化交易 <持续更新>
Python
7
star
24

StockManagement

股票交易后台一体化
Python
7
star
25

videodownload_pyqt

哔哩哔哩,youtube,爱奇艺视频下载 pyqt桌面应用-简易版
Python
6
star
26

stockHelper

股市小管家 ---
Python
5
star
27

zsxq_crawler

爬取知识星球的内容
4
star
28

Collections

收集的学习资料
Jupyter Notebook
4
star
29

Go_Concurrency_Programming

《Go并发编程实战》 一书中的源码 汪明著
Go
4
star
30

jrjmarket

金融街金融数据爬虫
Python
4
star
31

social_code_validation

统一社会信用代码真伪校验
Python
4
star
32

DeepLearningCourt

【源代码】深度学习入门:基于Python的理论与实现
Python
3
star
33

WebLogin

Python
3
star
34

crack_wifi_by_android

Python
3
star
35

image_recognise

爬虫中遇到的验证码解决方案
Jupyter Notebook
3
star
36

automation_phone_script

手机自动化操作脚本
JavaScript
3
star
37

Coinstock

coinegg/vexx
Python
3
star
38

maotai

茅台抢购
Python
3
star
39

Ptrade

python 股票交易接口 文档+示例代码
2
star
40

WindowsLogsParser

Windows logs file parse and extract define record 【解析windows日志文件并过滤指定事件,解析IP为物理地址】
Python
2
star
41

securities_account

A股券商开户,港股美股券商开户数据
2
star
42

sitemap_generator

auto generate website sitemap xml file / 自动生成网站sitemap
Python
2
star
43

xcsc_tushare_trader

frequent use code snippet
Python
1
star
44

github_info

通过github API 获取用户repo,关注者,以及关注者有哪些大V
Go
1
star
45

btc_realtime

python 比特币实时行情
Python
1
star
46

bbs_sysu_content

爬取中山大学的bbs 逸仙时空的每个版块的内容,并且保存为电子书
Python
1
star
47

tdx_formula_to_python

通达信公式转python
1
star
48

BondInfoServer

可转债api接口,提供数据给ptrade使用,基于golang
Go
1
star
49

CrawlerJava

Java
1
star
50

kindle_mate

同步自己的kindle MyClipboad文件(非项目)
1
star
51

StudyRepo

学习资源
Python
1
star
52

Rockyzsu

1
star
53

wifi_stress

wifi 压力测试
Python
1
star
54

lagou

抓取拉钩网的职位
Python
1
star
55

IdentityCheck

判断身份证的合法性
Python
1
star
56

stockoverview

基于django的股市记录,净值记录
Python
1
star
57

pornhub_dl

pornhub online video download script
Python
1
star