def do_save(self, arg): # 仅仅是为了初始化才在这里插入用户,如果想要注册用户,要到webkit底下注册 QA_Setting.client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) # 3. 股票列表存储 QA_SU_save_stock_list('ts', QA_Setting.client) # 4. 交易日期存储 QA_SU_save_trade_date_all() # 5. 股票基本面信息存储 QA_SU_save_stock_info('ts', QA_Setting.client) QA_save_stock_day_all()
def do_save(self, arg): # 仅仅是为了初始化才在这里插入用户,如果想要注册用户,要到webkit底下注册 if arg == '': print( "Usage: save all|insert_user|stock_day|stock_xdxr|stock_min|index_day|index_min|stock_list" ) else: arg = arg.split(' ') if len(arg) == 1 and arg[0] == 'all': QA_Setting.client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') QA_SU_save_stock_min('tdx') QA_SU_save_index_day('tdx') QA_SU_save_index_min('tdx') QA_SU_save_stock_list('tdx') else: for i in arg: if i == 'insert_user': if QA_Setting.client.quantaxis.user_list.find({ 'username': '******' }).count() == 0: QA_Setting.client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) else: eval("QA_SU_save_%s('tdx')" % (i))
def do_save(self, arg): # 仅仅是为了初始化才在这里插入用户,如果想要注册用户,要到webkit底下注册 if arg == '': print("Usage: \n\ save all : save stock_day/xdxr/ index_day/ stock_list \n\ save X|x : save stock_day/xdxr/min index_day/min etf_day/min stock_list/block \n\ save day : save stock_day/xdxr index_day etf_day stock_list \n\ save min : save stock_min/xdxr index_min etf_min stock_list \n\ ------------------------------------------------------------ \n\ save stock_day : save stock_day \n\ save stock_xdxr : save stock_xdxr \n\ save stock_min : save stock_min \n\ save index_day : save index_day \n\ save index_min : save index_min \n\ save etf_day : save etf_day \n\ save etf_min : save etf_min \n\ save stock_list : save stock_list \n\ save stock_block: save stock_block \n\ save stock_info : save stock_info \n\ ----------------------------------------------------------\n\ if you just want to save daily data just\n\ save all+ save stock_block+save stock_info, it about 1G data \n\ if you want to save save the fully data including min level \n\ save x + save stock_info \n \n\ @yutiansut\n\ @QUANTAXIS\n\ ") else: arg = arg.split(' ') if len(arg) == 1 and arg[0] == 'all': if QA_Setting().client.quantaxis.user_list.find({ 'username': '******' }).count() == 0: QA_Setting().client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') # QA_SU_save_stock_min('tdx') QA_SU_save_index_day('tdx') # QA_SU_save_index_min('tdx') # QA_SU_save_etf_day('tdx') # QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') # QA_SU_save_stock_block('tdx') # QA_SU_save_stock_info('tdx') elif len(arg) == 1 and arg[0] == 'day': if QA_Setting().client.quantaxis.user_list.find({ 'username': '******' }).count() == 0: QA_Setting().client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') # QA_SU_save_stock_min('tdx') QA_SU_save_index_day('tdx') # QA_SU_save_index_min('tdx') QA_SU_save_etf_day('tdx') # QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx') elif len(arg) == 1 and arg[0] == 'min': if QA_Setting().client.quantaxis.user_list.find({ 'username': '******' }).count() == 0: QA_Setting().client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) # QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') QA_SU_save_stock_min('tdx') # QA_SU_save_index_day('tdx') QA_SU_save_index_min('tdx') # QA_SU_save_etf_day('tdx') QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') # QA_SU_save_stock_block('tdx') elif len(arg) == 1 and arg[0] in ['X', 'x']: if QA_Setting().client.quantaxis.user_list.find({ 'username': '******' }).count() == 0: QA_Setting().client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') QA_SU_save_stock_min('tdx') QA_SU_save_index_day('tdx') QA_SU_save_index_min('tdx') QA_SU_save_etf_day('tdx') QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx') # QA_SU_save_stock_info('tdx') else: for i in arg: if i == 'insert_user': if QA_Setting().client.quantaxis.user_list.find({ 'username': '******' }).count() == 0: QA_Setting().client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) else: eval("QA_SU_save_%s('tdx')" % (i))
# in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import datetime from QUANTAXIS import (QA_SU_save_etf_day, QA_SU_save_index_day, QA_SU_save_stock_block, QA_SU_save_stock_day, QA_SU_save_stock_list, QA_SU_save_stock_xdxr, QA_util_log_info) QA_util_log_info('SAVE/UPDATE {}'.format(datetime.datetime.now())) QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') QA_SU_save_etf_day('tdx') QA_SU_save_index_day('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx')