コード例 #1
0
def get_pledge_info(market='SZ', date='2018-06-21'):
    df_total, df_detail = stock.get_pledge_info(market, date='2018-06-21')

    data = []
    progress_bar = ProgressBar().start(max_value=len(df_detail))
    for index, row in df_detail.iterrows():
        progress_bar.update(index + 1)
        symbol = str(row['证券代码']) + '.' + market
        if market == 'SZ':
            pledge_share = float(row['待购回无限售条件证券余量'].replace(',', '')) + float(row['待购回有限售条件证券余量'].replace(',', ''))
        else:
            pledge_share = float(row['待购回余量(股/份/张)'].replace(',', ''))

        df, msg = stock.get_shareholder_structure(symbol)
        if df is None:
            # print('error occurs on ', symbol)
            continue

        total_share = float(df[df.indicator == '总股本'].iloc[0, 1].replace(',', ''))
        tradable_share = float(df[df.indicator == '流通股'].iloc[0, 1].replace(',', ''))

        data.append({'total_share': total_share, 'tradable_share': tradable_share, 'pledge_share': pledge_share,
                     'pledge_ratio': pledge_share / total_share})

    df = pd.DataFrame(data)

    return df
コード例 #2
0
ファイル: quantos.py プロジェクト: zhqagp/quantos_rpc
def get_pledge_info():
    df, msg = stock.get_pledge_info(market=request.form['market'],
                                    date=request.form['date'])
    return df.to_json(orient='table')