Youkuang stock pool
there are some domestic software, such as great wisdom, which provides quantitative analysis, and some software which provides programmed trading of stocks and futures. But in fact, this is not a real quantitative transaction. In fact, it is very difficult to make a pure quantitative investment software suitable for indivial investors, because the quantitative strategy does not have the established and inevitable law like the traditional fundamentals and technology. He needs to cross multi-disciplinary, multi field to mine the rules of data, and then use the rules to trade. However, the potential laws of different time and space data are not consistent, so it is difficult to standardize the quantitative process
if you are a computer or math professional, you can consider using C, C + +, SQL and other languages, and other software such as MATLAB / SAS. No matter what kind of software, to achieve quantitative trading, it must need a certain modeling basis and programming basis, among which the most important thing is mathematical ability.
importnumpyasnp
start='2012-01-01'#回测起始时间
end='2016-01-01'#回测结束时间
benchmark='HS300'#策略参考标准
universe=set_universe("HS300",end)#证券池,支持股票和基金
capital_base=100000#起始资金
freq='d'#策略类型,'d'表示日间策略使用日线回测,'m'表示日内策略使用分钟线回测
refresh_rate=5#调仓频率,表示执行handle_data的时间间隔,若freq='d'时间间隔的单位为交易日,若freq='m'时间间隔为分钟
deffoo(data,dependencies=['closePrice','highPrice','lowPrice'],max_window=9):
today=(2*data['closePrice'].ix[-1]-data['lowPrice'].ix[-1]-data['highPrice'].ix[-1])/(data['closePrice'].ix[-1]-data['lowPrice'].ix[-1])
day_9=(2*data['closePrice'].ix[-9]-data['lowPrice'].ix[-9]-data['highPrice'].ix[-9])/(data['closePrice'].ix[-9]-data['lowPrice'].ix[-9])
returnday_9-today
definitialize(account):#初始化虚拟账户状态
a=Signal("worldquant_53",foo)
account.signal_generator=SignalGenerator(a)
defhandle_data(account):#每个交易日的买入卖出指令
weight=account.signal_result['worldquant_53']
weight=weight[weight>0]
weight=weight.replace([np.inf,-np.inf],np.nan).dropna()
weight=weight/weight.sum()
buy_list=weight.index
sell_list=account.valid_secpos
forstkinsell_list:
ifstknotinbuy_list:
order_to(stk,0)
total_money=account.referencePortfolioValue
prices=account.referencePrice
forstkinbuy_list:
ifstknotinprices:
continue
ifnp.isnan(prices[stk])orprices[stk]==0:#停牌或是还没有上市等原因不能交易
continue
order_num=int(total_money*weight[stk]/prices[stk]/100)*100
iforder_num<100:
order_num=100
order_to(stk,order_num)
2. Crawler development. All the network data as resources, through the automatic program for targeted data collection and processing. Crawler development project includes spanning anti crawler strategy, high-performance asynchronous IO, distributed crawler and so on, and analyzes the source code of scrapy framework, so as to understand its principle and realize the custom crawler framework
3. Web development. Web development includes two parts: front-end and back-end. The front-end takes you from "black and white" to "color" world, and develops dynamic web pages by hand; The back-end part takes you from 10 lines of code to tens of thousands of lines to implement and use your own micro web framework. The framework explanation covers the knowledge of data, components, security and other fields. You can understand its working principle from the bottom and control any mainstream web framework in the instry
4. It automation development. It operation and maintenance automation is a group of strategies that transform static equipment structure into dynamic and elastic response according to it service demand. The purpose is to rece manual intervention, rece personnel cost and error probability, and take you to develop the most commonly used projects in the enterprise, from the design level, framework selection, flexibility, scalability, fault handling, etc As well as how to optimize and other levels of contact with real and real cases from major Internet companies, such as: Fortress machine, CMDB, network monitoring, host management, etc
5. Financial analysis. Financial analysis includes the learning of financial knowledge and python related moles. It takes you from financial Xiao to the development of quantitative trading strategy. Learning content includes numpy & # 92; Pandas\ SciPy data analysis mole and other common financial analysis strategies, such as "double moving average", "weekly rule trading", "Alpaca strategy", "al thrust trading strategy", make the dream come true and it is no longer a dream to enter the financial instry
6. Artificial intelligence + machine learning. With the advent of the era of artificial intelligence, the deep machine learning course is introced first. It includes the basic concepts of machine learning and common knowledge, such as classification, clustering, regression, neural network and common class library, and according to the events around as a case, step by step through preprocessing, modeling, training, evaluation and parameters.
About self-learning python, my three biggest personal experiences are as follows:
< UL > find a simple and easy to understand tutorial with better routines, and read it from beginning to end. Don't read many books, focus on one. Type all the routines in it by hand to understand why. I was reading "concise Python tutorial", but this book is not very suitable for beginners with zero basis
find an actual project to practice. I had to learn Python because I wanted to build a website. The effect of this condition is much better than that of learning a new language. So it's best to have real projects to do. Can find a few students to do a website and so on. Note that a real project is not necessarily a commercial project. It's also a real project to write a blog website that you can only use. The key is to complete the core functions
it's better to find someone who already knows python. Ask him some advice on Learning Planning (Shang is also a way), and then ask him for advice where he is stuck. This will get twice the result with half the effort. But learn to search, learn how to ask questions better. No one is willing to help you with your homework or answer the "easy to find" question
basic introction of Python language, branches and loops, built-in data structures, functions, moles, common standard moles, file operation, exception handling, object-oriented programming, multitasking, built-in functions and debugging, permutation and combination and regular expression, advanced syntax, Linux operating system, file system and user management, file operation Network command, process management and service configuration, shell programming and Bash, source file compilation, version control, MySQL use, MySQL advanced, game project development, stage summary + assessment + resume guidance
the second stage: full stack development
HTML, CSS, JavaScript, jQuery, bootstrap, Vue, web development foundation, flash views, flash template, database operation, flusk configuration Django understanding, models, templates, views, Django advanced Django advanced, (Django rest framework, Vue + DRF), project deployment, tornado framework foundation, tornado framework advanced, elasticsearch, full stack project development, stage summary + assessment + resume guidance
the third stage: crawler
crawler and data, multithreaded crawler, scrapy framework Scrapy framework and information real-time capture, regular crawling and email monitoring, NoSQL database, scrapy redis framework, million data collection, stage summary + assessment + resume guidance
the fourth stage: artificial intelligence
data analysis basic content, data analysis mole learning, data analysis data cleaning, data analysis feature Engineering and result visualization Pyechart mole dynamic visualization, word cloud, classification algorithm, clustering algorithm, regression algorithm, association algorithm, convolution neural network, tensorflow + paddlepaddle, image recognition, stage summary + assessment + resume guidance
the fifth stage: employment guidance
employment guidance, technical guidance
the following is the whole stack course content of Python ecation for old boys: Stage 1: Python development foundation
the course content of Python development foundation includes: computer hardware, operating system principle, installation of Linux operating system, common commands for Linux operating system maintenance, introction of Python language, environment installation, basic grammar, basic data type, binary operation, process control Character coding, file processing, data type, user authentication, three-level menu program, shopping cart program development, function, built-in method, recursion, iterator, decorator, built-in method, employee information table development, cross directory import of moles, common standard library learning, B encryption; Re regular and#92; Logging mole, software development standard learning, calculator program, ATM program development, etc
stage 2: Python advanced level programming & database development
Python advanced level programming & database development course contents include: object oriented introction, features, member variables, methods, encapsulation, inheritance, polymorphism, class generation principle, metaclass__ new__ Function, abstract class, static method, class method, attribute method, how to use object-oriented thinking to write program, course selection program development, TCP / IP protocol introction, socket network socket mole learning, simple remote command execution client development, C & # 92; S architecture FTP server development, thread, process, queue, IO multi-channel model, database type, characteristics, table field type, table structure construction statement, common add delete change query statement, index, stored procere, view, trigger, transaction, grouping, aggregation, paging, connection pool, database based student management system development, etc
stage 3: front end development
front end development course content includes: HTML & # 92; CSS\ JS learning, DOM operation, jsonp, native Ajax asynchronous loading, shopping mall development, jQuery, animation effect, event, timing period, carousel map, running lantern, HTML5 & # 92; CSS3 syntax learning, bootstrap, drawer new hot list development, popular front-end framework introction, Vue architecture analysis, MVVM development idea, Vue data binding and calculation attributes, conditional rendering class and style binding, form control binding, event binding webpack use, Vue router use, vuex one-way data flow and application structure, vuex actions and mutants hot overload, vuex Vue single page project combat development
stage 4: Web Framework Development
the course content of web framework development includes: Web Framework principle analysis, web request life cycle, self-developed simple web framework, MTV & # 92; MVC framework introction, Django framework use, routing system, template engine, FBV & # 92; CBV view, models ORM, form, form validation, Django session & cookie, CSRF validation, XSS, middleware, pagination, custom tags, Django admin, cache system, signal, message, custom user authentication, memcached, redis cache learning, rabbitmq queue learning, cell distributed task queue learning, flag framework, tornado framework, restful API BBS + blog actual combat project development, etc
stage 5: crawler development
the content of crawler development course includes: requests mole, beautiful soup, selenium mole, phantom JS mole learning, landing based on requests: drawer, GitHub, Zhihu, blog Garden, crawling hook position information, developing web version of wechat, high-performance IO performance related moles: asyncio, aiohttp, grequests, twisted Custom development of an asynchronous non blocking mole, captcha image recognition, scrapy framework and source code analysis, framework components (engine, spider, downloader, Scheler, pipeline), distributed crawler combat, etc
stage 6: full stack project practice
the content of full stack project practice course includes: Internet enterprise professional development process explanation, GIT, GitHub collaborative development tools explanation, task management system explanation, interface unit test, agile development and continuous integration introction, Django + uwsgi + nginx proction environment deployment learning, interface document writing example, and so on In depth explanation of large-scale project architecture of Internet enterprises, development of CRM customer relationship management system, development of Luffy online ecation platform, etc
stage 7: data analysis
the content of data analysis course includes: introction to finance and stock knowledge, basic concepts of stock, introction to common investment tools, basic trading rules of stock market, composition of A-share, etc., analysis of various technical indicators such as K-line, average line, KDJ, MACD, etc., demonstration of development process of quantitative strategy of stock market operation simulation disk, financial quantification and python, numpy, panda Matplotlib mole common function learning online quantitative investment platform: introction and use of excellent mine, jukuan, rice basket, common quantitative strategy learning, such as double moving average strategy, factor stock selection strategy, factor stock selection strategy, small market value strategy, turtle trading rule, mean regression strategy, momentum strategy, reversal strategy, alpaca trading rule, PEG strategy, etc Develop a simple quantitative strategy platform to realize the functions of stock selection, timing, position management, profit stop and loss stop, back test results display, etc
stage 8: artificial intelligence
the course content of artificial intelligence includes: machine learning elements, common genres, natural language recognition, analysis principle word vector model word2vec, analysis and classification, clustering, decision tree, random forest, regression and neural network, test set and evaluation standard, python machine learning common library scikit learn, data preprocessing, tensorflow learning CNN and RNN model based on tensorflow, Caffe two common data sources, opencv database explanation, face recognition technology, license plate automatic extraction and masking, UAV development, keras deep learning, Bayesian model, unmanned driving simulator use and development, Tesla remote control API and automatic driving development, etc
stage 9: automatic operation and maintenance & Development
the content of the course includes: designing a CMDB asset management system that meets the actual needs of enterprises, such as the development and use of security API interface, developing clients that support windows and Linux platforms, designing and developing flexible APIs for other systems, and designing and developing business processes such as online, offline and change processes of IT assets. It audit + host management system development, real enterprise system user behavior, management authority, batch file operation, user login report, etc. Distributed host monitoring system development, monitoring multiple services, a variety of devices, alarm mechanism, based on HTTP + restful architecture development, to achieve horizontal expansion, can easily achieve distributed monitoring and other functions
stage 10: go development of high concurrency language go development course contents include: introction to the development of golang, construction of development environment, comparison between golang and other languages, detailed explanation of string, condition judgment, circulation, use of array and map data type, go program compilation and Makefile, gofmt tool, detailed explanation of godoc document generation tool, Fibonacci sequence, data and slicing Make & new, string, go program debugging, slice & map, map sorting, common standard library usage, file addition, deletion and query operation, function and object-oriented detailed explanation, concurrency, parallel and goroute, channel detailed explanation, goroute synchronization, channel, timeout and timer over capture exception, go high concurrency model, lazy generator, concurrency number control, high concurrency web server development, etc.