跳轉到

Stock 類別

Stock

Bases: ObjectBase

Represents a stock.

Example
from fmd import FmdApi

fa = FmdApi()
stock = fa.stock.get(symbol='2330')

Attributes:

Name Type Description
symbol str

The symbol of the stock.

Methods:

Name Description
get_price

Retrieves the price data for the stock within the specified date range.

get_vm

Retrieves the valuation measurement data for the stock within the specified date range.

get_dividend

Retrieves the dividend data for the stock within the specified year range.

get_company

Retrieves the company profile for the stock.

get_revenue

Retrieves the revenue data for the stock within the specified date range.

get_financial_ratio

Retrieves the financial ratio data for the stock within the specified date range.

get_balance_sheet

Retrieves the balance sheet data for the stock within the specified date range.

get_income_statement

Retrieves the income statement data for the stock within the specified date range.

get_margin_balance

Retrieves the margin balance data for the stock within the specified date range.

get_institution_trade_summary

Retrieves the institution trade summary for the stock within the specified date range.

get_cash_flow_statement

Retrieves the cash flow statement data for the stock within the specified date range.

get_balance_sheet(start_year=None, start_quarter=None, end_year=None, end_quarter=None)

Retrieves the balance sheet data for the stock within the specified date range. Default data range is last 8 quarters.

Parameters:

Name Type Description Default
start_year int | None

The start year for the balance sheet data.

None
start_quarter int | None

The start quarter for the balance sheet data.

None
end_year int | None

The end year for the balance sheet data.

None
end_quarter int | None

The end quarter for the balance sheet data.

None

Returns:

Type Description
list[BalanceSheet]

A list of BalanceSheet objects containing balance sheet information.

get_cash_flow_statement(start_year=None, start_quarter=None, end_year=None, end_quarter=None)

Retrieves the cash flow statement data for the stock within the specified date range. Default data range is last 8 quarters.

Parameters:

Name Type Description Default
start_year int | None

The start year for the cash flow statement data.

None
start_quarter int | None

The start quarter for the cash flow statement data.

None
end_year int | None

The end year for the cash flow statement data.

None
end_quarter int | None

The end quarter for the cash flow statement data.

None

Returns:

Type Description
list[CashFlowStatement]

A list of CashFlowStatement objects containing cash flow statement information.

get_company()

Retrieves the company profile for the stock.

Returns:

Type Description
StockCompany

A StockCompany object containing the company's profile information.

get_dividend(start_year=None, end_year=None)

Retrieves the dividend data for the stock within the specified year range. Default data range is last 3 years.

Parameters:

Name Type Description Default
start_year int | None

The start year for the dividend data.

None
end_year int | None

The end year for the dividend data.

None

Returns:

Type Description
list[StockDividend]

A list of StockDividend objects containing dividend information.

get_financial_ratio(start_year=None, start_quarter=None, end_year=None, end_quarter=None)

Retrieves the financial ratio data for the stock within the specified date range. Default data range is last 8 quarters.

Parameters:

Name Type Description Default
start_year int | None

The start year for the financial ratio data.

None
start_quarter int | None

The start quarter for the financial ratio data.

None
end_year int | None

The end year for the financial ratio data.

None
end_quarter int | None

The end quarter for the financial ratio data.

None

Returns:

Type Description
list[FinancialRatio]

A list of FinancialRatio objects containing financial ratio information.

get_income_statement(start_year=None, start_quarter=None, end_year=None, end_quarter=None)

Retrieves the income statement data for the stock within the specified date range. Default data range is last 8 quarters.

Parameters:

Name Type Description Default
start_year int | None

The start year for the income statement data.

None
start_quarter int | None

The start quarter for the income statement data.

None
end_year int | None

The end year for the income statement data.

None
end_quarter int | None

The end quarter for the income statement data.

None

Returns:

Type Description
list[IncomeStatement]

A list of IncomeStatement objects containing income statement information.

get_institution_trade_summary(start_date=None, end_date=None)

Retrieves the institution trade summary for the stock within the specified date range. Default data range is last 30 days.

Parameters:

Name Type Description Default
start_date str | date | None

The start date for data.

None
end_date str | date | None

The end date for data.

None

Returns:

Type Description
list[StockInstitutionTradeSummary]

A list of StockInstitutionTradeSummary objects containing institutions trade summary.

get_margin_balance(start_date=None, end_date=None)

Retrieves the margin balance data for the stock within the specified date range. Default data range is last 30 days.

Parameters:

Name Type Description Default
start_date str | date | None

The start date for the data.

None
end_date str | date | None

The end date for the data.

None

Returns:

Type Description
list[StockMarginBalance]

A list of StockMarginBalance objects containing margin balance information.

get_price(start_date=None, end_date=None)

Retrieves the price data for the stock within the specified date range. Default data range is last 30 days.

Parameters:

Name Type Description Default
start_date str | date | None

The start date for the price data.

None
end_date str | date | None

The end date for the price data.

None

Returns:

Type Description
list[StockPrice]

A list of StockPrice objects containing price information.

get_revenue(start_year=None, start_month=None, end_year=None, end_month=None)

Retrieves the revenue data for the stock within the specified date range. Default data range is last 6 months.

Parameters:

Name Type Description Default
start_year int | None

The start year for the revenue data.

None
start_month int | None

The start month for the revenue data.

None
end_year int | None

The end year for the revenue data.

None
end_month int | None

The end month for the revenue data.

None

Returns:

Type Description
list[Revenue]

A list of Revenue objects containing revenue information.

get_vm(start_date=None, end_date=None)

Retrieves the valuation measurement data for the stock within the specified date range. Default data range is last 30 days.

Parameters:

Name Type Description Default
start_date str | date | None

The start date for the valuation measurement data.

None
end_date str | date | None

The end date for the valuation measurement data.

None

Returns:

Type Description
list[ValuationMeasurement]

A list of ValuationMeasurement objects containing valuation measurement information.

StockManager

Bases: ManagerBase

Manages multiple Stock objects.

Methods:

Name Description
get

Retrieves a Stock object based on the provided symbol.

get_available_list

Retrieves a list of available stocks with their profiles.

get(symbol)

Retrieves a Stock object based on the provided symbol.

Parameters:

Name Type Description Default
symbol str

The symbol of the stock to retrieve.

required

Returns:

Type Description
Stock

A Stock object corresponding to the provided symbol.

get_available_list()

Retrieves a list of available stocks with their profiles.

Returns:

Type Description
list[StockProfile]

A list of StockProfile objects containing the profile information of available stocks.