Shortcuts

Share capital#

Security-code queries infer the market on the server and accept no market argument. Unsupported markets raise an error.

Function / class

Purpose

get_shares()

Read historical share capital

Columns and units are covered in Financials and share capital.

libfinance.get_shares(order_book_ids, start_date=None, end_date=None, fields=None, as_of=None)[source]#

Per-session share capital panel.

Parameters
  • order_book_ids – One code or a list

  • start_date – Start date; omit to begin at the first share event

  • end_date – End date; omit to run to the last event

  • fields – Which columns; omit for all

Returns

DataFrame indexed by (order_book_id, date)

Raises

ValueError – for an unknown field name or an inverted date range

Columns: total, total_a, circulation_a, non_circulation_a, free_circulation, preferred_shares. All are counts of shares.

A-shares only; US codes raise “namespace ‘shares’ has no provider for market=’us’”.

Examples

1. Every share-count field of a stock

print(lf.get_shares("600000.XSHG").head())
Output#
                          free_float_shares  issued_shares  preferred_shares  restricted_shares  shares_outstanding  tradable_shares
order_book_id date                                                                                                                  
600000.XSHG   2026-07-09       1.033437e+10   3.330584e+10               0.0                0.0                 NaN     3.330584e+10
              2026-07-10       1.033437e+10   3.330584e+10               0.0                0.0                 NaN     3.330584e+10
              2026-07-13       1.033437e+10   3.330584e+10               0.0                0.0                 NaN     3.330584e+10
              2026-07-14       1.033437e+10   3.330584e+10               0.0                0.0                 NaN     3.330584e+10
              2026-07-15       1.033437e+10   3.330584e+10               0.0                0.0                 NaN     3.330584e+10
show(lf::get_shares("600000.XSHG"));
Output#
order_book_id  date        free_float_shares  issued_shares  preferred_shares  restricted_shares  shares_outstanding  tradable_shares
600000.XSHG    2026-07-09  10334374982        33305838300    0                 0                  NaN                 33305838300
600000.XSHG    2026-07-10  10334374982        33305838300    0                 0                  NaN                 33305838300
600000.XSHG    2026-07-13  10334374982        33305838300    0                 0                  NaN                 33305838300
600000.XSHG    2026-07-14  10334374982        33305838300    0                 0                  NaN                 33305838300
600000.XSHG    2026-07-15  10334374982        33305838300    0                 0                  NaN                 33305838300
...
[61 rows x 8 columns]

2. Several stocks, a window and chosen fields

print(lf.get_shares(["000001.XSHE", "600000.XSHG"], "2024-06-24", "2024-06-28",
                    fields=["issued_shares", "tradable_shares"]))
Output#
                          issued_shares  tradable_shares
order_book_id date                                      
000001.XSHE   2024-06-24   1.940592e+10     1.940555e+10
              2024-06-25   1.940592e+10     1.940555e+10
              2024-06-26   1.940592e+10     1.940555e+10
              2024-06-27   1.940592e+10     1.940555e+10
              2024-06-28   1.940592e+10     1.940555e+10
600000.XSHG   2024-06-24   2.935218e+10     2.935218e+10
              2024-06-25   2.935218e+10     2.935218e+10
              2024-06-26   2.935218e+10     2.935218e+10
              2024-06-27   2.935218e+10     2.935218e+10
              2024-06-28   2.935218e+10     2.935218e+10
show(lf::get_shares({"000001.XSHE", "600000.XSHG"}, "2024-06-24", "2024-06-28",
                    {"issued_shares", "tradable_shares"}), 0);
Output#
order_book_id  date        issued_shares  tradable_shares
000001.XSHE    2024-06-24  19405918198    19405546950
000001.XSHE    2024-06-25  19405918198    19405546950
000001.XSHE    2024-06-26  19405918198    19405546950
000001.XSHE    2024-06-27  19405918198    19405546950
000001.XSHE    2024-06-28  19405918198    19405546950
600000.XSHG    2024-06-24  29352177224    29352177224
600000.XSHG    2024-06-25  29352177224    29352177224
600000.XSHG    2024-06-26  29352177224    29352177224
600000.XSHG    2024-06-27  29352177224    29352177224
600000.XSHG    2024-06-28  29352177224    29352177224
[10 rows x 4 columns]

3. A one-day cross-section: start equals end

print(lf.get_shares(["000001.XSHE", "600000.XSHG"], "2024-06-28", "2024-06-28",
                    fields=["tradable_shares", "free_float_shares"]))
Output#
                          tradable_shares  free_float_shares
order_book_id date                                          
000001.XSHE   2024-06-28     1.940555e+10       8.160428e+09
600000.XSHG   2024-06-28     2.935218e+10       1.080215e+10
show(lf::get_shares({"000001.XSHE", "600000.XSHG"}, "2024-06-28", "2024-06-28",
                    {"tradable_shares", "free_float_shares"}), 0);
Output#
order_book_id  date        tradable_shares  free_float_shares
000001.XSHE    2024-06-28  19405546950      8160427512
600000.XSHG    2024-06-28  29352177224      10802152115
[2 rows x 4 columns]

Output produced by docs/_shared/update_examples.py running the example scripts: data version sha256:6feda8ca, 2026-10-09. Download the example scripts: 06_shares.cpp · 06_shares.py

Reading the result: every value is in shares. A one-day query keeps both index levels; tradable shares (tradable_shares) and free float (free_float_shares) are different measures.