Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@sched.scheduled_job('cron', hour=2, minute=00)
def run():
while True:
try:
ChinaStockBalanceSheetRecorder().run()
ChinaStockIncomeStatementRecorder().run()
break
except Exception as e:
logger.exception('finance runner 1 error:{}'.format(e))
time.sleep(60)
if __name__ == '__main__':
init_log('eastmoney_balance_sheet_income_statement.log')
run()
sched.start()
sched._thread.join()
parser.add_argument('--codes', help='codes', default='EOS/USDT', nargs='+',
choices=[item for item in COIN_PAIRS])
args = parser.parse_args()
level = IntervalLevel(args.level)
exchanges = args.exchanges
if type(exchanges) != list:
exchanges = [exchanges]
codes = args.codes
if type(codes) != list:
codes = [codes]
init_log(
'coin_{}_{}_{}_kdata.log'.format('-'.join(exchanges), '-'.join(codes).replace('/', ''), args.level))
CoinKdataRecorder(exchanges=exchanges, codes=codes, level=level, real_time=True).run()
return kdata_list
else:
self.logger.warning("exchange:{} not support fetchOHLCV".format(entity.exchange))
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--exchanges', help='exchanges', default='binance', nargs='+',
choices=[item for item in COIN_EXCHANGES])
parser.add_argument('--codes', help='codes', default='EOS/USDT', nargs='+',
choices=[item for item in COIN_PAIRS])
args = parser.parse_args()
init_log('coin_tick_kdata.log')
CoinTickRecorder(codes=['EOS/USDT']).run()
df_to_db(df=df, data_schema=self.data_schema, provider=self.provider, force_update=self.force_update)
return None
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--level', help='trading level', default='1d', choices=[item.value for item in IntervalLevel])
parser.add_argument('--codes', help='codes', default=['000002'], nargs='+')
args = parser.parse_args()
level = IntervalLevel(args.level)
codes = args.codes
init_log('jq_china_stock_{}_kdata.log'.format(args.level))
ChinaStockKdataRecorder(level=level, sleeping_time=0, codes=codes).run()
self.last_timestamp = pd.Timestamp(check_date)
return df.to_dict(orient='records')
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--level', help='trading level', default='1wk', choices=[item.value for item in IntervalLevel])
parser.add_argument('--codes', help='codes', default=['000338'], nargs='+')
args = parser.parse_args()
level = IntervalLevel(args.level)
codes = args.codes
init_log('jq_china_stock_{}_kdata.log'.format(args.level))
JQChinaStockBarRecorder(level=level, sleeping_time=0, codes=codes).run()
from zvt import init_log
from zvt.factors.ma.common import cal_ma_states
logger = logging.getLogger(__name__)
sched = BackgroundScheduler()
@sched.scheduled_job('cron', hour=17, minute=0)
def run():
cal_ma_states(start='000001', end='002000')
if __name__ == '__main__':
init_log('ma_stats_runner1.log')
run()
sched.start()
sched._thread.join()
@sched.scheduled_job('cron', hour=1, minute=00)
def run():
while True:
try:
HolderTradingRecorder().run()
ManagerTradingRecorder().run()
break
except Exception as e:
logger.exception('trading runner error:{}'.format(e))
time.sleep(60)
if __name__ == '__main__':
init_log('trading.log')
run()
sched.start()
sched._thread.join()
if response_json is None or len(response_json) == 0:
return []
df = pd.DataFrame(response_json)
df.rename(columns={'day': 'timestamp'}, inplace=True)
df['timestamp'] = pd.to_datetime(df['timestamp'])
df['name'] = security_item.name
df['provider'] = 'sina'
df['level'] = param['level']
return df.to_dict(orient='records')
if __name__ == '__main__':
init_log('sina_china_etf_day_kdata.log')
ChinaETFDayKdataRecorder(level=IntervalLevel.LEVEL_1DAY).run()
# 每周6抓取周线和月线数据
@sched.scheduled_job('cron', day_of_week=5, hour=3, minute=0)
def run():
while True:
try:
JQChinaStockBarRecorder(level=IntervalLevel.LEVEL_1WEEK).run()
JQChinaStockBarRecorder(level=IntervalLevel.LEVEL_1MON).run()
break
except Exception as e:
logger.exception('joinquant bar runner error:{}'.format(e))
time.sleep(60)
if __name__ == '__main__':
init_log('joinquant_bar_runner.log')
run()
sched.start()
sched._thread.join()
else:
msg = 'no targets'
logger.info(msg)
email_action = EmailInformer()
email_action.send_message("5533061@qq.com", f'{today} 基本面 + 技术面选股结果', msg)
break
except Exception as e:
logger.exception('report3 sched error:{}'.format(e))
time.sleep(60 * 3)
if __name__ == '__main__':
init_log('report3.log')
every_day_report()
sched.start()
sched._thread.join()