This platform provides a suite of tools to help users achieve following goals. The whole platform could be divided into 3 function parts
- fund data operator
- get fund data both historical and the latest.
- automatically parsing fund data and save to db
- db file/type can be set in config.json
- stragegy management
- this platform could be connected to a flask web app
- strategy could be set in config file.
- strategy verification platform/tools
- asset management
- personal virual cash/asset management, multi-users supported.
- simulate purchasing/selling fund operations.
- simulate purchasing/selling fund
- operation record is kept in db.
This package provides a suite of tool including scapping fund data, clearing data, operating data and wrapped CRUD operations.
-
get_fund.py -> Data_operator class defined a set of functions to scraping data from eastmoney
- get_one_fund() -> scrapping one fund at a certain date slot
- read_multiple() -> a subprocess called in multi-thread/multi-process scrapping
- get_funds_multi_process() -> accelerate scrapping data by multi-processes.
- get_funds_multi_thread() -> accelerate scrapping data by multi-threads.
- get_funds() -> scrapping fund by single process/single thread.
- load_fund() -> select target fund data from database.
- load_funds() -> select multiple target funds data from database.
- load_asset() -> laod user's asset from db.
- load_record() -> load purchasing/selling record data from db.
- update_fund() -> update the fund data,crud on fund in db.
- get_fund_list() -> read fund list.
- get_realtime_price() -> get the real time fund price.
-
operatefund.py -> Operator class defines a simulation of buy/sell operations.
- buy_at_date() -> purchase a certain amount of fund at the price of a specific date.
- sell_at_date() -> sell a certain amount of fund at the price of a specific date.
- sell_fund_all() -> sell all fund shares hold in hand.
- get_asset_value() -> calculate value of fund hold in hand.
-
readconfg.py -> read config file.
-
playground.py -> for unit test and trials.
-
wechat.py -> for future wechat notification function.
Some samples of strategies, jupyter note or stragegy py file.
- fixedrule.py -> define some fixed rules to decide when to buy/sell.
- SingleLSTM.ipynb -> LSTM model on predicting one fund price.
- verify.py -> back test/verify the strategy.
- AffinityCluster.ipynb -> Apply cluster algorithm on funds.
Define database schema and basice data operations.
- Fund
- fund_code
- date
- price
- accumulate
- daily_rate
- pruchase_state
- ransom_state
- dividends
- User
- userid
- password
- username
- my_cash
- Record
- userid
- fund_code
- date
- price
- accumulate
- units
- buy_sell
- Asset
- userid
- my_fund
- my_units
- my_cost
User asset/Record management page, under consturction. vue.js.
flask supported
config.json
write your strategies in ./strategies and config it in config.json
Recomand you to use conda to install or virtualenv is also a good choice.