Ejemplo n.º 1
0
 def on_time(self, timestamp):
     # 增持5000股以上
     long_df = ManagerTrading.query_data(
         start_timestamp=timestamp,
         end_timestamp=timestamp,
         filters=[ManagerTrading.volume > 5000],
         columns=[ManagerTrading.entity_id],
         order=ManagerTrading.volume.desc(),
         limit=10)
     # 减持5000股以上
     short_df = ManagerTrading.query_data(
         start_timestamp=timestamp,
         end_timestamp=timestamp,
         filters=[ManagerTrading.volume < -5000],
         columns=[ManagerTrading.entity_id],
         order=ManagerTrading.volume.asc(),
         limit=10)
     if pd_is_not_null(long_df) or pd_is_not_null(short_df):
         try:
             self.trade_the_targets(
                 due_timestamp=timestamp,
                 happen_timestamp=timestamp,
                 long_selected=set(long_df['entity_id'].to_list()),
                 short_selected=set(short_df['entity_id'].to_list()))
         except Exception as e:
             self.logger.error(e)
Ejemplo n.º 2
0
def test_000778_manager_trading():
    result: List[ManagerTrading] = ManagerTrading.query_data(region=Region.CHN, session=session,
                                                             provider=Provider.EastMoney,
                                                             return_type='domain',
                                                             codes=['000778'],
                                                             end_timestamp='2018-09-30',
                                                             start_timestamp='2017-09-30',
                                                             order=ManagerTrading.holding.desc())
    assert len(result) == 1
    assert result[0].trading_person == '巩国平'
    assert result[0].volume == 8400
    assert result[0].price is None
    assert result[0].holding == 18700
    assert result[0].trading_way == '增持'
    assert result[0].manager_position == '职工监事'
    assert result[0].manager == '巩国平'
    assert result[0].relationship_with_manager == '本人'
Ejemplo n.º 3
0
def test_000778_manager_trading():
    result: List[ManagerTrading] = ManagerTrading.query_data(
        session=session,
        provider="eastmoney",
        return_type="domain",
        codes=["000778"],
        end_timestamp="2018-09-30",
        start_timestamp="2017-09-30",
        order=ManagerTrading.holding.desc(),
    )
    assert len(result) == 1
    assert result[0].trading_person == "巩国平"
    assert result[0].volume == 8400
    assert result[0].price == None
    assert result[0].holding == 18700
    assert result[0].trading_way == "增持"
    assert result[0].manager_position == "职工监事"
    assert result[0].manager == "巩国平"
    assert result[0].relationship_with_manager == "本人"