brapi-ruby-sdk 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +47 -0
- data/README.md +14 -2
- data/lib/brapi/models/balance_sheet_entry.rb +16 -4
- data/lib/brapi/models/cash_dividend.rb +17 -0
- data/lib/brapi/models/cashflow_entry.rb +25 -0
- data/lib/brapi/models/dividends_data.rb +11 -0
- data/lib/brapi/models/financial_data_entry.rb +20 -14
- data/lib/brapi/models/historical_data_price.rb +15 -0
- data/lib/brapi/models/income_statement_entry.rb +61 -0
- data/lib/brapi/models/key_statistics_entry.rb +68 -0
- data/lib/brapi/models/quote.rb +20 -15
- data/lib/brapi/models/stock_dividend.rb +16 -0
- data/lib/brapi/models/subscription.rb +22 -0
- data/lib/brapi/models/summary_profile.rb +48 -0
- data/lib/brapi/models/value_added_entry.rb +69 -0
- data/lib/brapi/version.rb +1 -1
- data/lib/brapi.rb +12 -1
- metadata +11 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 17dcaf025c1a282bf971841780365f24611ba3b4ebeb3fa7700f780a7c4b54e8
|
|
4
|
+
data.tar.gz: e754c29b797a0db5fe898252196944cfb65f5be5fcd8161690b523cdc24a1849
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e7bf7e24c594c784c2c9866d8a0cdb3cb1c71d2329ae640849d37f8ca456901e0baca13969677a8abbe3725f8c4ed0de2cecf191055530d5f1ddc0e919a4dc22
|
|
7
|
+
data.tar.gz: 3e5c26a51421088b18f7bb1b2fc989c9e068d14c04a8c4356f6ca9810b75c01a55b6f5dfa5758913316f542af47f0118ef420881e1dec05d6da9e885437cc9fc
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,53 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.0] - 2026-05-28
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Typed models for every fundamental module that `client.quote.retrieve(...)`
|
|
15
|
+
can return when `modules:` is passed:
|
|
16
|
+
- `Brapi::Models::SummaryProfile` — company profile (industry, sector,
|
|
17
|
+
website, CNPJ, business summary, employees, administrator fields).
|
|
18
|
+
- `Brapi::Models::KeyStatisticsEntry` — `defaultKeyStatistics` (TTM, single
|
|
19
|
+
object) and `defaultKeyStatisticsHistory*` (annual + quarterly arrays),
|
|
20
|
+
including special JSON keys like `52WeekChange` / `SandP52WeekChange`.
|
|
21
|
+
- `Brapi::Models::IncomeStatementEntry` — DRE entries (annual + quarterly).
|
|
22
|
+
- `Brapi::Models::CashflowEntry` — DFC entries (annual + quarterly).
|
|
23
|
+
- `Brapi::Models::ValueAddedEntry` — DVA entries (annual + quarterly).
|
|
24
|
+
- `Brapi::Models::HistoricalDataPrice` for `historical_data_price` entries
|
|
25
|
+
plus the surrounding `used_interval` / `used_range` / `valid_intervals` /
|
|
26
|
+
`valid_ranges` Quote-level fields returned when `range`/`interval` are set.
|
|
27
|
+
- `Brapi::Models::DividendsData` (returned when `dividends=true`) wrapping
|
|
28
|
+
three typed sub-models: `CashDividend`, `StockDividend`, `Subscription`.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- `Brapi::Models::Quote#summary_profile`, `#default_key_statistics`,
|
|
33
|
+
`#income_statement_history` (and quarterly), `#cashflow_history` (and
|
|
34
|
+
quarterly), `#value_added_history` (and quarterly) and `#dividends_data`
|
|
35
|
+
now return typed `Brapi::Models::*` instances instead of raw Hashes /
|
|
36
|
+
Arrays. Callers that were treating these as Hashes need to switch to
|
|
37
|
+
attribute access (`quote.summary_profile.industry` instead of
|
|
38
|
+
`quote.summary_profile["industry"]`); `Model#raw` still exposes the
|
|
39
|
+
original payload when needed.
|
|
40
|
+
- `Brapi::Models::Quote#historical_data_price` (returned when `range`/
|
|
41
|
+
`interval` is passed) now resolves to `[Brapi::Models::HistoricalDataPrice]`
|
|
42
|
+
with typed `open`/`high`/`low`/`close`/`volume`/`adjusted_close` attributes
|
|
43
|
+
instead of an Array of Hashes. Code building charts off this attribute
|
|
44
|
+
needs to switch from `entry["close"]` to `entry.close`.
|
|
45
|
+
- `Brapi::Models::BalanceSheetEntry` — fixed JSON-key mismatches for
|
|
46
|
+
`goodwill` (was looking up `goodwill`, API returns `goodWill`),
|
|
47
|
+
`other_current_liabilities` (`otherCurrentLiab`), `other_liabilities`
|
|
48
|
+
(`otherLiab`) and `total_liabilities` (`totalLiab`); added `type`,
|
|
49
|
+
`minority_interest`, `capital_surplus`. Pre-existing v0.1.0 callers that
|
|
50
|
+
read these four fields will now see actual values (they returned `nil`
|
|
51
|
+
before).
|
|
52
|
+
- `Brapi::Models::FinancialDataEntry` — adds `type`, `current_price`,
|
|
53
|
+
`earnings_growth_annual` and `revenue_growth_annual` so it can model
|
|
54
|
+
`financialDataHistory[*]` (annual + quarterly) in addition to the TTM
|
|
55
|
+
`financialData` object.
|
|
56
|
+
|
|
10
57
|
## [0.1.0] - 2026-05-28
|
|
11
58
|
|
|
12
59
|
### Added
|
data/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# brapi-ruby-sdk
|
|
2
2
|
|
|
3
|
+
[](https://github.com/romulostorel/brapi-ruby-sdk/actions/workflows/ci.yml)
|
|
4
|
+
[](https://rubygems.org/gems/brapi-ruby-sdk)
|
|
5
|
+
[](https://rubygems.org/gems/brapi-ruby-sdk)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://www.ruby-lang.org/)
|
|
8
|
+
|
|
3
9
|
Ruby SDK for the [brapi.dev](https://brapi.dev) API — Brazilian stock market quotes, cryptocurrencies, currency exchange rates, inflation (IPCA) and prime rate (SELIC) data.
|
|
4
10
|
|
|
5
11
|
This SDK provides parity with the official [brapi TypeScript](https://github.com/brapi-dev/brapi-typescript) and [brapi Python](https://github.com/brapi-dev/brapi-python) SDKs, covering 11 endpoints in v0.1.
|
|
@@ -110,8 +116,14 @@ quote.regular_market_change_percent # => -0.95
|
|
|
110
116
|
quote.market_cap # => 483937892568
|
|
111
117
|
quote.fifty_two_week_range # => "28.86 - 38.66"
|
|
112
118
|
quote.financial_data # => Brapi::Models::FinancialDataEntry
|
|
113
|
-
quote.summary_profile # =>
|
|
114
|
-
quote.
|
|
119
|
+
quote.summary_profile # => Brapi::Models::SummaryProfile
|
|
120
|
+
quote.summary_profile.industry # => "Petróleo e Gás Integrado"
|
|
121
|
+
quote.default_key_statistics # => Brapi::Models::KeyStatisticsEntry
|
|
122
|
+
quote.income_statement_history # => [Brapi::Models::IncomeStatementEntry]
|
|
123
|
+
quote.cashflow_history # => [Brapi::Models::CashflowEntry]
|
|
124
|
+
quote.value_added_history # => [Brapi::Models::ValueAddedEntry]
|
|
125
|
+
quote.historical_data_price # => [Brapi::Models::HistoricalDataPrice]
|
|
126
|
+
quote.dividends_data # => Brapi::Models::DividendsData (cash + stock + subscriptions)
|
|
115
127
|
```
|
|
116
128
|
|
|
117
129
|
### Multi-ticker
|
|
@@ -2,33 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
module Brapi
|
|
4
4
|
module Models
|
|
5
|
+
# Common fields of `balanceSheetHistory[*]` (annual) and
|
|
6
|
+
# `balanceSheetHistoryQuarterly[*]`. The full brapi payload exposes ~120
|
|
7
|
+
# accounting-specific fields (Brazilian GAAP + segment-specific rows);
|
|
8
|
+
# the SDK ships the most-used ones typed and keeps the rest available
|
|
9
|
+
# through Model#raw.
|
|
5
10
|
class BalanceSheetEntry < Brapi::Model
|
|
11
|
+
attribute :type, type: :string
|
|
6
12
|
attribute :end_date, type: :string
|
|
13
|
+
|
|
7
14
|
attribute :cash
|
|
8
15
|
attribute :short_term_investments
|
|
9
16
|
attribute :net_receivables
|
|
10
17
|
attribute :inventory
|
|
11
18
|
attribute :other_current_assets
|
|
12
19
|
attribute :total_current_assets
|
|
20
|
+
|
|
13
21
|
attribute :long_term_investments
|
|
14
22
|
attribute :property_plant_equipment
|
|
15
|
-
attribute :goodwill
|
|
23
|
+
attribute :goodwill, json_key: "goodWill"
|
|
16
24
|
attribute :intangible_assets
|
|
17
25
|
attribute :other_assets
|
|
18
26
|
attribute :total_assets
|
|
27
|
+
|
|
19
28
|
attribute :accounts_payable
|
|
20
29
|
attribute :short_long_term_debt
|
|
21
|
-
attribute :other_current_liabilities
|
|
30
|
+
attribute :other_current_liabilities, json_key: "otherCurrentLiab"
|
|
22
31
|
attribute :total_current_liabilities
|
|
23
32
|
attribute :long_term_debt
|
|
24
|
-
attribute :other_liabilities
|
|
25
|
-
attribute :total_liabilities
|
|
33
|
+
attribute :other_liabilities, json_key: "otherLiab"
|
|
34
|
+
attribute :total_liabilities, json_key: "totalLiab"
|
|
35
|
+
|
|
26
36
|
attribute :common_stock
|
|
27
37
|
attribute :retained_earnings
|
|
28
38
|
attribute :treasury_stock
|
|
29
39
|
attribute :other_stockholder_equity
|
|
30
40
|
attribute :total_stockholder_equity
|
|
31
41
|
attribute :net_tangible_assets
|
|
42
|
+
attribute :minority_interest
|
|
43
|
+
attribute :capital_surplus
|
|
32
44
|
end
|
|
33
45
|
end
|
|
34
46
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
class CashDividend < Brapi::Model
|
|
6
|
+
attribute :asset_issued, type: :string
|
|
7
|
+
attribute :payment_date, type: :time
|
|
8
|
+
attribute :rate, type: :float
|
|
9
|
+
attribute :related_to, type: :string
|
|
10
|
+
attribute :approved_on, type: :time
|
|
11
|
+
attribute :isin_code, type: :string
|
|
12
|
+
attribute :label, type: :string
|
|
13
|
+
attribute :last_date_prior, type: :time
|
|
14
|
+
attribute :remarks, type: :string
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
class CashflowEntry < Brapi::Model
|
|
6
|
+
attribute :type, type: :string
|
|
7
|
+
attribute :end_date, type: :string
|
|
8
|
+
attribute :operating_cash_flow
|
|
9
|
+
attribute :income_from_operations
|
|
10
|
+
attribute :net_income_before_taxes
|
|
11
|
+
attribute :adjustments_to_profit_or_loss
|
|
12
|
+
attribute :changes_in_assets_and_liabilities
|
|
13
|
+
attribute :other_operating_activities
|
|
14
|
+
attribute :cash_generated_in_operations
|
|
15
|
+
attribute :investment_cash_flow
|
|
16
|
+
attribute :financing_cash_flow
|
|
17
|
+
attribute :exchange_variation_without_cash
|
|
18
|
+
attribute :foreign_exchange_rate_without_cash
|
|
19
|
+
attribute :increase_or_decrease_in_cash
|
|
20
|
+
attribute :initial_cash_balance
|
|
21
|
+
attribute :final_cash_balance
|
|
22
|
+
attribute :free_cash_flow
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
class DividendsData < Brapi::Model
|
|
6
|
+
attribute :cash_dividends, type: [Brapi::Models::CashDividend]
|
|
7
|
+
attribute :stock_dividends, type: [Brapi::Models::StockDividend]
|
|
8
|
+
attribute :subscriptions, type: [Brapi::Models::Subscription]
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -2,29 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
module Brapi
|
|
4
4
|
module Models
|
|
5
|
+
# Backs both `financialData` (single TTM object, no type/end_date)
|
|
6
|
+
# and `financialDataHistory[*]` (annual/quarterly array entries).
|
|
5
7
|
class FinancialDataEntry < Brapi::Model
|
|
8
|
+
attribute :type, type: :string
|
|
6
9
|
attribute :end_date, type: :string
|
|
10
|
+
attribute :current_price, type: :float
|
|
7
11
|
attribute :total_revenue
|
|
8
|
-
attribute :revenue_per_share
|
|
12
|
+
attribute :revenue_per_share, type: :float
|
|
9
13
|
attribute :gross_profits
|
|
10
14
|
attribute :ebitda
|
|
11
15
|
attribute :operating_cashflow
|
|
12
16
|
attribute :free_cashflow
|
|
13
17
|
attribute :total_cash
|
|
14
|
-
attribute :total_cash_per_share
|
|
18
|
+
attribute :total_cash_per_share, type: :float
|
|
15
19
|
attribute :total_debt
|
|
16
|
-
attribute :debt_to_equity
|
|
17
|
-
attribute :current_ratio
|
|
18
|
-
attribute :quick_ratio
|
|
19
|
-
attribute :return_on_assets
|
|
20
|
-
attribute :return_on_equity
|
|
21
|
-
attribute :gross_margins
|
|
22
|
-
attribute :ebitda_margins
|
|
23
|
-
attribute :operating_margins
|
|
24
|
-
attribute :profit_margins
|
|
25
|
-
attribute :earnings_growth
|
|
26
|
-
attribute :revenue_growth
|
|
27
|
-
attribute :
|
|
20
|
+
attribute :debt_to_equity, type: :float
|
|
21
|
+
attribute :current_ratio, type: :float
|
|
22
|
+
attribute :quick_ratio, type: :float
|
|
23
|
+
attribute :return_on_assets, type: :float
|
|
24
|
+
attribute :return_on_equity, type: :float
|
|
25
|
+
attribute :gross_margins, type: :float
|
|
26
|
+
attribute :ebitda_margins, type: :float
|
|
27
|
+
attribute :operating_margins, type: :float
|
|
28
|
+
attribute :profit_margins, type: :float
|
|
29
|
+
attribute :earnings_growth, type: :float
|
|
30
|
+
attribute :revenue_growth, type: :float
|
|
31
|
+
attribute :earnings_growth_annual, type: :float
|
|
32
|
+
attribute :revenue_growth_annual, type: :float
|
|
33
|
+
attribute :financial_currency, type: :string
|
|
28
34
|
end
|
|
29
35
|
end
|
|
30
36
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
class HistoricalDataPrice < Brapi::Model
|
|
6
|
+
attribute :date, type: :integer
|
|
7
|
+
attribute :open, type: :float
|
|
8
|
+
attribute :high, type: :float
|
|
9
|
+
attribute :low, type: :float
|
|
10
|
+
attribute :close, type: :float
|
|
11
|
+
attribute :volume, type: :integer
|
|
12
|
+
attribute :adjusted_close, type: :float
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
class IncomeStatementEntry < Brapi::Model
|
|
6
|
+
attribute :type, type: :string
|
|
7
|
+
attribute :end_date, type: :string
|
|
8
|
+
attribute :total_revenue
|
|
9
|
+
attribute :cost_of_revenue
|
|
10
|
+
attribute :gross_profit
|
|
11
|
+
attribute :research_development
|
|
12
|
+
attribute :selling_general_administrative
|
|
13
|
+
attribute :non_recurring
|
|
14
|
+
attribute :other_operating_expenses
|
|
15
|
+
attribute :total_operating_expenses
|
|
16
|
+
attribute :operating_income
|
|
17
|
+
attribute :total_other_income_expense_net
|
|
18
|
+
attribute :ebit
|
|
19
|
+
attribute :interest_expense
|
|
20
|
+
attribute :income_before_tax
|
|
21
|
+
attribute :income_tax_expense
|
|
22
|
+
attribute :minority_interest
|
|
23
|
+
attribute :net_income_from_continuing_ops
|
|
24
|
+
attribute :discontinued_operations
|
|
25
|
+
attribute :extraordinary_items
|
|
26
|
+
attribute :effect_of_accounting_charges
|
|
27
|
+
attribute :other_items
|
|
28
|
+
attribute :net_income
|
|
29
|
+
attribute :net_income_applicable_to_common_shares
|
|
30
|
+
attribute :sales_expenses
|
|
31
|
+
attribute :losses_due_to_non_recoverability_of_assets
|
|
32
|
+
attribute :other_operating_income
|
|
33
|
+
attribute :equity_income_result
|
|
34
|
+
attribute :financial_result
|
|
35
|
+
attribute :financial_income
|
|
36
|
+
attribute :financial_expenses
|
|
37
|
+
attribute :current_taxes
|
|
38
|
+
attribute :deferred_taxes
|
|
39
|
+
attribute :income_before_statutory_participations_and_contributions
|
|
40
|
+
attribute :basic_earnings_per_common_share, type: :float
|
|
41
|
+
attribute :diluted_earnings_per_common_share, type: :float
|
|
42
|
+
attribute :basic_earnings_per_preferred_share, type: :float
|
|
43
|
+
attribute :profit_sharing_and_statutory_contributions
|
|
44
|
+
attribute :diluted_earnings_per_preferred_share, type: :float
|
|
45
|
+
attribute :claims_and_operations_costs
|
|
46
|
+
attribute :administrative_costs
|
|
47
|
+
attribute :other_operating_income_and_expenses
|
|
48
|
+
attribute :earnings_per_share, type: :float
|
|
49
|
+
attribute :basic_earnings_per_share, type: :float
|
|
50
|
+
attribute :diluted_earnings_per_share, type: :float
|
|
51
|
+
attribute :insurance_operations
|
|
52
|
+
attribute :reinsurance_operations
|
|
53
|
+
attribute :complementary_pension_operations
|
|
54
|
+
attribute :capitalization_operations
|
|
55
|
+
attribute :clean_ebit
|
|
56
|
+
attribute :clean_ebitda
|
|
57
|
+
attribute :clean_nopat
|
|
58
|
+
attribute :clean_net_income
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
# Used for both `defaultKeyStatistics` (single TTM object, no type/end_date)
|
|
6
|
+
# and `defaultKeyStatisticsHistory[*]` (array of annual entries) and the
|
|
7
|
+
# quarterly variant. Fields not present in a given payload come back nil.
|
|
8
|
+
class KeyStatisticsEntry < Brapi::Model
|
|
9
|
+
attribute :type, type: :string
|
|
10
|
+
attribute :end_date, type: :string
|
|
11
|
+
attribute :price_hint
|
|
12
|
+
attribute :price
|
|
13
|
+
attribute :enterprise_value
|
|
14
|
+
attribute :forward_pe, type: :float, json_key: "forwardPE"
|
|
15
|
+
attribute :profit_margins, type: :float
|
|
16
|
+
attribute :float_shares
|
|
17
|
+
attribute :shares_outstanding
|
|
18
|
+
attribute :shares_short
|
|
19
|
+
attribute :shares_short_prior_month
|
|
20
|
+
attribute :shares_short_previous_month_date
|
|
21
|
+
attribute :date_short_interest
|
|
22
|
+
attribute :shares_percent_shares_out, type: :float
|
|
23
|
+
attribute :held_percent_insiders, type: :float
|
|
24
|
+
attribute :held_percent_institutions, type: :float
|
|
25
|
+
attribute :short_ratio, type: :float
|
|
26
|
+
attribute :short_percent_of_float, type: :float
|
|
27
|
+
attribute :beta, type: :float
|
|
28
|
+
attribute :implied_shares_outstanding
|
|
29
|
+
attribute :category, type: :string
|
|
30
|
+
attribute :book_value, type: :float
|
|
31
|
+
attribute :price_to_book, type: :float
|
|
32
|
+
attribute :fund_family, type: :string
|
|
33
|
+
attribute :legal_type, type: :string
|
|
34
|
+
attribute :last_fiscal_year_end
|
|
35
|
+
attribute :next_fiscal_year_end
|
|
36
|
+
attribute :most_recent_quarter
|
|
37
|
+
attribute :earnings_quarterly_growth, type: :float
|
|
38
|
+
attribute :net_income_to_common
|
|
39
|
+
attribute :trailing_eps, type: :float
|
|
40
|
+
attribute :forward_eps, type: :float
|
|
41
|
+
attribute :peg_ratio, type: :float
|
|
42
|
+
attribute :last_split_factor, type: :string
|
|
43
|
+
attribute :last_split_date
|
|
44
|
+
attribute :enterprise_to_revenue, type: :float
|
|
45
|
+
attribute :enterprise_to_ebitda, type: :float
|
|
46
|
+
attribute :fifty_two_week_change, type: :float, json_key: "52WeekChange"
|
|
47
|
+
attribute :sandp_fifty_two_week_change, type: :float, json_key: "SandP52WeekChange"
|
|
48
|
+
attribute :last_dividend_value, type: :float
|
|
49
|
+
attribute :last_dividend_date
|
|
50
|
+
attribute :ytd_return, type: :float
|
|
51
|
+
attribute :beta3_year, type: :float
|
|
52
|
+
attribute :total_assets
|
|
53
|
+
attribute :yield, type: :float
|
|
54
|
+
attribute :fund_inception_date
|
|
55
|
+
attribute :three_year_average_return, type: :float
|
|
56
|
+
attribute :five_year_average_return, type: :float
|
|
57
|
+
attribute :morning_star_overall_rating
|
|
58
|
+
attribute :morning_star_risk_rating
|
|
59
|
+
attribute :annual_report_expense_ratio, type: :float
|
|
60
|
+
attribute :last_cap_gain, type: :float
|
|
61
|
+
attribute :annual_holdings_turnover, type: :float
|
|
62
|
+
attribute :market_cap
|
|
63
|
+
attribute :trailing_pe, type: :float, json_key: "trailingPE"
|
|
64
|
+
attribute :earnings_per_share, type: :float
|
|
65
|
+
attribute :dividend_yield, type: :float
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
data/lib/brapi/models/quote.rb
CHANGED
|
@@ -34,27 +34,32 @@ module Brapi
|
|
|
34
34
|
attribute :earnings_per_share, type: :float
|
|
35
35
|
attribute :logourl, type: :string
|
|
36
36
|
|
|
37
|
-
#
|
|
38
|
-
|
|
39
|
-
attribute :summary_profile
|
|
37
|
+
# Fundamental module slots (typed)
|
|
38
|
+
attribute :summary_profile, type: Brapi::Models::SummaryProfile
|
|
40
39
|
attribute :balance_sheet_history, type: [Brapi::Models::BalanceSheetEntry]
|
|
41
40
|
attribute :balance_sheet_history_quarterly, type: [Brapi::Models::BalanceSheetEntry]
|
|
42
|
-
attribute :default_key_statistics
|
|
43
|
-
attribute :default_key_statistics_history
|
|
44
|
-
attribute :default_key_statistics_history_quarterly
|
|
45
|
-
attribute :income_statement_history
|
|
46
|
-
attribute :income_statement_history_quarterly
|
|
41
|
+
attribute :default_key_statistics, type: Brapi::Models::KeyStatisticsEntry
|
|
42
|
+
attribute :default_key_statistics_history, type: [Brapi::Models::KeyStatisticsEntry]
|
|
43
|
+
attribute :default_key_statistics_history_quarterly, type: [Brapi::Models::KeyStatisticsEntry]
|
|
44
|
+
attribute :income_statement_history, type: [Brapi::Models::IncomeStatementEntry]
|
|
45
|
+
attribute :income_statement_history_quarterly, type: [Brapi::Models::IncomeStatementEntry]
|
|
47
46
|
attribute :financial_data, type: Brapi::Models::FinancialDataEntry
|
|
48
47
|
attribute :financial_data_history, type: [Brapi::Models::FinancialDataEntry]
|
|
49
48
|
attribute :financial_data_history_quarterly, type: [Brapi::Models::FinancialDataEntry]
|
|
50
|
-
attribute :value_added_history
|
|
51
|
-
attribute :value_added_history_quarterly
|
|
52
|
-
attribute :cashflow_history
|
|
53
|
-
attribute :cashflow_history_quarterly
|
|
49
|
+
attribute :value_added_history, type: [Brapi::Models::ValueAddedEntry]
|
|
50
|
+
attribute :value_added_history_quarterly, type: [Brapi::Models::ValueAddedEntry]
|
|
51
|
+
attribute :cashflow_history, type: [Brapi::Models::CashflowEntry]
|
|
52
|
+
attribute :cashflow_history_quarterly, type: [Brapi::Models::CashflowEntry]
|
|
54
53
|
|
|
55
|
-
# Historical price data when `range`/`interval` are passed.
|
|
56
|
-
attribute :
|
|
57
|
-
attribute :
|
|
54
|
+
# Historical price data — returned when `range`/`interval` are passed.
|
|
55
|
+
attribute :used_interval, type: :string
|
|
56
|
+
attribute :used_range, type: :string
|
|
57
|
+
attribute :valid_intervals
|
|
58
|
+
attribute :valid_ranges
|
|
59
|
+
attribute :historical_data_price, type: [Brapi::Models::HistoricalDataPrice]
|
|
60
|
+
|
|
61
|
+
# Dividends — returned when `dividends=true`.
|
|
62
|
+
attribute :dividends_data, type: Brapi::Models::DividendsData
|
|
58
63
|
end
|
|
59
64
|
end
|
|
60
65
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
class StockDividend < Brapi::Model
|
|
6
|
+
attribute :asset_issued, type: :string
|
|
7
|
+
attribute :factor, type: :float
|
|
8
|
+
attribute :complete_factor, type: :string
|
|
9
|
+
attribute :approved_on, type: :time
|
|
10
|
+
attribute :isin_code, type: :string
|
|
11
|
+
attribute :label, type: :string
|
|
12
|
+
attribute :last_date_prior, type: :time
|
|
13
|
+
attribute :remarks, type: :string
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
# NOTE: field list is inferred from CashDividend / StockDividend shape — the
|
|
6
|
+
# brapi `subscriptions` payload captured during v0.2 development was empty.
|
|
7
|
+
# If the live API returns different keys, attribute readers will return nil
|
|
8
|
+
# silently; `Model#raw` still exposes the original Hash. Update fields once
|
|
9
|
+
# a real payload is observed.
|
|
10
|
+
class Subscription < Brapi::Model
|
|
11
|
+
attribute :asset_issued, type: :string
|
|
12
|
+
attribute :factor, type: :float
|
|
13
|
+
attribute :price_unit, type: :float
|
|
14
|
+
attribute :approved_on, type: :time
|
|
15
|
+
attribute :isin_code, type: :string
|
|
16
|
+
attribute :label, type: :string
|
|
17
|
+
attribute :last_date_prior, type: :time
|
|
18
|
+
attribute :subscription_date, type: :time
|
|
19
|
+
attribute :remarks, type: :string
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
class SummaryProfile < Brapi::Model
|
|
6
|
+
attribute :address1, type: :string
|
|
7
|
+
attribute :address2, type: :string
|
|
8
|
+
attribute :address3, type: :string
|
|
9
|
+
attribute :city, type: :string
|
|
10
|
+
attribute :state, type: :string
|
|
11
|
+
attribute :zip, type: :string
|
|
12
|
+
attribute :country, type: :string
|
|
13
|
+
attribute :phone, type: :string
|
|
14
|
+
attribute :fax, type: :string
|
|
15
|
+
attribute :website, type: :string
|
|
16
|
+
attribute :industry, type: :string
|
|
17
|
+
attribute :industry_key, type: :string
|
|
18
|
+
attribute :industry_disp, type: :string
|
|
19
|
+
attribute :sector, type: :string
|
|
20
|
+
attribute :sector_key, type: :string
|
|
21
|
+
attribute :sector_disp, type: :string
|
|
22
|
+
attribute :long_business_summary, type: :string
|
|
23
|
+
attribute :full_time_employees, type: :integer
|
|
24
|
+
attribute :company_officers
|
|
25
|
+
attribute :twitter, type: :string
|
|
26
|
+
attribute :name, type: :string
|
|
27
|
+
attribute :start_date, type: :string
|
|
28
|
+
attribute :description, type: :string
|
|
29
|
+
attribute :logo_url, type: :string
|
|
30
|
+
attribute :cnpj, type: :string
|
|
31
|
+
|
|
32
|
+
attribute :administrator_name, type: :string
|
|
33
|
+
attribute :administrator_cnpj, type: :string
|
|
34
|
+
attribute :administrator_address, type: :string
|
|
35
|
+
attribute :administrator_address_number, type: :string
|
|
36
|
+
attribute :administrator_address_complement, type: :string
|
|
37
|
+
attribute :administrator_district, type: :string
|
|
38
|
+
attribute :administrator_city, type: :string
|
|
39
|
+
attribute :administrator_state, type: :string
|
|
40
|
+
attribute :administrator_zip_code, type: :string
|
|
41
|
+
attribute :administrator_phone1, type: :string
|
|
42
|
+
attribute :administrator_phone2, type: :string
|
|
43
|
+
attribute :administrator_phone3, type: :string
|
|
44
|
+
attribute :administrator_website, type: :string
|
|
45
|
+
attribute :administrator_email, type: :string
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
# Demonstração do Valor Adicionado (DVA).
|
|
6
|
+
class ValueAddedEntry < Brapi::Model
|
|
7
|
+
attribute :type, type: :string
|
|
8
|
+
attribute :end_date, type: :string
|
|
9
|
+
attribute :revenue
|
|
10
|
+
attribute :product_sales
|
|
11
|
+
attribute :other_revenues
|
|
12
|
+
attribute :construction_of_own_assets
|
|
13
|
+
attribute :provision_or_reversal_of_doubtful_accounts
|
|
14
|
+
attribute :supplies_purchased_from_third_parties
|
|
15
|
+
attribute :costs_with_products_sold
|
|
16
|
+
attribute :third_party_materials_and_services
|
|
17
|
+
attribute :loss_or_recovery_of_assets
|
|
18
|
+
attribute :other_supplies
|
|
19
|
+
attribute :gross_added_value
|
|
20
|
+
attribute :retentions
|
|
21
|
+
attribute :depreciation_and_amortization
|
|
22
|
+
attribute :other_retentions
|
|
23
|
+
attribute :net_added_value
|
|
24
|
+
attribute :net_added_value_produced
|
|
25
|
+
attribute :added_value_received_on_transfer
|
|
26
|
+
attribute :added_value_received_by_transfer
|
|
27
|
+
attribute :equity_income_result
|
|
28
|
+
attribute :financial_income
|
|
29
|
+
attribute :other_values_received_on_transfer
|
|
30
|
+
attribute :other_values_received_by_transfer
|
|
31
|
+
attribute :added_value_to_distribute
|
|
32
|
+
attribute :total_added_value_to_distribute
|
|
33
|
+
attribute :distribution_of_added_value
|
|
34
|
+
attribute :team_remuneration
|
|
35
|
+
attribute :taxes
|
|
36
|
+
attribute :federal_taxes
|
|
37
|
+
attribute :state_taxes
|
|
38
|
+
attribute :municipal_taxes
|
|
39
|
+
attribute :remuneration_of_third_party_capitals
|
|
40
|
+
attribute :equity_remuneration
|
|
41
|
+
attribute :own_equity_remuneration
|
|
42
|
+
attribute :interest_on_own_equity
|
|
43
|
+
attribute :dividends
|
|
44
|
+
attribute :retained_earnings_or_loss
|
|
45
|
+
attribute :non_controlling_share_of_retained_earnings
|
|
46
|
+
attribute :other_distributions
|
|
47
|
+
attribute :financial_intermediation_revenue
|
|
48
|
+
attribute :revenue_from_the_provision_of_services
|
|
49
|
+
attribute :provision_or_reversal_of_expected_credit_risk_losses
|
|
50
|
+
attribute :financial_intermediation_expenses
|
|
51
|
+
attribute :materials_energy_and_others
|
|
52
|
+
attribute :services
|
|
53
|
+
attribute :loss_or_recovery_of_asset_values
|
|
54
|
+
attribute :third_party_equity_remuneration
|
|
55
|
+
attribute :insurance_operations_revenue
|
|
56
|
+
attribute :complementary_pension_operations_revenue
|
|
57
|
+
attribute :fees_revenue
|
|
58
|
+
attribute :variations_of_technical_provisions
|
|
59
|
+
attribute :insurance_operations_variations
|
|
60
|
+
attribute :pension_operations_variations
|
|
61
|
+
attribute :other_variations
|
|
62
|
+
attribute :net_operating_revenue
|
|
63
|
+
attribute :claims_and_benefits
|
|
64
|
+
attribute :variation_in_deferred_selling_expenses
|
|
65
|
+
attribute :results_of_ceded_reinsurance_operations
|
|
66
|
+
attribute :result_of_coinsurance_operations_assigned
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
data/lib/brapi/version.rb
CHANGED
data/lib/brapi.rb
CHANGED
|
@@ -6,9 +6,20 @@ require "brapi/errors"
|
|
|
6
6
|
require "brapi/model"
|
|
7
7
|
require "brapi/resource"
|
|
8
8
|
|
|
9
|
-
# Models —
|
|
9
|
+
# Models — leaf classes first, composite classes after.
|
|
10
10
|
require "brapi/models/balance_sheet_entry"
|
|
11
11
|
require "brapi/models/financial_data_entry"
|
|
12
|
+
require "brapi/models/income_statement_entry"
|
|
13
|
+
require "brapi/models/cashflow_entry"
|
|
14
|
+
require "brapi/models/value_added_entry"
|
|
15
|
+
require "brapi/models/key_statistics_entry"
|
|
16
|
+
require "brapi/models/summary_profile"
|
|
17
|
+
require "brapi/models/historical_data_price"
|
|
18
|
+
require "brapi/models/cash_dividend"
|
|
19
|
+
require "brapi/models/stock_dividend"
|
|
20
|
+
require "brapi/models/subscription"
|
|
21
|
+
require "brapi/models/dividends_data"
|
|
22
|
+
|
|
12
23
|
require "brapi/models/quote"
|
|
13
24
|
require "brapi/models/quote_retrieve_response"
|
|
14
25
|
require "brapi/models/quote_list_item"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: brapi-ruby-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rômulo Storel
|
|
@@ -56,11 +56,20 @@ files:
|
|
|
56
56
|
- lib/brapi/model.rb
|
|
57
57
|
- lib/brapi/models/available_list_response.rb
|
|
58
58
|
- lib/brapi/models/balance_sheet_entry.rb
|
|
59
|
+
- lib/brapi/models/cash_dividend.rb
|
|
60
|
+
- lib/brapi/models/cashflow_entry.rb
|
|
61
|
+
- lib/brapi/models/dividends_data.rb
|
|
59
62
|
- lib/brapi/models/financial_data_entry.rb
|
|
63
|
+
- lib/brapi/models/historical_data_price.rb
|
|
64
|
+
- lib/brapi/models/income_statement_entry.rb
|
|
65
|
+
- lib/brapi/models/key_statistics_entry.rb
|
|
60
66
|
- lib/brapi/models/quote.rb
|
|
61
67
|
- lib/brapi/models/quote_list_item.rb
|
|
62
68
|
- lib/brapi/models/quote_list_response.rb
|
|
63
69
|
- lib/brapi/models/quote_retrieve_response.rb
|
|
70
|
+
- lib/brapi/models/stock_dividend.rb
|
|
71
|
+
- lib/brapi/models/subscription.rb
|
|
72
|
+
- lib/brapi/models/summary_profile.rb
|
|
64
73
|
- lib/brapi/models/v2/crypto.rb
|
|
65
74
|
- lib/brapi/models/v2/crypto_list_available_response.rb
|
|
66
75
|
- lib/brapi/models/v2/crypto_retrieve_response.rb
|
|
@@ -73,6 +82,7 @@ files:
|
|
|
73
82
|
- lib/brapi/models/v2/prime_rate_entry.rb
|
|
74
83
|
- lib/brapi/models/v2/prime_rate_list_available_response.rb
|
|
75
84
|
- lib/brapi/models/v2/prime_rate_retrieve_response.rb
|
|
85
|
+
- lib/brapi/models/value_added_entry.rb
|
|
76
86
|
- lib/brapi/resource.rb
|
|
77
87
|
- lib/brapi/resources/available.rb
|
|
78
88
|
- lib/brapi/resources/quote.rb
|