SinaStockMoneyFlowRecorder

class zvt.recorders.sina.money_flow.sina_stock_money_flow_recorder.SinaStockMoneyFlowRecorder(force_update=True, sleeping_time=10, exchanges=None, entity_id=None, entity_ids=None, code=None, codes=None, day_data=False, entity_filters=None, ignore_failed=True, real_time=False, fix_duplicate_way='ignore', start_timestamp=None, end_timestamp=None, level=IntervalLevel.LEVEL_1DAY, kdata_use_begin_time=False, one_day_trading_minutes=1440, return_unfinished=False)

Bases: zvt.contract.recorder.FixedCycleDataRecorder

__init__(force_update=True, sleeping_time=10, exchanges=None, entity_id=None, entity_ids=None, code=None, codes=None, day_data=False, entity_filters=None, ignore_failed=True, real_time=False, fix_duplicate_way='ignore', start_timestamp=None, end_timestamp=None, level=IntervalLevel.LEVEL_1DAY, kdata_use_begin_time=False, one_day_trading_minutes=1440, return_unfinished=False) None
Parameters
  • code

  • ignore_failed

  • entity_filters

  • exchanges

  • entity_id – for record single entity

  • entity_ids – set entity_ids or (entity_type,exchanges,codes)

  • codes

  • day_data – one record per day,set to True if you want skip recording it when data of today exist

  • force_update

  • sleeping_time

entity_schema

alias of zvt.domain.meta.stock_meta.Stock

data_schema

alias of zvt.domain.misc.money_flow.StockMoneyFlow

init_entities()

init the entities which we would record data for

get_data_map()

{‘original_field’:(‘domain_field’,transform_func)}

record(entity, start, end, size, timestamps)

implement the recording logic in this method, should return json or domain list

Parameters
  • entity

  • start

  • end

  • size

  • timestamps

clear_state_data(entity_id=None)

clear state of the entity

Parameters

entity_id – entity id

decode_state(state: str)

decode state

Parameters

state

Returns

encode_state(state: object)

encode state

Parameters

state

Returns

generate_domain(entity, original_data)

generate the data_schema instance using entity and original_data,the original_data is from record result

Parameters
  • entity

  • original_data

generate_domain_id(entity, original_data, time_fmt='YYYY-MM-DD')

generate domain id from the entity and original data,the default id meaning:entity + event happen time

Parameters
  • entity

  • original_data

  • time_fmt

Returns

Return type

get_evaluated_time_field()

the timestamp field for evaluating time range of recorder,used in get_latest_saved_record

persist(entity, domain_list)

persist the domain list to db

Parameters
  • entity

  • domain_list

state_schema

alias of zvt.contract.zvt_info.RecorderState

exchanges

setup the entities you want to record

entity_ids

set entity_ids or (entity_type,exchanges,codes)

session

using to do db operations