예제 #1
0
 def get_stock_1w_hfq_k_data(provider: Provider, sleep, desc, pc, lock,
                             region, batch):
     # 周线复权
     Stock1wkHfqKdata.record_data(provider=provider,
                                  share_para=(desc, pc, lock, True, region),
                                  sleeping_time=sleep,
                                  batch_size=batch)
예제 #2
0
def record_fund():
    while True:
        email_action = EmailInformer()

        try:
            # 基金和基金持仓数据
            Fund.record_data(provider='joinquant', sleeping_time=1)
            FundStock.record_data(provider='joinquant', sleeping_time=1)
            # 股票周线后复权数据
            Stock1wkHfqKdata.record_data(provider='joinquant', sleeping_time=0)

            email_action.send_message(zvt_config['email_username'], 'joinquant record fund finished', '')
            break
        except Exception as e:
            msg = f'joinquant record fund error:{e}'
            logger.exception(msg)

            email_action.send_message(zvt_config['email_username'], 'joinquant record fund error', msg)
            time.sleep(60)
예제 #3
0
                                           last_timestamp=last_timestamp)

            def generate_kdata_id(se):
                if self.level >= IntervalLevel.LEVEL_1DAY:
                    return "{}_{}".format(
                        se['entity_id'],
                        to_time_str(se['timestamp'], fmt=TIME_FORMAT_DAY))
                else:
                    return "{}_{}".format(
                        se['entity_id'],
                        to_time_str(se['timestamp'], fmt=TIME_FORMAT_ISO8601))

            df['id'] = df[['entity_id', 'timestamp']].apply(generate_kdata_id,
                                                            axis=1)

            df = df.drop_duplicates(subset='id', keep='last')

            df_to_db(df=df,
                     data_schema=self.data_schema,
                     provider=self.provider,
                     force_update=self.force_update)

        return None


if __name__ == '__main__':
    Stock1wkHfqKdata.record_data(codes=['300999'])

# the __all__ is generated
__all__ = ['JqChinaStockKdataRecorder']
예제 #4
0
                                           last_timestamp=last_timestamp)

            def generate_kdata_id(se):
                if self.level >= IntervalLevel.LEVEL_1DAY:
                    return "{}_{}".format(
                        se["entity_id"],
                        to_time_str(se["timestamp"], fmt=TIME_FORMAT_DAY))
                else:
                    return "{}_{}".format(
                        se["entity_id"],
                        to_time_str(se["timestamp"], fmt=TIME_FORMAT_ISO8601))

            df["id"] = df[["entity_id", "timestamp"]].apply(generate_kdata_id,
                                                            axis=1)

            df = df.drop_duplicates(subset="id", keep="last")

            df_to_db(df=df,
                     data_schema=self.data_schema,
                     provider=self.provider,
                     force_update=self.force_update)

        return None


if __name__ == "__main__":
    Stock1wkHfqKdata.record_data(codes=["300999"])

# the __all__ is generated
__all__ = ["JqChinaStockKdataRecorder"]