diff --git a/src/__mocks__/fixtures/v3/quarter.js b/src/__mocks__/fixtures/v3/quarter.js index 6ee4525..2ea4359 100644 --- a/src/__mocks__/fixtures/v3/quarter.js +++ b/src/__mocks__/fixtures/v3/quarter.js @@ -1,187 +1,975 @@ module.exports = { - 'data': { - issued_share_num: null, - treasury_stock_num: 0.0, - ex_net_sales: 52000000000.0, - ex_operating_income: 25200000000.0, - ex_ordinary_income: null, - ex_net_income: 17090000000.0, - ex_dividend: 36.0, - dividend: null, - fiscal_year: 2018.0, - fiscal_quarter: 1.0, + data: { + ticker: '2371', company_name: '株式会社カカクコム', ceo_name: '代表取締役社長  畑 彰之介', headquarters_address: '東京都渋谷区恵比寿南三丁目5番7号', + end_date: '2018-06-30', + updated_date: '2018-08-09', + edinet_updated_date: '2018-08-09', + tdnet_updated_date: '2018-08-02', + edinet_title: '【E05350】株式会社カカクコム 四半期報告書-第22期第1四半期(平成30年4月1日-平成30年6月30日)', + tdnet_title: '【23710】株式会社カカクコム 2019年3月期 第1四半期決算短信〔IFRS〕(連結)', accounting_standard: 'IFRS', - employee_num: null, - assets: 42143000000.0, - current_assets: 28774000000.0, - cash_and_deposits: 20517000000.0, - notes_accounts_receivable: 6857000000.0, + num_of_shares: 209899293, + issued_share_num: 210605000, + treasury_stock_num: 705707, + assets: 42143000000, + current_assets: 28774000000, + cash_and_deposits: 20517000000, + trade_receivables: 6857000000, + notes_accounts_receivable: 6857000000, notes_receivable: null, accounts_receivable: null, - inventories: null, + current_securities: null, + inventories: 0, merchandise: null, work_in_process: null, raw_materials_and_supplies: null, - non_current_assets: 13369000000.0, - tangible_fixed_assets: null, - liabilities: 7737000000.0, - current_liabilities: 7132000000.0, - notes_accounts_payable: 1986000000.0, + prepaid_expenses: null, + current_dta: null, + current_allowance_doubtful_accounts: null, + non_current_assets: 13369000000, + tangible_fixed_assets: 1094000000, + buildings: null, + machineries: null, + land: null, + construction_in_progress: null, + intangible_assets: 7126000000, + good_will: null, + investments_and_other_assets: null, + investment_securities: null, + non_current_dta: null, + non_current_allowance_doubtful_accounts: null, + lease_and_guarantee_deposits: null, + liabilities: 7737000000, + debt: 487000000, + current_liabilities: 7132000000, + trade_payables: 1986000000, + notes_accounts_payable: 1986000000, accounts_payable: null, notes_payable: null, short_term_bonds_payable: null, - short_term_loans_payable: 223000000.0, + short_term_loans_payable: 223000000, commercial_papers_liabilities: null, current_lease_obligations: null, current_portion_of_long_term_loans: null, current_portion_of_bonds: null, current_portion_of_convertible_bonds: null, current_portion_of_bonds_with_subscription_rights: null, - non_current_liabilities: 605000000.0, + advances_received: null, + corporate_tax_payable: null, + non_current_liabilities: 605000000, bonds_payable: null, convertible_bonds: null, convertible_bond_type_bonds_with_subscription_rights: null, non_current_bonds_with_subscription_right: null, - long_term_loans_payable: 264000000.0, + long_term_loans_payable: 264000000, non_current_lease_obligations: null, - net_assets: 34406000000.0, - shareholders_equity: 34049000000.0, - capital_stock: 916000000.0, - retained_earnings: 33238000000.0, - treasury_stock: -1115000000.0, + non_current_dtl: null, + net_assets: 34406000000, + shareholders_equity: 34049000000, + capital_stock: 916000000, + additional_capital_stock: null, + retained_earnings: 33238000000, + treasury_stock: -1115000000, valuation_and_translation_adjustments: null, - non_controlling_interests: 357000000.0, - subscription_rights: 172000000.0, - net_sales: 12513000000.0, - cost_of_sales: 0.0, - gross_profit: 12512000000.0, - sga: 6952000000.0, - operating_income: 5560000000.0, - non_operating_income: 3000000.0, - non_operating_expenses: 31000000.0, + non_controlling_interests: 357000000, + net_sales: 12513000000, + cost_of_sales: 0, + gross_profit: 12512000000, + gross_margin: 99.99, + sga: 6952000000, + operating_income: 5560000000, + operating_margin: 44, + non_operating_income: 3000000, + interest_and_dividends_income: null, + interest_income: null, + dividends_income: null, + equity_method_income: -29000000, + non_operating_expenses: 31000000, interest_expense: null, - ordinary_income: 5533000000.0, + equity_method_loss: null, + ordinary_income: 5533000000, extraordinary_income: null, + gain_of_sales_non_current_assets: null, + gain_of_sales_investment_securities: null, extraordinary_loss: null, + loss_of_sales_non_current_assets: null, + loss_of_valuation_investment_securities: null, impairment_loss: null, - income_before_income_taxes: 5533000000.0, - income_taxes: 1997000000.0, - net_income: 3534000000.0, - operating_cash_flow: 3110000000.0, - investment_cash_flow: -525000000.0, - financial_cash_flow: -3098000000.0, - depreciation: 452000000.0, - amortization: null + income_before_income_taxes: 5533000000, + income_taxes: 1997000000, + real_corporate_tax_rate: 36.09, + net_income: 3535000000, + non_controling_interests: 1000000, + profit_loss_attributable_to_owners_of_parent: 3534000000, + net_profit_margin: 28.24, + operating_cash_flow: 3110000000, + income_before_taxes: 5533000000, + depreciation: 452000000, + amortization: null, + decrease_trade_receivables_op_cf: 755000000, + decrease_inventories_op_cf: null, + increase_trade_payables_op_cf: 250000000, + investment_cash_flow: -525000000, + purchase_of_property: -73000000, + sale_of_property: null, + purchase_of_intangible_assets: -273000000, + sale_of_intangible_assets: null, + purchase_of_non_current_assets: null, + sale_of_non_current_assets: null, + purchase_of_securities: null, + sale_of_securities: null, + purchase_of_investment_securities: -100000000, + sale_of_investment_securities: null, + lending: null, + return_of_lending: null, + financial_cash_flow: -3098000000, + net_short_term_debt: null, + long_term_debt_issuance: 150000000, + long_term_debt_repayment: -67000000, + bonds_issuance: null, + bonds_repayment: null, + share_repurchase: null, + share_sales: null, + dividend_payment: -3328000000, + cash_translation_difference: null, + free_cash_flow: null, + ex_net_sales: 52000000000, + ex_operating_income: 25200000000, + ex_ordinary_income: null, + ex_net_income: 17090000000, + dividend: null, + eps_actual: 79, + bps: 161, + ebitda_actual: 6012000000, + roe: 49.29, + real_roe: 47.72, + total_asset_turnover: 1.3, + financial_leverage: 1.24, + roa: 39.62, + roic: 49.39, + doe: 22.31, + net_sales_operating_cash_flow_ratio: 24.85, + sga_ratio: 55.56, + depreciation_gross_profit_ratio: 3.61, + r_and_d_ratio: 0.28, + interest_op_income_ratio: 0.0, + interest_coverage_ratio: null, + net_sales_progress: 24.06, + operating_income_progress: 22.06, + net_income_progress: 20.68, + cash_assets_ratio: 48.68, + cash_monthly_sales_ratio: 4.49, + accounts_receivable_turnover: 45.64, + inventory_turnover: null, + trade_payable_turnover: null, + working_capital: 4871000000, + ccc: 45.64, + tangible_fixed_assets_turnover: 50.12, + debt_assets_ratio: 1.16, + debt_monthly_sales_ratio: 0.11, + operating_cash_flow_debt_ratio: 2.66, + net_debt: -20030000000, + adjusted_debt_ratio: 21.78, + de_ratio: 0.01, + current_ratio: 403.45, + net_debt_net_income_ratio: -1.2, + equity: 33877000000, + equity_ratio: 80.39, + accrual: 424000000, + employee_num: null, + net_sales_per_employee: null, + operating_income_per_employee: null, + segment_member: null, + increase_in_properties: 346000000, + r_and_d_expenses: 35000000, + defined_benefit_asset: null, + defined_benefit_liability: null, + asset_retirement_obligations_ncl: null, + subscription_rights: 172000000, + fiscal_year: 2018, + fiscal_quarter: 1, + dividend_payout_ratio: null, + real_corp_tax_rate: 36.09 }, column_description: { - company_name: { name_jp: '社名', unit: 'なし' }, - ceo_name: { name_jp: '代表社名', unit: 'なし' }, - headquarters_address: { name_jp: '所在地', unit: 'なし' }, - accounting_standard: { name_jp: '会計基準', unit: 'なし' }, - issued_share_num: { name_jp: '発行済株式総数', unit: '株' }, - employee_num: { name_jp: '従業員数', unit: '人' }, - assets: { name_jp: '総資産', unit: '百万円' }, - current_assets: { name_jp: '流動資産', unit: '百万円' }, - cash_and_deposits: { name_jp: '現預金', unit: '百万円' }, + ticker: { + name_jp: 'ティッカー', + unit: 'なし' + }, + company_name: { + name_jp: '社名', + unit: 'なし' + }, + ceo_name: { + name_jp: '代表者名', + unit: 'なし' + }, + headquarters_address: { + name_jp: '所在地', + unit: 'なし' + }, + end_date: { + name_jp: '期末日', + unit: '日付' + }, + updated_date: { + name_jp: '更新日', + unit: '日付' + }, + edinet_updated_date: { + name_jp: 'edinet発行日', + unit: '日付' + }, + tdnet_updated_date: { + name_jp: 'tdnet発行日', + unit: '日付' + }, + edinet_title: { + name_jp: 'edinet開示資料名', + unit: 'なし' + }, + tdnet_title: { + name_jp: 'tdnet開示資料名', + unit: 'なし' + }, + accounting_standard: { + name_jp: '会計基準', + unit: 'なし' + }, + num_of_shares: { + name_jp: '株式総数', + unit: '株' + }, + issued_share_num: { + name_jp: '発行済株式総数', + unit: '株' + }, + treasury_stock_num: { + name_jp: '自己株数', + unit: '株' + }, + assets: { + name_jp: '総資産', + unit: '円' + }, + current_assets: { + name_jp: '流動資産', + unit: '円' + }, + cash_and_deposits: { + name_jp: '現預金', + unit: '円' + }, + trade_receivables: { + name_jp: '売上債権', + unit: '円' + }, notes_accounts_receivable: { - name_jp: '受取手形及び売掛金', - unit: '百万円' - }, - notes_receivable: { name_jp: '受取手形', unit: '百万円' }, - accounts_receivable: { name_jp: '売掛金', unit: '百万円' }, - inventories: { name_jp: '在庫', unit: '百万円' }, - merchandise: { name_jp: '商品', unit: '百万円' }, - work_in_process: { name_jp: '仕掛品', unit: '百万円' }, - raw_materials_and_supplies: { name_jp: '原材料', unit: '百万円' }, - non_current_assets: { name_jp: '固定資産', unit: '百万円' }, - tangible_fixed_assets: { name_jp: '有形固定資産', unit: '百万円' }, - liabilities: { name_jp: '負債', unit: '百万円' }, - current_liabilities: { name_jp: '流動負債', unit: '百万円' }, - notes_accounts_payable: { name_jp: '支払手形及び買掛金', unit: '百万円' }, - accounts_payable: { name_jp: '買掛金', unit: '百万円' }, - notes_payable: { name_jp: '支払手形', unit: '百万円' }, - short_term_bonds_payable: { name_jp: '短期社債', unit: '百万円' }, - short_term_loans_payable: { name_jp: '短期借入金', unit: '百万円' }, + name_jp: '受取手形および売掛金', + unit: '円' + }, + notes_receivable: { + name_jp: '受取手形', + unit: '円' + }, + accounts_receivable: { + name_jp: '売掛金', + unit: '円' + }, + current_securities: { + name_jp: '有価証券', + unit: '円' + }, + inventories: { + name_jp: '棚卸資産', + unit: '円' + }, + merchandise: { + name_jp: '商品', + unit: '円' + }, + work_in_process: { + name_jp: '仕掛品', + unit: '円' + }, + raw_materials_and_supplies: { + name_jp: '原材料', + unit: '円' + }, + prepaid_expenses: { + name_jp: '前払金', + unit: '円' + }, + current_dta: { + name_jp: '繰延税金資産(流動)', + unit: '円' + }, + current_allowance_doubtful_accounts: { + name_jp: '貸倒引当金', + unit: '円' + }, + non_current_assets: { + name_jp: '固定資産', + unit: '円' + }, + tangible_fixed_assets: { + name_jp: '有形固定資産', + unit: '円' + }, + buildings: { + name_jp: '建物・構築物', + unit: '円' + }, + machineries: { + name_jp: '機械・運搬具・工具', + unit: '円' + }, + land: { + name_jp: '土地', + unit: '円' + }, + construction_in_progress: { + name_jp: '建設仮勘定', + unit: '円' + }, + intangible_assets: { + name_jp: '無形固定資産', + unit: '円' + }, + good_will: { + name_jp: 'のれん', + unit: '円' + }, + investments_and_other_assets: { + name_jp: '投資その他の資産', + unit: '円' + }, + investment_securities: { + name_jp: '投資有価証券', + unit: '円' + }, + non_current_dta: { + name_jp: '繰延税金資産(固定)', + unit: '円' + }, + non_current_allowance_doubtful_accounts: { + name_jp: '貸倒引当金', + unit: '円' + }, + lease_and_guarantee_deposits: { + name_jp: '敷金および保証金', + unit: '円' + }, + liabilities: { + name_jp: '負債', + unit: '円' + }, + debt: { + name_jp: '有利子負債', + unit: '円' + }, + current_liabilities: { + name_jp: '流動負債', + unit: '円' + }, + trade_payables: { + name_jp: '仕入債務', + unit: '円' + }, + notes_accounts_payable: { + name_jp: '支払手形および買掛金', + unit: '円' + }, + accounts_payable: { + name_jp: '買掛金', + unit: '円' + }, + notes_payable: { + name_jp: '支払手形', + unit: '円' + }, + short_term_bonds_payable: { + name_jp: '短期社債', + unit: '円' + }, + short_term_loans_payable: { + name_jp: '短期借入金', + unit: '円' + }, commercial_papers_liabilities: { name_jp: 'コマーシャルペーパー', - unit: '百万円' + unit: '円' }, current_lease_obligations: { name_jp: 'リース債務(流動負債)', - unit: '百万円' + unit: '円' }, current_portion_of_long_term_loans: { name_jp: '1年以内返済の長期借入金', - unit: '百万円' + unit: '円' + }, + current_portion_of_bonds: { + name_jp: '1年以内返済の社債', + unit: '円' }, - current_portion_of_bonds: { name_jp: '1年以内返済の社債', unit: '百万円' }, current_portion_of_convertible_bonds: { name_jp: '1年以内返済の転換社債', - unit: '百万円' + unit: '円' }, current_portion_of_bonds_with_subscription_rights: { name_jp: '1年以内返済の新株予約権付社債', - unit: '百万円' + unit: '円' + }, + advances_received: { + name_jp: '前受金', + unit: '円' + }, + corporate_tax_payable: { + name_jp: '未払法人税等', + unit: '円' + }, + non_current_liabilities: { + name_jp: '固定負債', + unit: '円' + }, + bonds_payable: { + name_jp: '社債', + unit: '円' + }, + convertible_bonds: { + name_jp: '転換社債', + unit: '円' }, - non_current_liabilities: { name_jp: '固定負債', unit: '百万円' }, - bonds_payable: { name_jp: '社債', unit: '百万円' }, - convertible_bonds: { name_jp: '転換社債', unit: '百万円' }, convertible_bond_type_bonds_with_subscription_rights: { name_jp: '新株予約権付転換社債', - unit: '百万円' + unit: '円' }, non_current_bonds_with_subscription_right: { name_jp: '新株予約権付社債', - unit: '百万円' + unit: '円' + }, + long_term_loans_payable: { + name_jp: '長期借入金', + unit: '円' }, - long_term_loans_payable: { name_jp: '長期借入金', unit: '百万円' }, non_current_lease_obligations: { name_jp: 'リース債務(固定負債)', - unit: '百万円' + unit: '円' + }, + non_current_dtl: { + name_jp: '繰延税金負債(固定)', + unit: '円' + }, + net_assets: { + name_jp: '純資産', + unit: '円' + }, + shareholders_equity: { + name_jp: '株主資本', + unit: '円' + }, + capital_stock: { + name_jp: '資本金', + unit: '円' + }, + additional_capital_stock: { + name_jp: '資本剰余金', + unit: '円' + }, + retained_earnings: { + name_jp: '利益剰余金', + unit: '円' + }, + treasury_stock: { + name_jp: '自己株式', + unit: '円' }, - net_assets: { name_jp: '純資産', unit: '百万円' }, - shareholders_equity: { name_jp: '株主資本', unit: '百万円' }, - capital_stock: { name_jp: '資本金', unit: '百万円' }, - retained_earnings: { name_jp: '利益剰余金', unit: '百万円' }, - treasury_stock: { name_jp: '自己株式', unit: '百万円' }, valuation_and_translation_adjustments: { name_jp: '評価換算差額等', - unit: '百万円' - }, - non_controlling_interests: { name_jp: '非支配持分', unit: '百万円' }, - subscription_rights: { name_jp: '新株予約権', unit: '百万円' }, - net_sales_summary: { name_jp: '売上', unit: '百万円' }, - net_sales: { name_jp: '売上', unit: '百万円' }, - cost_of_sales: { name_jp: '売上原価', unit: '百万円' }, - gross_profit: { name_jp: '売上高総利益', unit: '百万円' }, - sga: { name_jp: '販売費および一般管理費', unit: '百万円' }, - operating_income: { name_jp: '営業利益', unit: '百万円' }, - non_operating_income: { name_jp: '営業外利益', unit: '百万円' }, - non_operating_expenses: { name_jp: '営業外損失', unit: '百万円' }, - interest_expense: { name_jp: '支払利息', unit: '百万円' }, - ordinary_income: { name_jp: '経常利益', unit: '百万円' }, - extraordinary_income: { name_jp: '特別利益', unit: '百万円' }, - extraordinary_loss: { name_jp: '特別損失', unit: '百万円' }, - impairment_loss: { name_jp: '減損損失', unit: '百万円' }, - income_before_income_taxes: { name_jp: '税引前当期純利益', unit: '百万円' }, - income_taxes: { name_jp: '法人税等', unit: '百万円' }, - net_income: { name_jp: '当期純利益', unit: '百万円' }, - operating_cash_flow: { name_jp: '営業キャッシュフロー', unit: '百万円' }, - investment_cash_flow: { name_jp: '投資キャッシュフロー', unit: '百万円' }, - financial_cash_flow: { name_jp: '財務キャッシュフロー', unit: '百万円' }, - depreciation: { name_jp: '減価償却費', unit: '百万円' }, - amortization: { name_jp: 'のれん償却費', unit: '百万円' }, - treasury_stock_num: { name_jp: '自己株数', unit: '株' }, - ex_net_sales: { name_jp: '売上(会予)', unit: '百万円' }, - ex_operating_income: { name_jp: '営業利益(会予)', unit: '百万円' }, - ex_ordinary_income: { name_jp: '経常利益(会予)', unit: '百万円' }, - ex_net_income: { name_jp: '当期純利益(会予)', unit: '百万円' }, - ex_dividend: { name_jp: '配当予想', unit: '円' }, - dividend: { name_jp: '配当金', unit: '円' }, - fiscal_year: { name_jp: '会計年度', unit: '年' }, - fiscal_quarter: { name_jp: '四半期', unit: 'なし' } + unit: '円' + }, + non_controlling_interests: { + name_jp: '非支配持分', + unit: '円' + }, + net_sales: { + name_jp: '売上', + unit: '円' + }, + cost_of_sales: { + name_jp: '売上原価', + unit: '円' + }, + gross_profit: { + name_jp: '売上高総利益', + unit: '円' + }, + gross_margin: { + name_jp: '売上高総利益率', + unit: '%' + }, + sga: { + name_jp: '販売費および一般管理費', + unit: '円' + }, + operating_income: { + name_jp: '営業利益', + unit: '円' + }, + operating_margin: { + name_jp: '営業利益率', + unit: '%' + }, + non_operating_income: { + name_jp: '営業外収益', + unit: '円' + }, + interest_and_dividends_income: { + name_jp: '受取利息および受取配当金', + unit: '円' + }, + interest_income: { + name_jp: '受取利息', + unit: '円' + }, + dividends_income: { + name_jp: '受取配当金', + unit: '円' + }, + equity_method_income: { + name_jp: '持分法による投資利益', + unit: '円' + }, + non_operating_expenses: { + name_jp: '営業外費用', + unit: '円' + }, + interest_expense: { + name_jp: '支払利息', + unit: '円' + }, + equity_method_loss: { + name_jp: '持分法による投資損失', + unit: '円' + }, + ordinary_income: { + name_jp: '経常利益', + unit: '円' + }, + extraordinary_income: { + name_jp: '特別利益', + unit: '円' + }, + gain_of_sales_non_current_assets: { + name_jp: '固定資産売却益', + unit: '円' + }, + gain_of_sales_investment_securities: { + name_jp: '投資有価証券売却益', + unit: '円' + }, + extraordinary_loss: { + name_jp: '特別損失', + unit: '円' + }, + loss_of_sales_non_current_assets: { + name_jp: '固定資産売却損', + unit: '円' + }, + loss_of_valuation_investment_securities: { + name_jp: '投資有価証券売却損', + unit: '円' + }, + impairment_loss: { + name_jp: '減損損失', + unit: '円' + }, + income_before_income_taxes: { + name_jp: '税引前当期純利益', + unit: '円' + }, + income_taxes: { + name_jp: '法人税等', + unit: '円' + }, + real_corporate_tax_rate: { + name_jp: '実質法人税率', + unit: '%' + }, + net_income: { + name_jp: '非支配持分控除前四半期純利益', + unit: '円' + }, + non_controling_interests: { + name_jp: '非支配株主に帰属する当期純利益', + unit: '円' + }, + profit_loss_attributable_to_owners_of_parent: { + name_jp: '親会社株主に帰属する当期純利益', + unit: '円' + }, + net_profit_margin: { + name_jp: '当期純利益率', + unit: '%' + }, + operating_cash_flow: { + name_jp: '営業キャッシュフロー', + unit: '円' + }, + income_before_taxes: { + name_jp: '税金等調整前当期純利益', + unit: '円' + }, + depreciation: { + name_jp: '減価償却費', + unit: '円' + }, + amortization: { + name_jp: 'のれん償却費', + unit: '円' + }, + decrease_trade_receivables_op_cf: { + name_jp: '売上債権の増減額', + unit: '円' + }, + decrease_inventories_op_cf: { + name_jp: '棚卸資産の増減額', + unit: '円' + }, + increase_trade_payables_op_cf: { + name_jp: '仕入債務の増減額', + unit: '円' + }, + investment_cash_flow: { + name_jp: '投資キャッシュフロー', + unit: '円' + }, + purchase_of_property: { + name_jp: '有形固定資産の取得による支出', + unit: '円' + }, + sale_of_property: { + name_jp: '有形固定資産の売却による収入', + unit: '円' + }, + purchase_of_intangible_assets: { + name_jp: '無形固定資産の取得による支出', + unit: '円' + }, + sale_of_intangible_assets: { + name_jp: '無形固定資産の売却による収入', + unit: '円' + }, + purchase_of_non_current_assets: { + name_jp: '固定資産の取得による支出', + unit: '円' + }, + sale_of_non_current_assets: { + name_jp: '固定資産の売却による収入', + unit: '円' + }, + purchase_of_securities: { + name_jp: '有価証券の取得による支出', + unit: '円' + }, + sale_of_securities: { + name_jp: '有価証券の売却・償還による収入', + unit: '円' + }, + purchase_of_investment_securities: { + name_jp: '投資有価証券の取得による支出', + unit: '円' + }, + sale_of_investment_securities: { + name_jp: '投資有価証券の売却・償還による収入', + unit: '円' + }, + lending: { + name_jp: '貸付けによる支出', + unit: '円' + }, + return_of_lending: { + name_jp: '貸付金の回収による収入', + unit: '円' + }, + financial_cash_flow: { + name_jp: '財務キャッシュフロー', + unit: '円' + }, + net_short_term_debt: { + name_jp: '短期借入金の純増減額', + unit: '円' + }, + long_term_debt_issuance: { + name_jp: '長期借入れによる収入', + unit: '円' + }, + long_term_debt_repayment: { + name_jp: '長期借入金の返済による支出', + unit: '円' + }, + bonds_issuance: { + name_jp: '社債の発行による収入', + unit: '円' + }, + bonds_repayment: { + name_jp: '社債の償還による支出', + unit: '円' + }, + share_repurchase: { + name_jp: '自己株式の取得による支出', + unit: '円' + }, + share_sales: { + name_jp: '自己株式の売却による収入', + unit: '円' + }, + dividend_payment: { + name_jp: '配当金の支払額', + unit: '円' + }, + cash_translation_difference: { + name_jp: '現金及び現金同等物に係る換算差額', + unit: '円' + }, + free_cash_flow: { + name_jp: 'フリーキャッシュフロー', + unit: '円' + }, + ex_net_sales: { + name_jp: '売上(会社予想)', + unit: '円' + }, + ex_operating_income: { + name_jp: '営業利益(会社予想)', + unit: '円' + }, + ex_ordinary_income: { + name_jp: '経常利益(会社予想)', + unit: '円' + }, + ex_net_income: { + name_jp: '当期純利益(会社予想)', + unit: '円' + }, + dividend: { + name_jp: '配当金(実績)', + unit: '円' + }, + eps_actual: { + name_jp: 'EPS(実績)', + unit: '円' + }, + bps: { + name_jp: 'BPS', + unit: '円' + }, + ebitda_actual: { + name_jp: 'EBITDA(実績)', + unit: '円' + }, + roe: { + name_jp: 'ROE', + unit: '%' + }, + real_roe: { + name_jp: '実質ROE', + unit: '%' + }, + total_asset_turnover: { + name_jp: '総資産回転率', + unit: '倍' + }, + financial_leverage: { + name_jp: '財務レバレッジ', + unit: '倍' + }, + roa: { + name_jp: 'ROA', + unit: '%' + }, + roic: { + name_jp: 'ROIC', + unit: '%' + }, + doe: { + name_jp: '自己資本配当率', + unit: '%' + }, + net_sales_operating_cash_flow_ratio: { + name_jp: '営業キャッシュフロー/売上比率', + unit: '%' + }, + sga_ratio: { + name_jp: '販管費/売上率', + unit: '%' + }, + depreciation_gross_profit_ratio: { + name_jp: '減価償却費/粗利比率', + unit: '%' + }, + r_and_d_ratio: { + name_jp: '研究開発費/売上比率', + unit: '%' + }, + interest_op_income_ratio: { + name_jp: '支払利息/営業利益比率', + unit: '%' + }, + interest_coverage_ratio: { + name_jp: 'インタレストカバレッジレシオ ', + unit: '倍' + }, + net_sales_progress: { + name_jp: '売上進捗率', + unit: '%' + }, + operating_income_progress: { + name_jp: '営業利益進捗率', + unit: '%' + }, + net_income_progress: { + name_jp: '純利益進捗率', + unit: '%' + }, + cash_assets_ratio: { + name_jp: '現金総資産比率', + unit: '%' + }, + cash_monthly_sales_ratio: { + name_jp: '現金売上倍率', + unit: '倍' + }, + accounts_receivable_turnover: { + name_jp: '売上債権回転期間', + unit: '日' + }, + inventory_turnover: { + name_jp: '棚卸資産回転期間', + unit: '日' + }, + trade_payable_turnover: { + name_jp: '仕入債務回転期間', + unit: '日' + }, + working_capital: { + name_jp: '運転資本', + unit: '円' + }, + ccc: { + name_jp: 'CCC', + unit: '日' + }, + tangible_fixed_assets_turnover: { + name_jp: '有形固定資産回転率', + unit: '%' + }, + debt_assets_ratio: { + name_jp: '有利子負債/総資産比率', + unit: '%' + }, + debt_monthly_sales_ratio: { + name_jp: '有利子負債/月商比率', + unit: 'ヶ月' + }, + operating_cash_flow_debt_ratio: { + name_jp: '有利子負債/営業キャッシュフロー倍率', + unit: '倍' + }, + net_debt: { + name_jp: '純有利子負債', + unit: '円' + }, + adjusted_debt_ratio: { + name_jp: '自己株式調整済負債比率', + unit: '%' + }, + de_ratio: { + name_jp: 'DE比率', + unit: '%' + }, + current_ratio: { + name_jp: '流動比率', + unit: '%' + }, + net_debt_net_income_ratio: { + name_jp: 'ネットD純利益比率', + unit: '倍' + }, + equity: { + name_jp: '自己資本', + unit: '円' + }, + equity_ratio: { + name_jp: '自己資本比率', + unit: '%' + }, + accrual: { + name_jp: 'アクルーアル ', + unit: '円' + }, + employee_num: { + name_jp: '従業員数', + unit: '人' + }, + net_sales_per_employee: { + name_jp: '従業員一人あたり売上', + unit: '円' + }, + operating_income_per_employee: { + name_jp: '従業員一人あたり営業利益', + unit: '円' + }, + segment_member: { + name_jp: 'セグメント情報', + unit: 'なし' + }, + increase_in_properties: { + name_jp: '設備投資額', + unit: '円' + }, + r_and_d_expenses: { + name_jp: '研究開発費', + unit: '円' + }, + desc_business: { + name_jp: '事業概要', + unit: 'なし' + }, + defined_benefit_asset: { + name_jp: '退職給付に係る資産', + unit: 'なし' + }, + defined_benefit_liability: { + name_jp: '退職給付に係る負債', + unit: 'なし' + }, + asset_retirement_obligations_ncl: { + name_jp: '資産除去債務', + unit: 'なし' + }, + subscription_rights: { + name_jp: '新株予約権', + unit: 'なし' + }, + fiscal_year: { + name_jp: '会計年度', + unit: 'なし' + }, + fiscal_quarter: { + name_jp: '四半期', + unit: 'なし' + }, + dividend_payout_ratio: { + name_jp: '配当性向', + unit: '%' + }, + real_corp_tax_rate: { + name_jp: '実質法人税率', + unit: '%' + } } } diff --git a/src/custom-functions/v3/bcode-quarter.test.ts b/src/custom-functions/v3/bcode-quarter.test.ts new file mode 100644 index 0000000..6b61025 --- /dev/null +++ b/src/custom-functions/v3/bcode-quarter.test.ts @@ -0,0 +1,36 @@ +import { CachingBuffettCodeApiClientV3 } from '~/api/v3/caching-client' +import { BcodeResult } from '~/custom-functions/bcode-result' +import { bcodeQuarter } from '~/custom-functions/v3/bcode-quarter' +import { YearQuarter } from '~/fiscal-periods/year-quarter' +import { YearQuarterParam } from '~/fiscal-periods/year-quarter-param' +import { QuarterCache } from '~/services/quarter-cache' + +jest.mock('~/api/v3/client', () => + jest.requireActual('~/__mocks__/api/v3/client') +) +jest.mock('~/services/company-cache', () => + jest.requireActual('~/__mocks__/services/company-cache') +) +jest.mock('~/services/quarter-cache', () => + jest.requireActual('~/__mocks__/services/quarter-cache') +) + +test('bcodeQuarter', () => { + const ticker = '2371' + const period = new YearQuarter(2018, 1) + const propertyName = 'net_sales' + + expect(QuarterCache.get(ticker, period)).toBeNull() + + const client = new CachingBuffettCodeApiClientV3('token') + const result = bcodeQuarter( + client, + ticker, + YearQuarterParam.fromYearQuarter(period), + propertyName, + false + ) + + expect(result).toEqual(new BcodeResult(12513000000, '円')) + expect(QuarterCache.get(ticker, period)).not.toBeNull() +}) diff --git a/src/custom-functions/v3/bcode-quarter.ts b/src/custom-functions/v3/bcode-quarter.ts new file mode 100644 index 0000000..98a74b8 --- /dev/null +++ b/src/custom-functions/v3/bcode-quarter.ts @@ -0,0 +1,51 @@ +import { CompanyService } from '~/api/company-service' +import { BuffettCodeApiClientV3 } from '~/api/v3/client' +import { BcodeResult } from '~/custom-functions/bcode-result' +import { + ApiResponseError, + OndemandApiNotEnabledError, + PropertyNotFoundError, + UnsupportedTickerError +} from '~/custom-functions/error' +import { Quarter } from '~/entities/v3/quarter' +import { YearQuarterParam } from '~/fiscal-periods/year-quarter-param' + +export function bcodeQuarter( + client: BuffettCodeApiClientV3, + ticker: string, + period: YearQuarterParam, + propertyName: string, + ondemandApiEnabled: boolean +): BcodeResult { + const companyService = new CompanyService(ticker, client) + if (!companyService.isSupportedTicker()) { + throw new UnsupportedTickerError() + } + + let quarter: Quarter + if (companyService.isOndemandQuarterApiPeriod(period)) { + if (!ondemandApiEnabled) { + throw new OndemandApiNotEnabledError() + } + + quarter = client.ondemandQuarter(ticker, period) + } else { + quarter = client.quarter(ticker, period) + } + + if (quarter == undefined) { + throw new ApiResponseError() + } + + const property = quarter.columnDescription[propertyName] + if (property == undefined) { + throw new PropertyNotFoundError( + `propetyName '${propertyName}' is not found.` + ) + } + + const value = quarter.data[propertyName] + const unit = property['unit'] + + return new BcodeResult(value, unit) +}