btgsolutions-dataservices-python-client 2.18.1__tar.gz → 3.0.0__tar.gz

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.
Files changed (37) hide show
  1. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/PKG-INFO +19 -6
  2. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/README.md +4 -4
  3. btgsolutions_dataservices_python_client-3.0.0/btgsolutions_dataservices/config.py +137 -0
  4. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/bulk_data.py +14 -12
  5. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/reference_data.py +2 -2
  6. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/ticker_last_event.py +11 -11
  7. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices_python_client.egg-info/PKG-INFO +20 -7
  8. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/setup.py +1 -1
  9. btgsolutions_dataservices_python_client-2.18.1/btgsolutions_dataservices/config.py +0 -179
  10. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/LICENSE +0 -0
  11. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/MANIFEST.in +0 -0
  12. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/__init__.py +0 -0
  13. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/exceptions.py +0 -0
  14. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/__init__.py +0 -0
  15. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/authenticator.py +0 -0
  16. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/company_data.py +0 -0
  17. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/corporate_events.py +0 -0
  18. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/hfn.py +0 -0
  19. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/historical_candles.py +0 -0
  20. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/intraday_candles.py +0 -0
  21. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/intraday_tick_data.py +0 -0
  22. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/public_sources.py +0 -0
  23. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/quotes.py +0 -0
  24. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/stock_loan.py +0 -0
  25. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/ticker_last_event_polling.py +0 -0
  26. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/websocket/__init__.py +0 -0
  27. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/websocket/hfn_websocket_client.py +0 -0
  28. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/websocket/market_data_feed.py +0 -0
  29. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/websocket/market_data_websocket_client.py +0 -0
  30. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/websocket/websocket_default_functions.py +0 -0
  31. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices_python_client.egg-info/SOURCES.txt +0 -0
  32. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices_python_client.egg-info/dependency_links.txt +0 -0
  33. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices_python_client.egg-info/requires.txt +0 -0
  34. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices_python_client.egg-info/top_level.txt +0 -0
  35. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/pyproject.toml +0 -0
  36. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/requirements.txt +0 -0
  37. {btgsolutions_dataservices_python_client-2.18.1 → btgsolutions_dataservices_python_client-3.0.0}/setup.cfg +0 -0
@@ -1,12 +1,25 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: btgsolutions_dataservices_python_client
3
- Version: 2.18.1
3
+ Version: 3.0.0
4
4
  Summary: Python package containing several classes and data for extracting and manipulating market and trading data.
5
5
  Home-page: https://github.com/BTG-Pactual-Solutions/btgsolutions-dataservices-python-client
6
6
  Author: BTG Solutions Data Services powered by BTG Pactual Solutions
7
7
  Requires-Python: >=3.9,<3.14
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
+ Requires-Dist: pandas>=2.2.2
11
+ Requires-Dist: websocket-client>=1.8.0
12
+ Requires-Dist: PyJWT>=2.8.0
13
+ Requires-Dist: requests>=2.32.3
14
+ Requires-Dist: pyarrow>=17.0.0
15
+ Dynamic: author
16
+ Dynamic: description
17
+ Dynamic: description-content-type
18
+ Dynamic: home-page
19
+ Dynamic: license-file
20
+ Dynamic: requires-dist
21
+ Dynamic: requires-python
22
+ Dynamic: summary
10
23
 
11
24
  # BTG Solutions - Data Services
12
25
 
@@ -320,7 +333,7 @@ bulk_data.get_security_list(date='2025-05-07')
320
333
  ```python
321
334
  import btgsolutions_dataservices as btg
322
335
  bulk_data = btg.BulkData(api_key='YOUR_API_KEY')
323
- bulk_data.get_market_data_channels(date='2024-01-03')
336
+ bulk_data.get_market_data_channels(date='2026-01-30')
324
337
  ```
325
338
 
326
339
  ##### Compressed Data (PCAP files)
@@ -328,9 +341,9 @@ bulk_data.get_market_data_channels(date='2024-01-03')
328
341
  ```python
329
342
  import btgsolutions_dataservices as btg
330
343
  bulk_data = btg.BulkData(api_key='YOUR_API_KEY')
331
- bulk_data.get_compressed_data(channel='001', date='2024-01-03', data_type='instruments')
332
- # bulk_data.get_compressed_data(channel='053', date='2024-01-03', data_type='incremental')
333
- # bulk_data.get_compressed_data(channel='051', date='2024-01-03', data_type='snapshot')
344
+ bulk_data.get_compressed_data(channel='98', date='2026-01-30', data_type='instruments')
345
+ # bulk_data.get_compressed_data(channel='98', date='2026-01-30', data_type='incremental', feed='feedA')
346
+ # bulk_data.get_compressed_data(channel='98', date='2026-01-30', data_type='snapshot')
334
347
  ```
335
348
 
336
349
  ### Alternative Data
@@ -310,7 +310,7 @@ bulk_data.get_security_list(date='2025-05-07')
310
310
  ```python
311
311
  import btgsolutions_dataservices as btg
312
312
  bulk_data = btg.BulkData(api_key='YOUR_API_KEY')
313
- bulk_data.get_market_data_channels(date='2024-01-03')
313
+ bulk_data.get_market_data_channels(date='2026-01-30')
314
314
  ```
315
315
 
316
316
  ##### Compressed Data (PCAP files)
@@ -318,9 +318,9 @@ bulk_data.get_market_data_channels(date='2024-01-03')
318
318
  ```python
319
319
  import btgsolutions_dataservices as btg
320
320
  bulk_data = btg.BulkData(api_key='YOUR_API_KEY')
321
- bulk_data.get_compressed_data(channel='001', date='2024-01-03', data_type='instruments')
322
- # bulk_data.get_compressed_data(channel='053', date='2024-01-03', data_type='incremental')
323
- # bulk_data.get_compressed_data(channel='051', date='2024-01-03', data_type='snapshot')
321
+ bulk_data.get_compressed_data(channel='98', date='2026-01-30', data_type='instruments')
322
+ # bulk_data.get_compressed_data(channel='98', date='2026-01-30', data_type='incremental', feed='feedA')
323
+ # bulk_data.get_compressed_data(channel='98', date='2026-01-30', data_type='snapshot')
324
324
  ```
325
325
 
326
326
  ### Alternative Data
@@ -0,0 +1,137 @@
1
+ base_url = "https://dataservices.btgpactualsolutions.com"
2
+
3
+ # WS
4
+ url_ws = "wss://dataservices.btgpactualsolutions.com/stream/"
5
+ ws_br_b3_base_path = "/stream/v1/marketdata/br/b3/"
6
+
7
+ # Rest
8
+ url_apis = "https://dataservices.btgpactualsolutions.com/api/v2"
9
+ url_api_v1 = "https://dataservices.btgpactualsolutions.com/api/v1"
10
+ url_apis_v3 = "https://dataservices.btgpactualsolutions.com/api/v3"
11
+
12
+ # WebSocket
13
+ MAX_WS_RECONNECT_RETRIES = 5
14
+
15
+ REALTIME = 'realtime'
16
+ DELAYED = 'delayed'
17
+ THROTTLE = 'throttle'
18
+ PROCESSED = 'processed'
19
+
20
+ BR = 'brazil'
21
+ MX = 'mexico'
22
+ CL = 'chile'
23
+
24
+ B3 = 'b3'
25
+ BMV = 'bmv'
26
+ NASDAQ = 'nasdaq'
27
+
28
+ TRADES = 'trades'
29
+ PROCESSEDTRADES = 'processed-trades'
30
+ INSTRUMENTSTATUS = 'instrument_status'
31
+ SETTLEMENTPRICES = 'settlement-price'
32
+ BOOKS = 'books'
33
+ INDICES = 'indices'
34
+
35
+ ALL = 'all'
36
+ STOCKS = 'stocks'
37
+ OPTIONS = 'options'
38
+ DERIVATIVES = 'derivatives'
39
+
40
+ VALID_STREAM_TYPES = [REALTIME, DELAYED, THROTTLE]
41
+ VALID_COUNTRIES = [BR, MX, CL]
42
+ VALID_EXCHANGES = [B3, BMV, NASDAQ]
43
+ VALID_MARKET_DATA_TYPES = [
44
+ TRADES,
45
+ PROCESSEDTRADES,
46
+ BOOKS,
47
+ INDICES,
48
+ INSTRUMENTSTATUS,
49
+ SETTLEMENTPRICES
50
+ ]
51
+ VALID_MARKET_DATA_SUBTYPES = [ALL, STOCKS, OPTIONS, DERIVATIVES]
52
+
53
+ FEED_A = "A"
54
+ FEED_B = "B"
55
+ VALID_FEEDS = [FEED_A, FEED_B]
56
+
57
+ market_data_socket_urls = {
58
+ B3: {
59
+ TRADES: {
60
+ REALTIME: {
61
+ STOCKS: f'{url}{ws_br_b3_base_path}trade/{STOCKS}',
62
+ OPTIONS: f'{url}{ws_br_b3_base_path}trade/{OPTIONS}',
63
+ DERIVATIVES: f'{url}{ws_br_b3_base_path}trade/{DERIVATIVES}',
64
+ },
65
+ DELAYED: {
66
+ STOCKS: f'{url}{ws_br_b3_base_path}{DELAYED}/trade/{STOCKS}/{DELAYED}',
67
+ OPTIONS: f'{url}{ws_br_b3_base_path}{DELAYED}/trade/{OPTIONS}/{DELAYED}',
68
+ DERIVATIVES: f"{url}{ws_br_b3_base_path}{DELAYED}/trade/{DERIVATIVES}/{DELAYED}",
69
+ },
70
+ },
71
+ PROCESSEDTRADES: {
72
+ REALTIME: {
73
+ STOCKS: f'{url}{ws_br_b3_base_path}{PROCESSED}-trade/{STOCKS}',
74
+ OPTIONS: f'{url}{ws_br_b3_base_path}{PROCESSED}-trade/{OPTIONS}',
75
+ DERIVATIVES: f'{url}{ws_br_b3_base_path}{PROCESSED}-trade/{DERIVATIVES}',
76
+ },
77
+ },
78
+ BOOKS: {
79
+ REALTIME: {
80
+ STOCKS: f'{url}{ws_br_b3_base_path}book-snapshot-mbp/{STOCKS}',
81
+ OPTIONS: f'{url}{ws_br_b3_base_path}book-snapshot-mbp/{OPTIONS}',
82
+ DERIVATIVES: f'{url}{ws_br_b3_base_path}book-snapshot-mbp/{DERIVATIVES}',
83
+ },
84
+ THROTTLE: {
85
+ STOCKS: f"{url}{ws_br_b3_base_path}throttled/book-snapshot-mbp/{STOCKS}",
86
+ OPTIONS: f"{url}{ws_br_b3_base_path}throttled/book-snapshot-mbp/{OPTIONS}",
87
+ DERIVATIVES: f"{url}{ws_br_b3_base_path}throttled/book-snapshot-mbp/{DERIVATIVES}",
88
+ },
89
+ },
90
+ INDICES: {
91
+ REALTIME: {
92
+ ALL: f"{url_ws}v2/marketdata/{INDICES}",
93
+ },
94
+ DELAYED: {
95
+ ALL: f"{url_ws}v2/marketdata/{INDICES}/{DELAYED}",
96
+ }
97
+ },
98
+ INSTRUMENTSTATUS: {
99
+ REALTIME: {
100
+ STOCKS: f"{url}{ws_br_b3_base_path}instrument-status/{STOCKS}",
101
+ DERIVATIVES: f"{url}{ws_br_b3_base_path}instrument-status/{DERIVATIVES}",
102
+ OPTIONS: f"{url}{ws_br_b3_base_path}instrument-status/{OPTIONS}",
103
+ }
104
+ },
105
+ SETTLEMENTPRICES: {
106
+ REALTIME: {
107
+ ALL: f"{url}{ws_br_b3_base_path}{SETTLEMENTPRICES}",
108
+ }
109
+ }
110
+ },
111
+ BMV: {
112
+ TRADES: {
113
+ REALTIME: {
114
+ ALL: f'{url_ws}v1/marketdata/bmv/{TRADES}',
115
+ },
116
+ },
117
+ },
118
+ NASDAQ: {
119
+ TRADES: {
120
+ REALTIME: {
121
+ ALL: f'{url_ws}v1/marketdata/us/nasdaq/{TRADES}',
122
+ }
123
+ }
124
+ }
125
+ }
126
+
127
+ market_data_feedb_socket_urls = {
128
+ }
129
+
130
+ hfn_socket_urls = {
131
+ BR: {
132
+ REALTIME: f'{url_ws}v2/hfn/{BR}',
133
+ },
134
+ CL: {
135
+ REALTIME: f'{url_ws}v2/hfn/{CL}',
136
+ },
137
+ }
@@ -2,7 +2,7 @@ import os
2
2
  from typing import Optional
3
3
  from ..exceptions import BadResponse
4
4
  import requests
5
- from ..config import url_api_v1, url_apis
5
+ from ..config import url_api_v1, url_apis, url_apis_v3
6
6
  from .authenticator import Authenticator
7
7
  import json
8
8
  import pandas as pd
@@ -12,7 +12,9 @@ import pyarrow.parquet as pq
12
12
  def download_compressed_file(url, headers):
13
13
 
14
14
  with requests.get(url, headers=headers, stream=True) as response:
15
- response.raise_for_status()
15
+ if response.status_code != 200:
16
+ response = json.loads(response.text)
17
+ raise BadResponse(f'Error: {response.get("ApiClientError", "")}.\n{response.get("SuggestedAction", "")}')
16
18
 
17
19
  try:
18
20
  file_name = response.headers.get('content-disposition').split('filename=')[1]
@@ -110,9 +112,9 @@ class BulkData:
110
112
  date: str
111
113
  Date period.
112
114
  Field is required.
113
- Format: 'YYYY-MM-DD'. Example: '2023-07-03', '2023-07-28'.
115
+ Format: 'YYYY-MM-DD'. Example: '2026-01-30'.
114
116
  """
115
- url = f"{url_api_v1}/marketdata/bulkdata/channels?date={date}"
117
+ url = f"{url_apis_v3}/marketdata/bulkdata/compressed/available-channels?date={date}"
116
118
 
117
119
  response = requests.request("GET", url, headers=self.headers)
118
120
  if response.status_code == 200:
@@ -126,7 +128,7 @@ class BulkData:
126
128
  channel:str,
127
129
  date:str,
128
130
  data_type:str='instruments',
129
- binary:bool=False
131
+ feed:str='',
130
132
  ):
131
133
  """
132
134
  This method provides market data via compressed files (instruments, snapshot, incremental) for a given market data channel and date. Function get_market_data_channels provides all the available channels for a given date.
@@ -135,19 +137,19 @@ class BulkData:
135
137
  ----------------
136
138
  channel: str
137
139
  Market Data channel.
138
- Field is required. Example: '001'.
140
+ Field is required. Example: '72'.
139
141
  date: str
140
142
  Date period.
141
143
  Field is required.
142
- Format: 'YYYY-MM-DD'. Example: '2023-07-03', '2023-07-28'.
144
+ Format: 'YYYY-MM-DD'. Example: '2026-01-30'.
143
145
  data_type: str
144
146
  Market data type.
145
- Field is required. Example: 'instruments', 'snapshot', 'incremental', 'instrument-status'.
146
- binary: bool
147
- If true, returns binary data. If false, returns FIX/FAST data.
148
- Field is not required. Default: false.
147
+ Field is required. Example: 'instruments', 'snapshot', 'incremental'.
148
+ feed: str
149
+ Available only for 'incremental' data type. Allowed values: 'feedA' or 'feedB'
150
+ Field is not required.
149
151
  """
150
- url = f"{url_api_v1}/marketdata/bulkdata/compressed/{data_type}?channel={channel}&date={date}&binary={binary}"
152
+ url = f"{url_apis_v3}/marketdata/bulkdata/compressed/{data_type}?channel={channel}&date={date}&feed={feed}"
151
153
  download_compressed_file(url, headers=self.headers)
152
154
 
153
155
  def get_data(
@@ -1,7 +1,7 @@
1
1
  from typing import List, Optional
2
2
  from ..exceptions import BadResponse
3
3
  import requests
4
- from ..config import url_apis
4
+ from ..config import base_url
5
5
  from .authenticator import Authenticator
6
6
  import pandas as pd
7
7
  import json
@@ -51,7 +51,7 @@ class ReferenceData:
51
51
  if not isinstance(tickers, list) or len(tickers) == 0:
52
52
  raise BadResponse(f'Error: Must provide a valid list of tickers')
53
53
 
54
- url = f"{url_apis}/marketdata/instrument/specs/all/instrument_data/batch?tickers={','.join(tickers)}"
54
+ url = f"{base_url}/api/v1/marketdata/br/b3/snapshot/instruments/batch?tickers={','.join(tickers)}"
55
55
 
56
56
  response = requests.request("GET", url, headers=self.headers)
57
57
  if response.status_code == 200:
@@ -1,7 +1,7 @@
1
1
  from typing import Optional, List
2
2
  from ..exceptions import BadResponse
3
3
  import requests
4
- from ..config import url_api_v1
4
+ from ..config import base_url
5
5
  from .authenticator import Authenticator
6
6
  import pandas as pd
7
7
  import json
@@ -24,7 +24,7 @@ class TickerLastEvent:
24
24
  >>> )
25
25
 
26
26
  >>> last_event.get_tob(
27
- >>> data_type = 'stocks',
27
+ >>> data_type = 'derivatives',
28
28
  >>> raw_data = False
29
29
  >>> )
30
30
 
@@ -43,7 +43,7 @@ class TickerLastEvent:
43
43
 
44
44
  self.available_data_types = {
45
45
  "trades": ['equities', 'derivatives'],
46
- "books": ['stocks', 'derivatives', 'options']
46
+ "books": ['equities', 'derivatives']
47
47
  }
48
48
 
49
49
  def get_trades(self, data_type:str, ticker:str, raw_data:bool=False):
@@ -67,7 +67,7 @@ class TickerLastEvent:
67
67
  if data_type not in self.available_data_types["trades"]:
68
68
  raise Exception(f"Must provide a valid data_type. Valid data types are: {self.available_data_types['trades']}")
69
69
 
70
- url = f"{url_api_v1}/marketdata/last-event/trades/{data_type}?ticker={ticker}"
70
+ url = f"{base_url}/api/v1/marketdata/br/b3/snapshot/trades/{data_type}?ticker={ticker}"
71
71
 
72
72
  response = requests.request("GET", url, headers={"authorization": f"Bearer {self.authenticator.token}"})
73
73
  if response.status_code == 200:
@@ -89,7 +89,7 @@ class TickerLastEvent:
89
89
  data_type: str
90
90
  Market Data Type.
91
91
  Field is required.
92
- Example: 'stocks', 'derivatives', 'options'.
92
+ Example: 'equities', 'derivatives'.
93
93
  raw_data: bool
94
94
  If false, returns data in a dataframe. If true, returns raw data.
95
95
  Field is not required. Default: False.
@@ -98,7 +98,7 @@ class TickerLastEvent:
98
98
  if data_type not in self.available_data_types["books"]:
99
99
  raise Exception(f"Must provide a valid data_type. Valid data types are: {self.available_data_types}")
100
100
 
101
- url = f"{url_api_v1}/marketdata/last-event/books/top/{data_type}/batch"
101
+ url = f"{base_url}/api/v1/marketdata/br/b3/snapshot/book/tob/{data_type}/batch"
102
102
 
103
103
  response = requests.request("GET", url, headers={"authorization": f"Bearer {self.authenticator.token}"})
104
104
 
@@ -131,9 +131,9 @@ class TickerLastEvent:
131
131
 
132
132
  if tickers:
133
133
  tickers = ','.join(tickers)
134
- url = f"{url_api_v1}/marketdata/last-event/status/all/batch?tickers={tickers}"
134
+ url = f"{base_url}/api/v1/marketdata/br/b3/snapshot/status/batch?tickers={tickers}"
135
135
  else:
136
- url = f"{url_api_v1}/marketdata/last-event/status/all/batch"
136
+ url = f"{base_url}/api/v1/marketdata/br/b3/snapshot/status/batch"
137
137
 
138
138
  response = requests.request("GET", url, headers={"authorization": f"Bearer {self.authenticator.token}"})
139
139
  if response.status_code == 200:
@@ -159,7 +159,7 @@ class TickerLastEvent:
159
159
  data_type: str
160
160
  Market Data Type.
161
161
  Field is required.
162
- Example: 'equities', 'derivatives', 'options', 'stocks'.
162
+ Example: 'equities', 'derivatives'.
163
163
  """
164
164
 
165
165
  if type not in self.available_data_types:
@@ -168,8 +168,8 @@ class TickerLastEvent:
168
168
  if data_type not in self.available_data_types[type]:
169
169
  raise Exception(f"Must provide a valid data_type. Valid data types are: {self.available_data_types['books']}")
170
170
 
171
- url = f"{url_api_v1}/marketdata/last-event/trades/{data_type}/available-tickers" if type == "trades" else \
172
- f"{url_api_v1}/marketdata/last-event/books/{data_type}/availables"
171
+ url = f"{base_url}/api/v1/marketdata/br/b3/snapshot/trades/{data_type}/available-tickers" if type == "trades" else \
172
+ f"{base_url}/api/v1/marketdata/br/b3/snapshot/book/tob/{data_type}/available-tickers"
173
173
 
174
174
  response = requests.request("GET", url, headers={"authorization": f"Bearer {self.authenticator.token}"})
175
175
  if response.status_code == 200:
@@ -1,12 +1,25 @@
1
- Metadata-Version: 2.1
2
- Name: btgsolutions-dataservices-python-client
3
- Version: 2.18.1
1
+ Metadata-Version: 2.4
2
+ Name: btgsolutions_dataservices_python_client
3
+ Version: 3.0.0
4
4
  Summary: Python package containing several classes and data for extracting and manipulating market and trading data.
5
5
  Home-page: https://github.com/BTG-Pactual-Solutions/btgsolutions-dataservices-python-client
6
6
  Author: BTG Solutions Data Services powered by BTG Pactual Solutions
7
7
  Requires-Python: >=3.9,<3.14
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
+ Requires-Dist: pandas>=2.2.2
11
+ Requires-Dist: websocket-client>=1.8.0
12
+ Requires-Dist: PyJWT>=2.8.0
13
+ Requires-Dist: requests>=2.32.3
14
+ Requires-Dist: pyarrow>=17.0.0
15
+ Dynamic: author
16
+ Dynamic: description
17
+ Dynamic: description-content-type
18
+ Dynamic: home-page
19
+ Dynamic: license-file
20
+ Dynamic: requires-dist
21
+ Dynamic: requires-python
22
+ Dynamic: summary
10
23
 
11
24
  # BTG Solutions - Data Services
12
25
 
@@ -320,7 +333,7 @@ bulk_data.get_security_list(date='2025-05-07')
320
333
  ```python
321
334
  import btgsolutions_dataservices as btg
322
335
  bulk_data = btg.BulkData(api_key='YOUR_API_KEY')
323
- bulk_data.get_market_data_channels(date='2024-01-03')
336
+ bulk_data.get_market_data_channels(date='2026-01-30')
324
337
  ```
325
338
 
326
339
  ##### Compressed Data (PCAP files)
@@ -328,9 +341,9 @@ bulk_data.get_market_data_channels(date='2024-01-03')
328
341
  ```python
329
342
  import btgsolutions_dataservices as btg
330
343
  bulk_data = btg.BulkData(api_key='YOUR_API_KEY')
331
- bulk_data.get_compressed_data(channel='001', date='2024-01-03', data_type='instruments')
332
- # bulk_data.get_compressed_data(channel='053', date='2024-01-03', data_type='incremental')
333
- # bulk_data.get_compressed_data(channel='051', date='2024-01-03', data_type='snapshot')
344
+ bulk_data.get_compressed_data(channel='98', date='2026-01-30', data_type='instruments')
345
+ # bulk_data.get_compressed_data(channel='98', date='2026-01-30', data_type='incremental', feed='feedA')
346
+ # bulk_data.get_compressed_data(channel='98', date='2026-01-30', data_type='snapshot')
334
347
  ```
335
348
 
336
349
  ### Alternative Data
@@ -22,7 +22,7 @@ description = "Python package containing several classes and data for extracting
22
22
 
23
23
  setup(
24
24
  name='btgsolutions_dataservices_python_client',
25
- version='2.18.1',
25
+ version='3.0.0',
26
26
  description=description,
27
27
  long_description=long_description,
28
28
  long_description_content_type='text/markdown',
@@ -1,179 +0,0 @@
1
- # WS
2
- url_ws = "wss://dataservices.btgpactualsolutions.com/stream/"
3
-
4
- # Rest
5
- url_apis = "https://dataservices.btgpactualsolutions.com/api/v2"
6
- url_api_v1 = "https://dataservices.btgpactualsolutions.com/api/v1"
7
- url_apis_v3 = "https://dataservices.btgpactualsolutions.com/api/v3"
8
-
9
- # WebSocket
10
- MAX_WS_RECONNECT_RETRIES = 5
11
-
12
- REALTIME = 'realtime'
13
- DELAYED = 'delayed'
14
- THROTTLE = 'throttle'
15
- PROCESSED = 'processed'
16
-
17
- BR = 'brazil'
18
- MX = 'mexico'
19
- CL = 'chile'
20
-
21
- B3 = 'b3'
22
- BMV = 'bmv'
23
- NASDAQ = 'nasdaq'
24
-
25
- SECURITIES = 'securities'
26
- TRADES = 'trades'
27
- PROCESSEDTRADES = 'processed-trades'
28
- INSTRUMENTSTATUS = 'instrument_status'
29
- SETTLEMENTPRICES = 'settlement-price'
30
- BOOKS = 'books'
31
- INDICES = 'indices'
32
- CANDLES1S = 'candles-1S'
33
- CANDLES1M = 'candles-1M'
34
- STOPLOSS = 'stoploss'
35
-
36
- ALL = 'all'
37
- STOCKS = 'stocks'
38
- OPTIONS = 'options'
39
- DERIVATIVES = 'derivatives'
40
-
41
- VALID_STREAM_TYPES = [REALTIME, DELAYED, THROTTLE]
42
- VALID_COUNTRIES = [BR, MX, CL]
43
- VALID_EXCHANGES = [B3, BMV, NASDAQ]
44
- VALID_MARKET_DATA_TYPES = [
45
- SECURITIES,
46
- TRADES,
47
- PROCESSEDTRADES,
48
- BOOKS,
49
- INDICES,
50
- CANDLES1S,
51
- CANDLES1M,
52
- STOPLOSS,
53
- INSTRUMENTSTATUS,
54
- SETTLEMENTPRICES
55
- ]
56
- VALID_MARKET_DATA_SUBTYPES = [ALL, STOCKS, OPTIONS, DERIVATIVES]
57
-
58
- FEED_A = "A"
59
- FEED_B = "B"
60
- VALID_FEEDS = [FEED_A, FEED_B]
61
-
62
- market_data_socket_urls = {
63
- B3: {
64
- TRADES: {
65
- REALTIME: {
66
- STOCKS: f'{url_ws}v2/marketdata/trade/{STOCKS}',
67
- OPTIONS: f'{url_ws}v2/marketdata/trade/{OPTIONS}',
68
- DERIVATIVES: f'{url_ws}v2/marketdata/trade/{DERIVATIVES}',
69
- },
70
- DELAYED: {
71
- STOCKS: f'{url_ws}v2/marketdata/trade/{STOCKS}/{DELAYED}',
72
- OPTIONS: f'{url_ws}v2/marketdata/trade/{OPTIONS}/{DELAYED}',
73
- DERIVATIVES: f"{url_ws}v2/marketdata/trade/{DERIVATIVES}/{DELAYED}",
74
- },
75
- THROTTLE: {
76
- STOCKS: f"{url_ws}v2/marketdata/{THROTTLE}/trade/{STOCKS}",
77
- OPTIONS: f"{url_ws}v2/marketdata/{THROTTLE}/trade/{OPTIONS}",
78
- DERIVATIVES: f"{url_ws}v2/marketdata/{THROTTLE}/trade/{DERIVATIVES}",
79
- },
80
- },
81
- PROCESSEDTRADES: {
82
- REALTIME: {
83
- STOCKS: f'{url_ws}v2/marketdata/{PROCESSED}/trade/{STOCKS}',
84
- OPTIONS: f'{url_ws}v2/marketdata/{PROCESSED}/trade/{OPTIONS}',
85
- DERIVATIVES: f'{url_ws}v2/marketdata/{PROCESSED}/trade/{DERIVATIVES}',
86
- },
87
- },
88
- BOOKS: {
89
- REALTIME: {
90
- STOCKS: f'{url_ws}v2/marketdata/book/{STOCKS}',
91
- OPTIONS: f'{url_ws}v2/marketdata/book/{OPTIONS}',
92
- DERIVATIVES: f'{url_ws}v2/marketdata/book/{DERIVATIVES}',
93
- },
94
- THROTTLE: {
95
- STOCKS: f"{url_ws}v2/marketdata/{THROTTLE}/book/{STOCKS}",
96
- OPTIONS: f"{url_ws}v2/marketdata/{THROTTLE}/book/{OPTIONS}",
97
- DERIVATIVES: f"{url_ws}v2/marketdata/{THROTTLE}/book/{DERIVATIVES}",
98
- },
99
- },
100
- SECURITIES: {
101
- REALTIME: {
102
- STOCKS: f"{url_ws}v1/marketdata/sec_list/{STOCKS}",
103
- OPTIONS: f"{url_ws}v1/marketdata/sec_list/{OPTIONS}",
104
- DERIVATIVES: f"{url_ws}v1/marketdata/sec_list/{DERIVATIVES}",
105
- },
106
- },
107
- INDICES: {
108
- REALTIME: {
109
- ALL: f"{url_ws}v2/marketdata/{INDICES}",
110
- },
111
- DELAYED: {
112
- ALL: f"{url_ws}v2/marketdata/{INDICES}/{DELAYED}",
113
- }
114
- },
115
- CANDLES1S: {
116
- REALTIME: {
117
- STOCKS: f"{url_ws}v1/marketdata/candles/1S/{STOCKS}",
118
- DERIVATIVES: f"{url_ws}v1/marketdata/candles/1S/{DERIVATIVES}",
119
- },
120
- },
121
- CANDLES1M: {
122
- REALTIME: {
123
- STOCKS: f"{url_ws}v1/marketdata/candles/1M/{STOCKS}",
124
- DERIVATIVES: f"{url_ws}v1/marketdata/candles/1M/{DERIVATIVES}",
125
- },
126
- },
127
- STOPLOSS: {
128
- REALTIME: {
129
- STOCKS: f"{url_ws}v1/marketdata/{STOPLOSS}/{STOCKS}",
130
- DERIVATIVES: f"{url_ws}v1/marketdata/{STOPLOSS}/{DERIVATIVES}",
131
- },
132
- },
133
- INSTRUMENTSTATUS: {
134
- REALTIME: {
135
- STOCKS: f"{url_ws}v2/marketdata/{INSTRUMENTSTATUS}/{STOCKS}",
136
- DERIVATIVES: f"{url_ws}v2/marketdata/{INSTRUMENTSTATUS}/{DERIVATIVES}",
137
- OPTIONS: f"{url_ws}v2/marketdata/{INSTRUMENTSTATUS}/{OPTIONS}",
138
- }
139
- },
140
- SETTLEMENTPRICES: {
141
- REALTIME: {
142
- ALL: f"{url_ws}v2/marketdata/{SETTLEMENTPRICES}",
143
- }
144
- }
145
- },
146
- BMV: {
147
- TRADES: {
148
- REALTIME: {
149
- ALL: f'{url_ws}v1/marketdata/bmv/{TRADES}',
150
- },
151
- },
152
- },
153
- NASDAQ: {
154
- TRADES: {
155
- REALTIME: {
156
- ALL: f'{url_ws}v1/marketdata/us/nasdaq/{TRADES}',
157
- }
158
- }
159
- }
160
- }
161
-
162
- market_data_feedb_socket_urls = {
163
- B3: {
164
- BOOKS: {
165
- REALTIME: {
166
- OPTIONS: f'{url_ws}v2/feedb/marketdata/book/{OPTIONS}',
167
- }
168
- }
169
- }
170
- }
171
-
172
- hfn_socket_urls = {
173
- BR: {
174
- REALTIME: f'{url_ws}v2/hfn/{BR}',
175
- },
176
- CL: {
177
- REALTIME: f'{url_ws}v2/hfn/{CL}',
178
- },
179
- }