how to get Hongkong stock dayline data by API?

Options
how to get Hongkong stock dayline data by API?

Best Answer

  • [Deleted User]
    [Deleted User] Newcomer
    Answer ✓

    Hi @YanHan Does this work for you?

    from datetime import datetime
    import lseg.data as ld
    ld.open_session()

    instrument = '0700.HK' # Example: Tencent Holdings Ltd
    start_date = '2023-01-01'
    end_date = '2023-12-31'

    data = ld.get_history(
    universe=[instrument],
    fields=['BID', 'ASK', 'OPEN', 'HIGH', 'LOW', 'CLOSE', 'VOLUME'],
    start=start_date,
    end=end_date,
    interval='daily'
    )

    # Close the session
    ld.close_session()

    # Display the data
    print(data)

    1728916430768.png