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.Free

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

type PricesQueryFree = StockRef Source #

Represents all the parameters available to free users.

data StatementQueryFree Source #

This is a subset of the StatementQuery type, which models the parameters available to non-SimFin+ users.

Constructors

StatementQueryFree 

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 -> StockRef -> m (ApiResult (Maybe CompanyInfoRow)) Source #

Fetch general company information. See the SimFin docs.

fetchBalanceSheet :: (MonadThrow m, MonadIO m) => SimFinContext -> StatementQueryFree -> m (ApiResult (Maybe IndustryBalanceSheet)) Source #

Fetch a company's balance sheet statement. As this is the free API version, only one statement is returned. The returned statement's data is dependent on the company type. See the SimFin docs.

fetchProfitAndLoss :: (MonadThrow m, MonadIO m) => SimFinContext -> StatementQueryFree -> m (ApiResult (Maybe IndustryProfitAndLoss)) Source #

Fetch a company's profit and loss statement. As this is the free API version, only one statement is returned. The returned statement's data is dependent on the company type. See the SimFin docs.

fetchCashFlow :: (MonadThrow m, MonadIO m) => SimFinContext -> StatementQueryFree -> m (ApiResult (Maybe IndustryCashFlow)) Source #

Fetch a company's cash flow statement. As this is the free API version, only one statement is returned. The returned statement's data is dependent on the company type. See the SimFin docs.

fetchDerived :: forall m a. (Read a, RealFrac a, MonadThrow m, MonadIO m) => SimFinContext -> StatementQueryFree -> m (ApiResult (Maybe (DerivedRow a))) Source #

Fetch a company's derived figures. As this is the free API version, only one set of data is returned. See the SimFin docs.

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

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