brapi-ruby-sdk 0.1.0 → 0.3.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 +80 -0
- data/README.md +70 -8
- data/lib/brapi/model.rb +1 -0
- 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/pagination.rb +15 -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/v2/fii.rb +54 -0
- data/lib/brapi/models/v2/fii_dividend.rb +19 -0
- data/lib/brapi/models/v2/fii_dividends_response.rb +13 -0
- data/lib/brapi/models/v2/fii_historical_response.rb +13 -0
- data/lib/brapi/models/v2/fii_history.rb +15 -0
- data/lib/brapi/models/v2/fii_indicators_response.rb +13 -0
- data/lib/brapi/models/v2/fii_list_response.rb +14 -0
- data/lib/brapi/models/v2/macro_list_available_response.rb +15 -0
- data/lib/brapi/models/v2/macro_observation.rb +12 -0
- data/lib/brapi/models/v2/macro_result.rb +14 -0
- data/lib/brapi/models/v2/macro_retrieve_response.rb +13 -0
- data/lib/brapi/models/v2/macro_series.rb +17 -0
- data/lib/brapi/models/v2/treasury_bond.rb +28 -0
- data/lib/brapi/models/v2/treasury_indicators_response.rb +13 -0
- data/lib/brapi/models/v2/treasury_list_response.rb +14 -0
- data/lib/brapi/models/v2/treasury_rate_info.rb +13 -0
- data/lib/brapi/models/value_added_entry.rb +69 -0
- data/lib/brapi/resource.rb +7 -0
- data/lib/brapi/resources/v2/fii.rb +33 -0
- data/lib/brapi/resources/v2/macro.rb +21 -0
- data/lib/brapi/resources/v2/treasury.rb +21 -0
- data/lib/brapi/resources/v2.rb +12 -0
- data/lib/brapi/version.rb +1 -1
- data/lib/brapi.rb +36 -1
- metadata +32 -2
|
@@ -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,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
# Single class backing both /api/v2/fii/list (basic info) and
|
|
7
|
+
# /api/v2/fii/indicators (basic info + current indicators).
|
|
8
|
+
# Indicator-only fields come back nil from the list endpoint.
|
|
9
|
+
class Fii < Brapi::Model
|
|
10
|
+
attribute :symbol, type: :string
|
|
11
|
+
attribute :name, type: :string
|
|
12
|
+
attribute :cnpj, type: :string
|
|
13
|
+
attribute :mandate, type: :string
|
|
14
|
+
# NOTE: brapi exposes these two fields in Portuguese (`segmentoAtuacao`,
|
|
15
|
+
# `tipoGestao`); everything else in the response uses English. If the
|
|
16
|
+
# upstream renames them in a future API revision, callers reading
|
|
17
|
+
# `#segmento_atuacao` / `#tipo_gestao` will silently get nil and need
|
|
18
|
+
# the attribute names updated here.
|
|
19
|
+
attribute :segmento_atuacao, type: :string
|
|
20
|
+
attribute :tipo_gestao, type: :string
|
|
21
|
+
attribute :segment_type, type: :string
|
|
22
|
+
|
|
23
|
+
attribute :administrator_name, type: :string
|
|
24
|
+
attribute :administrator_cnpj, type: :string
|
|
25
|
+
attribute :administrator_address, type: :string
|
|
26
|
+
attribute :administrator_address_number, type: :string
|
|
27
|
+
attribute :administrator_address_complement, type: :string
|
|
28
|
+
attribute :administrator_district, type: :string
|
|
29
|
+
attribute :administrator_city, type: :string
|
|
30
|
+
attribute :administrator_state, type: :string
|
|
31
|
+
attribute :administrator_zip_code, type: :string
|
|
32
|
+
attribute :administrator_phone1, type: :string
|
|
33
|
+
attribute :administrator_phone2, type: :string
|
|
34
|
+
attribute :administrator_phone3, type: :string
|
|
35
|
+
attribute :administrator_website, type: :string
|
|
36
|
+
attribute :administrator_email, type: :string
|
|
37
|
+
|
|
38
|
+
attribute :price, type: :float
|
|
39
|
+
attribute :nav_per_share, type: :float
|
|
40
|
+
attribute :price_to_nav, type: :float
|
|
41
|
+
attribute :dividend_yield12m, type: :float, json_key: "dividendYield12m"
|
|
42
|
+
attribute :total_investors, type: :integer
|
|
43
|
+
|
|
44
|
+
# Indicators-only fields (nil when returned by /fii/list)
|
|
45
|
+
attribute :as_of_date, type: :date
|
|
46
|
+
attribute :dividend_yield1m, type: :float, json_key: "dividendYield1m"
|
|
47
|
+
attribute :monthly_return, type: :float
|
|
48
|
+
attribute :shares_outstanding, type: :integer
|
|
49
|
+
attribute :equity
|
|
50
|
+
attribute :total_assets
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
class FiiDividend < Brapi::Model
|
|
7
|
+
attribute :symbol, type: :string
|
|
8
|
+
attribute :label, type: :string
|
|
9
|
+
attribute :rate, type: :float
|
|
10
|
+
attribute :related_to, type: :string
|
|
11
|
+
attribute :approved_on, type: :time
|
|
12
|
+
attribute :last_date_prior, type: :time
|
|
13
|
+
attribute :payment_date, type: :time
|
|
14
|
+
attribute :isin_code, type: :string
|
|
15
|
+
attribute :remarks, type: :string
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
class FiiDividendsResponse < Brapi::Model
|
|
7
|
+
attribute :dividends, type: [Brapi::Models::V2::FiiDividend]
|
|
8
|
+
attribute :requested_at, type: :time
|
|
9
|
+
attribute :took, type: :integer
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
class FiiHistoricalResponse < Brapi::Model
|
|
7
|
+
attribute :fiis, type: [Brapi::Models::V2::FiiHistory]
|
|
8
|
+
attribute :requested_at, type: :time
|
|
9
|
+
attribute :took, type: :integer
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
# Wraps a single FII's historical price series. The historical_data_price
|
|
7
|
+
# entries reuse Brapi::Models::HistoricalDataPrice (same OHLCV shape as
|
|
8
|
+
# /api/quote/{ticker}?range=...).
|
|
9
|
+
class FiiHistory < Brapi::Model
|
|
10
|
+
attribute :symbol, type: :string
|
|
11
|
+
attribute :historical_data_price, type: [Brapi::Models::HistoricalDataPrice]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
class FiiIndicatorsResponse < Brapi::Model
|
|
7
|
+
attribute :fiis, type: [Brapi::Models::V2::Fii]
|
|
8
|
+
attribute :requested_at, type: :time
|
|
9
|
+
attribute :took, type: :integer
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
class FiiListResponse < Brapi::Model
|
|
7
|
+
attribute :fiis, type: [Brapi::Models::V2::Fii]
|
|
8
|
+
attribute :pagination, type: Brapi::Models::Pagination
|
|
9
|
+
attribute :requested_at, type: :time
|
|
10
|
+
attribute :took, type: :integer
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
class MacroListAvailableResponse < Brapi::Model
|
|
7
|
+
attribute :results, type: [Brapi::Models::V2::MacroSeries]
|
|
8
|
+
attribute :categories
|
|
9
|
+
attribute :count, type: :integer
|
|
10
|
+
attribute :requested_at, type: :time
|
|
11
|
+
attribute :took, type: :integer
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
# One result entry from /api/v2/macro: a MacroSeries description plus
|
|
7
|
+
# the observation rows (date + value) for that series.
|
|
8
|
+
class MacroResult < Brapi::Model
|
|
9
|
+
attribute :series, type: Brapi::Models::V2::MacroSeries
|
|
10
|
+
attribute :observations, type: [Brapi::Models::V2::MacroObservation]
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
class MacroRetrieveResponse < Brapi::Model
|
|
7
|
+
attribute :results, type: [Brapi::Models::V2::MacroResult]
|
|
8
|
+
attribute :requested_at, type: :time
|
|
9
|
+
attribute :took, type: :integer
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
class MacroSeries < Brapi::Model
|
|
7
|
+
attribute :slug, type: :string
|
|
8
|
+
attribute :name, type: :string
|
|
9
|
+
attribute :description, type: :string
|
|
10
|
+
attribute :unit, type: :string
|
|
11
|
+
attribute :frequency, type: :string
|
|
12
|
+
attribute :category, type: :string
|
|
13
|
+
attribute :start_date, type: :date
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
# Single Tesouro Direto bond as returned by /api/v2/treasury/list and
|
|
7
|
+
# /api/v2/treasury/indicators (both endpoints share the same shape).
|
|
8
|
+
#
|
|
9
|
+
# buyRate / sellRate semantics depend on the bond's indexer — see
|
|
10
|
+
# TreasuryRateInfo#rate_type / #description.
|
|
11
|
+
class TreasuryBond < Brapi::Model
|
|
12
|
+
attribute :symbol, type: :string
|
|
13
|
+
attribute :bond_type, type: :string
|
|
14
|
+
attribute :indexer, type: :string
|
|
15
|
+
attribute :coupon_type, type: :string
|
|
16
|
+
attribute :maturity_date, type: :date
|
|
17
|
+
attribute :duration_days, type: :integer
|
|
18
|
+
attribute :base_date, type: :date
|
|
19
|
+
attribute :buy_rate, type: :float
|
|
20
|
+
attribute :sell_rate, type: :float
|
|
21
|
+
attribute :buy_price, type: :float
|
|
22
|
+
attribute :sell_price, type: :float
|
|
23
|
+
attribute :base_price, type: :float
|
|
24
|
+
attribute :rate_info, type: Brapi::Models::V2::TreasuryRateInfo
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
class TreasuryIndicatorsResponse < Brapi::Model
|
|
7
|
+
attribute :results, type: [Brapi::Models::V2::TreasuryBond]
|
|
8
|
+
attribute :requested_at, type: :time
|
|
9
|
+
attribute :took, type: :integer
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
class TreasuryListResponse < Brapi::Model
|
|
7
|
+
attribute :results, type: [Brapi::Models::V2::TreasuryBond]
|
|
8
|
+
attribute :pagination, type: Brapi::Models::Pagination
|
|
9
|
+
attribute :requested_at, type: :time
|
|
10
|
+
attribute :took, type: :integer
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Models
|
|
5
|
+
module V2
|
|
6
|
+
class TreasuryRateInfo < Brapi::Model
|
|
7
|
+
attribute :rate_type, type: :string
|
|
8
|
+
attribute :rate_unit, type: :string
|
|
9
|
+
attribute :description, type: :string
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
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/resource.rb
CHANGED
|
@@ -14,6 +14,13 @@ module Brapi
|
|
|
14
14
|
client.request(:get, path, params: camelize_keys(params))
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# Brapi endpoints that accept a `symbols` query param take a comma-separated
|
|
18
|
+
# list. Accepts a single String, a single Symbol, or any Enumerable of the
|
|
19
|
+
# two; always returns a String.
|
|
20
|
+
def format_symbols(symbols)
|
|
21
|
+
Array(symbols).join(",")
|
|
22
|
+
end
|
|
23
|
+
|
|
17
24
|
def camelize_keys(params)
|
|
18
25
|
return params if params.nil? || params.empty?
|
|
19
26
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Resources
|
|
5
|
+
class V2
|
|
6
|
+
class Fii < Brapi::Resource
|
|
7
|
+
# GET /api/v2/fii/list
|
|
8
|
+
def list(**params)
|
|
9
|
+
raw = get("/api/v2/fii/list", params: params)
|
|
10
|
+
Brapi::Models::V2::FiiListResponse.from_h(raw)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# GET /api/v2/fii/indicators?symbols=...
|
|
14
|
+
def indicators(symbols, **params)
|
|
15
|
+
raw = get("/api/v2/fii/indicators", params: params.merge(symbols: format_symbols(symbols)))
|
|
16
|
+
Brapi::Models::V2::FiiIndicatorsResponse.from_h(raw)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# GET /api/v2/fii/historical?symbols=...
|
|
20
|
+
def historical(symbols, **params)
|
|
21
|
+
raw = get("/api/v2/fii/historical", params: params.merge(symbols: format_symbols(symbols)))
|
|
22
|
+
Brapi::Models::V2::FiiHistoricalResponse.from_h(raw)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# GET /api/v2/fii/dividends?symbols=...
|
|
26
|
+
def dividends(symbols, **params)
|
|
27
|
+
raw = get("/api/v2/fii/dividends", params: params.merge(symbols: format_symbols(symbols)))
|
|
28
|
+
Brapi::Models::V2::FiiDividendsResponse.from_h(raw)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Resources
|
|
5
|
+
class V2
|
|
6
|
+
class Macro < Brapi::Resource
|
|
7
|
+
# GET /api/v2/macro?symbols=...
|
|
8
|
+
def retrieve(symbols, **params)
|
|
9
|
+
raw = get("/api/v2/macro", params: params.merge(symbols: format_symbols(symbols)))
|
|
10
|
+
Brapi::Models::V2::MacroRetrieveResponse.from_h(raw)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# GET /api/v2/macro/available
|
|
14
|
+
def list_available
|
|
15
|
+
raw = get("/api/v2/macro/available")
|
|
16
|
+
Brapi::Models::V2::MacroListAvailableResponse.from_h(raw)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brapi
|
|
4
|
+
module Resources
|
|
5
|
+
class V2
|
|
6
|
+
class Treasury < Brapi::Resource
|
|
7
|
+
# GET /api/v2/treasury/list
|
|
8
|
+
def list(**params)
|
|
9
|
+
raw = get("/api/v2/treasury/list", params: params)
|
|
10
|
+
Brapi::Models::V2::TreasuryListResponse.from_h(raw)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# GET /api/v2/treasury/indicators?symbols=...
|
|
14
|
+
def indicators(symbols, **params)
|
|
15
|
+
raw = get("/api/v2/treasury/indicators", params: params.merge(symbols: format_symbols(symbols)))
|
|
16
|
+
Brapi::Models::V2::TreasuryIndicatorsResponse.from_h(raw)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/brapi/resources/v2.rb
CHANGED
|
@@ -24,6 +24,18 @@ module Brapi
|
|
|
24
24
|
def prime_rate
|
|
25
25
|
@prime_rate ||= Brapi::Resources::V2::PrimeRate.new(client)
|
|
26
26
|
end
|
|
27
|
+
|
|
28
|
+
def fii
|
|
29
|
+
@fii ||= Brapi::Resources::V2::Fii.new(client)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def macro
|
|
33
|
+
@macro ||= Brapi::Resources::V2::Macro.new(client)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def treasury
|
|
37
|
+
@treasury ||= Brapi::Resources::V2::Treasury.new(client)
|
|
38
|
+
end
|
|
27
39
|
end
|
|
28
40
|
end
|
|
29
41
|
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"
|
|
@@ -31,6 +42,27 @@ require "brapi/models/v2/prime_rate_entry"
|
|
|
31
42
|
require "brapi/models/v2/prime_rate_retrieve_response"
|
|
32
43
|
require "brapi/models/v2/prime_rate_list_available_response"
|
|
33
44
|
|
|
45
|
+
require "brapi/models/pagination"
|
|
46
|
+
|
|
47
|
+
require "brapi/models/v2/fii"
|
|
48
|
+
require "brapi/models/v2/fii_dividend"
|
|
49
|
+
require "brapi/models/v2/fii_history"
|
|
50
|
+
require "brapi/models/v2/fii_list_response"
|
|
51
|
+
require "brapi/models/v2/fii_indicators_response"
|
|
52
|
+
require "brapi/models/v2/fii_historical_response"
|
|
53
|
+
require "brapi/models/v2/fii_dividends_response"
|
|
54
|
+
|
|
55
|
+
require "brapi/models/v2/macro_series"
|
|
56
|
+
require "brapi/models/v2/macro_observation"
|
|
57
|
+
require "brapi/models/v2/macro_result"
|
|
58
|
+
require "brapi/models/v2/macro_retrieve_response"
|
|
59
|
+
require "brapi/models/v2/macro_list_available_response"
|
|
60
|
+
|
|
61
|
+
require "brapi/models/v2/treasury_rate_info"
|
|
62
|
+
require "brapi/models/v2/treasury_bond"
|
|
63
|
+
require "brapi/models/v2/treasury_list_response"
|
|
64
|
+
require "brapi/models/v2/treasury_indicators_response"
|
|
65
|
+
|
|
34
66
|
# Resources — v2 (parent class) must load before its nested classes
|
|
35
67
|
require "brapi/resources/quote"
|
|
36
68
|
require "brapi/resources/available"
|
|
@@ -39,6 +71,9 @@ require "brapi/resources/v2/crypto"
|
|
|
39
71
|
require "brapi/resources/v2/currency"
|
|
40
72
|
require "brapi/resources/v2/inflation"
|
|
41
73
|
require "brapi/resources/v2/prime_rate"
|
|
74
|
+
require "brapi/resources/v2/fii"
|
|
75
|
+
require "brapi/resources/v2/macro"
|
|
76
|
+
require "brapi/resources/v2/treasury"
|
|
42
77
|
|
|
43
78
|
require "brapi/client"
|
|
44
79
|
|