simfin-1.0.0: A library to fetch and parse financial data from the SimFin(+) API.
Copyright(c) Owen Shepherd 2022
LicenseMIT
Maintainerowen@owen.cafe
Safe HaskellNone
LanguageHaskell2010

SimFin.Plus

Description

 
Synopsis

Documentation

data SimFinContext Source #

The context needed to call every fetch* function.

data Industry general bank insurance Source #

Distinguish between different industry-specific data.

Constructors

General general 
Bank bank 
Insurance insurance 

Instances

Instances details
FromJSON IndustryCashFlows Source # 
Instance details

Defined in SimFin.Types.CashFlow

FromJSON IndustryBalanceSheets Source # 
Instance details

Defined in SimFin.Types.BalanceSheet

FromJSON IndustryProfitsAndLosses Source # 
Instance details

Defined in SimFin.Types.ProfitAndLoss

(Show general, Show bank, Show insurance) => Show (Industry general bank insurance) Source # 
Instance details

Defined in SimFin.Types.Industry

Methods

showsPrec :: Int -> Industry general bank insurance -> ShowS #

show :: Industry general bank insurance -> String #

showList :: [Industry general bank insurance] -> ShowS #

data CompanyListingRow Source #

SimFin ID and company ticker. See the SimFin docs.

Constructors

CompanyListingRow 

Fields

data CompanyInfoRow Source #

Genreal information about a company. See the SimFin docs.

data GeneralBalanceSheetRow Source #

Balance sheet statement for general companies.

Constructors

GeneralBalanceSheetRow 

Fields

data BankBalanceSheetRow Source #

Balance sheet statement for banks.

Constructors

BankBalanceSheetRow 

Fields

data InsuranceBalanceSheetRow Source #

Balance sheet statement for insurance companies.

Constructors

InsuranceBalanceSheetRow 

Fields

data GeneralProfitAndLossRow Source #

Cash flow statement for general companies.

Constructors

GeneralProfitAndLossRow 

Fields

data BankProfitAndLossRow Source #

Cash flow statement for banks.

Constructors

BankProfitAndLossRow 

Fields

data InsuranceProfitAndLossRow Source #

Cash flow statement for insurance companies.

Constructors

InsuranceProfitAndLossRow 

Fields

data GeneralCashFlowRow Source #

Cash flow statement for general companies.

Constructors

GeneralCashFlowRow 

Fields

data BankCashFlowRow Source #

Cash flow statement for banks.

Constructors

BankCashFlowRow 

Fields

data InsuranceCashFlowRow Source #

Cash flow statement for Insurance companies.

Constructors

InsuranceCashFlowRow 

Fields

data DerivedRow a Source #

Cash flow statement for general companies.

Instances

Instances details
Functor DerivedRow Source # 
Instance details

Defined in SimFin.Types.Derived

Methods

fmap :: (a -> b) -> DerivedRow a -> DerivedRow b #

(<$) :: a -> DerivedRow b -> DerivedRow a #

Show a => Show (DerivedRow a) Source # 
Instance details

Defined in SimFin.Types.Derived

(Read a, RealFrac a) => FromJSON (DerivedRow a) Source # 
Instance details

Defined in SimFin.Types.Derived

data PricesRow a Source #

Prices of a company over a single day.

Constructors

PricesRow 

Fields

Instances

Instances details
Functor PricesRow Source # 
Instance details

Defined in SimFin.Types.Prices

Methods

fmap :: (a -> b) -> PricesRow a -> PricesRow b #

(<$) :: a -> PricesRow b -> PricesRow a #

Show a => Show (PricesRow a) Source # 
Instance details

Defined in SimFin.Types.Prices

(Read a, RealFrac a) => FromJSON (PricesRow a) Source # 
Instance details

Defined in SimFin.Types.Prices

data RatiosRow a Source #

Record modelling the extra data returned by calling the share price API endpoint with the "&ratios" query parameter. See the SimFin docs.

Instances

Instances details
Functor RatiosRow Source # 
Instance details

Defined in SimFin.Types.Ratios

Methods

fmap :: (a -> b) -> RatiosRow a -> RatiosRow b #

(<$) :: a -> RatiosRow b -> RatiosRow a #

Show a => Show (RatiosRow a) Source # 
Instance details

Defined in SimFin.Types.Ratios

(Read a, RealFrac a) => FromJSON (RatiosRow a) Source # 
Instance details

Defined in SimFin.Types.Ratios

data PricesAndRatiosRow a Source #

Represents a company's prices and ratios.

Constructors

PricesAndRatiosRow 

Fields

data PricesQuery Source #

This represents all options the prices endpoint supports. Some of these parameters are only available to SimFin+ users. For free users, please use PricesQueryFree.

Instances

Instances details
Show PricesQuery Source # 
Instance details

Defined in SimFin.Types.PricesQuery

data StatementQuery Source #

This represents all options the statement endpoint supports, minus the "statement" parameter itself, which is set by simply calling the right function. Some of these parameters are only available to SimFin+ users. For free users, please use StatementQueryFree. If you provide a zero-length list for any field, the query parameter will be omitted, and the API will try to return all relevant available statements.

Instances

Instances details
Show StatementQuery Source # 
Instance details

Defined in SimFin.Types.StatementQuery

data StockRef Source #

A stock ref is a SimSin ID or a ticker.

Constructors

SimFinId Int 
Ticker Text 

Instances

Instances details
Show StockRef Source # 
Instance details

Defined in SimFin.Types.StockRef

IsString StockRef Source # 
Instance details

Defined in SimFin.Types.StockRef

data FiscalPeriod Source #

A fiscal period as understood by the SimFin API.

Constructors

Q1 
Q2 
Q3 
Q4 
H1 
H2 
FullYear 
FirstNineMonths 
SixMonths 

data ApiError Source #

Represents all the types of error the server returns, and that we can encounter on our side.

Constructors

DecodeError ByteString String

Can't turn ByteString into JSON

ParseError Value String

Can't turn JSON into result type

Other Text

Server returned '{"error": "..."}' along with a non-200 status code. This could in theory be parsed into machine-readable format, with variants such as `InvalidApiKey | RateLimited | ...`, but the API doesn't guarantee error message stability.

Instances

Instances details
Show ApiError Source # 
Instance details

Defined in SimFin.Common

FromJSON ApiError Source # 
Instance details

Defined in SimFin.Common

type ApiResult = Either ApiError Source #

The result of calling fetch* is either an error or a successful result.

createDefaultContext :: (MonadFail m, MonadIO m) => m SimFinContext Source #

Try to make a new http-client manager, and parse your api key from apiKeyEnvVariable.

fetchCompanyList :: (MonadThrow m, MonadIO m) => SimFinContext -> m (Either ApiError [CompanyListingRow]) Source #

Fetch a list of company tickers and SimFin ids. This is the only endpoint common to free and paid customers.

fetchCompanyInfo :: (MonadThrow m, MonadIO m) => SimFinContext -> NonEmpty StockRef -> m (ApiResult [CompanyInfoRow]) Source #

Fetch general company information. See the SimFin docs.

fetchBalanceSheets :: (MonadThrow m, MonadIO m) => SimFinContext -> StatementQuery -> m (ApiResult [IndustryBalanceSheet]) Source #

Fetch a company's balance sheet statements. See the SimFin docs.

fetchProfitsAndLosses :: (MonadThrow m, MonadIO m) => SimFinContext -> StatementQuery -> m (ApiResult [IndustryProfitAndLoss]) Source #

Fetch a company's profit and loss statements. See the SimFin docs.

fetchCashFlows :: (MonadThrow m, MonadIO m) => SimFinContext -> StatementQuery -> m (ApiResult [IndustryCashFlow]) Source #

Fetch a company's cash flow statements. See the SimFin docs.

fetchDerived :: (Read a, RealFrac a, MonadThrow m, MonadIO m) => SimFinContext -> StatementQuery -> m (ApiResult [DerivedRow a]) Source #

Fetch a company's derived figures. See the SimFin docs.

fetchPrices :: (Read a, RealFrac a, MonadThrow m, MonadIO m) => SimFinContext -> PricesQuery -> m (ApiResult [PricesRow a]) Source #

Fetch a company's historical share prices. See the SimFin docs.

fetchPricesAndRatios :: (Read a, RealFrac a, MonadThrow m, MonadIO m) => SimFinContext -> PricesQuery -> m (ApiResult [PricesAndRatiosRow a]) Source #

Fetch a company's historical share prices, along with key ratios. See the SimFin docs.