コード例 #1
0
    '종목', 'ROA', 'CFO', 'ROA_DIFF', 'ACCRUAL', 'LIQUID', 'MARGIN', 'TURN',
    'SUM'
])

# for cnt in range(len(code_df)):
for cnt in range(5):
    item_name = code_df.loc[cnt, 'name']
    code = code_df.loc[cnt, 'code']
    try:
        fs = FS(code)
    except KeyError:
        continue
    cnt += 1
    value_df.loc[cnt, ['종목']] = item_name
    value_df.loc[cnt, ['ROA']] = 1 if fs.get_ROA() > 0 else 0
    value_df.loc[cnt, ['CFO']] = 1 if fs.get_CFO() > 0 else 0
    value_df.loc[cnt, ['ROA_DIFF']] = 1 if fs.get_ROA_DIFF() > 0 else 0
    value_df.loc[cnt, ['ACCRUAL']] = 1 if fs.get_CFO() > fs.get_ROA() else 0
    value_df.loc[cnt, ['LIQUID']] = 1 if fs.get_LIQUID_cur(
    ) - fs.get_LIQUID_past() > 0 else 0
    value_df.loc[cnt, ['MARGIN']] = 1 if fs.get_MARGIN_cur(
    ) - fs.get_MARGIN_past() > 0 else 0
    value_df.loc[
        cnt, ['TURN']] = 1 if fs.get_TURN_cur() - fs.get_TURN_past() > 0 else 0

value_df['SUM'] = value_df[[
    'ROA', 'CFO', 'ROA_DIFF', 'ACCRUAL', 'LIQUID', 'TURN'
]].sum(axis=1)
value_df = value_df.sort_values(by=["SUM"], ascending=[False])
print(tabulate(value_df, headers='keys', tablefmt='psql'))
# print(len(value_df))
コード例 #2
0
from bs4 import BeautifulSoup
from tabulate import tabulate
from FS import FS

import requests
import pandas as pd

# for fs_list in fs_lists2:
#     print(fs_list)
#     print('')
#     print('')

code = '005930'
fs = FS(code)

print(fs.get_PER())
print(fs.get_PBR())
print(fs.get_PSR())
print(fs.get_ROA())
print(fs.get_CFO())
print(fs.get_ROA_DIFF())
print(fs.get_LIQUID())
print(fs.get_MARGIN())
print(fs.get_TURN())