btgsolutions-dataservices-python-client 3.1.0__tar.gz → 3.2.1__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.
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/PKG-INFO +18 -36
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/README.md +3 -30
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/config.py +20 -19
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/intraday_candles.py +3 -3
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/quotes.py +4 -4
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/reference_data.py +1 -1
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices_python_client.egg-info/PKG-INFO +19 -37
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/setup.py +1 -1
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/LICENSE +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/MANIFEST.in +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/__init__.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/exceptions.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/__init__.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/authenticator.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/bulk_data.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/company_data.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/corporate_events.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/hfn.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/historical_candles.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/intraday_tick_data.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/public_sources.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/stock_loan.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/ticker_last_event.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/rest/ticker_last_event_polling.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/websocket/__init__.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/websocket/hfn_websocket_client.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/websocket/market_data_feed.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/websocket/market_data_websocket_client.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices/websocket/websocket_default_functions.py +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices_python_client.egg-info/SOURCES.txt +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices_python_client.egg-info/dependency_links.txt +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices_python_client.egg-info/requires.txt +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/btgsolutions_dataservices_python_client.egg-info/top_level.txt +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/pyproject.toml +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/requirements.txt +0 -0
- {btgsolutions_dataservices_python_client-3.1.0 → btgsolutions_dataservices_python_client-3.2.1}/setup.cfg +0 -0
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: btgsolutions_dataservices_python_client
|
|
3
|
-
Version: 3.1
|
|
3
|
+
Version: 3.2.1
|
|
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
|
-
License: UNKNOWN
|
|
8
|
-
Platform: UNKNOWN
|
|
9
7
|
Requires-Python: >=3.9,<3.14
|
|
10
8
|
Description-Content-Type: text/markdown
|
|
11
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
|
|
12
23
|
|
|
13
24
|
# BTG Solutions - Data Services
|
|
14
25
|
|
|
@@ -98,11 +109,11 @@ ws.run(on_message=lambda message: print(message))
|
|
|
98
109
|
# sleep(1)
|
|
99
110
|
```
|
|
100
111
|
|
|
101
|
-
#####
|
|
112
|
+
##### Books, throttle (1 second throttle)
|
|
102
113
|
|
|
103
114
|
```python
|
|
104
115
|
import btgsolutions_dataservices as btg
|
|
105
|
-
ws = btg.MarketDataWebSocketClient(api_key='YOUR_API_KEY', data_type='
|
|
116
|
+
ws = btg.MarketDataWebSocketClient(api_key='YOUR_API_KEY', data_type='books', stream_type='throttle', instruments=['PETR4', 'VALE3'])
|
|
106
117
|
ws.run(on_message=lambda message: print(message))
|
|
107
118
|
|
|
108
119
|
## The following is optional to keep the program running in a .py file:
|
|
@@ -138,19 +149,6 @@ ws.run(on_message=lambda message: print(message))
|
|
|
138
149
|
# sleep(1)
|
|
139
150
|
```
|
|
140
151
|
|
|
141
|
-
##### Security List
|
|
142
|
-
|
|
143
|
-
```python
|
|
144
|
-
import btgsolutions_dataservices as btg
|
|
145
|
-
ws = btg.MarketDataWebSocketClient(api_key='YOUR_API_KEY', data_type='securities', data_subtype='derivatives')
|
|
146
|
-
ws.run(on_message=lambda message: print(message))
|
|
147
|
-
|
|
148
|
-
## The following is optional to keep the program running in a .py file:
|
|
149
|
-
# from time import sleep
|
|
150
|
-
# while True:
|
|
151
|
-
# sleep(1)
|
|
152
|
-
```
|
|
153
|
-
|
|
154
152
|
##### Security Status
|
|
155
153
|
|
|
156
154
|
```python
|
|
@@ -181,20 +179,6 @@ ws.run(on_message=lambda message: print(message))
|
|
|
181
179
|
# sleep(1)
|
|
182
180
|
```
|
|
183
181
|
|
|
184
|
-
##### Candles (1 second candles)
|
|
185
|
-
|
|
186
|
-
```python
|
|
187
|
-
import btgsolutions_dataservices as btg
|
|
188
|
-
ws = btg.MarketDataWebSocketClient(api_key='YOUR_API_KEY', data_type='candles-1S', stream_type='realtime')
|
|
189
|
-
ws.run(on_message=lambda message: print(message))
|
|
190
|
-
ws.candle_subscribe(list_instruments=['PETR4','VALE3'], candle_type='partial')
|
|
191
|
-
|
|
192
|
-
## The following is optional to keep the program running in a .py file:
|
|
193
|
-
# from time import sleep
|
|
194
|
-
# while True:
|
|
195
|
-
# sleep(1)
|
|
196
|
-
```
|
|
197
|
-
|
|
198
182
|
#### Intraday Candles
|
|
199
183
|
|
|
200
184
|
```python
|
|
@@ -232,7 +216,7 @@ last_event.get_trades(data_type='equities', ticker='VALE3')
|
|
|
232
216
|
```python
|
|
233
217
|
import btgsolutions_dataservices as btg
|
|
234
218
|
last_event = btg.TickerLastEvent(api_key='YOUR_API_KEY')
|
|
235
|
-
last_event.get_tobs(data_type='
|
|
219
|
+
last_event.get_tobs(data_type='equities')
|
|
236
220
|
```
|
|
237
221
|
|
|
238
222
|
#### Ticker Last Trading Status
|
|
@@ -469,5 +453,3 @@ ref = btg.ReferenceData(api_key='YOUR_API_KEY')
|
|
|
469
453
|
ref.ticker_reference(tickers=['VALE3','PETR4'])
|
|
470
454
|
```
|
|
471
455
|
|
|
472
|
-
|
|
473
|
-
|
|
@@ -86,11 +86,11 @@ ws.run(on_message=lambda message: print(message))
|
|
|
86
86
|
# sleep(1)
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
#####
|
|
89
|
+
##### Books, throttle (1 second throttle)
|
|
90
90
|
|
|
91
91
|
```python
|
|
92
92
|
import btgsolutions_dataservices as btg
|
|
93
|
-
ws = btg.MarketDataWebSocketClient(api_key='YOUR_API_KEY', data_type='
|
|
93
|
+
ws = btg.MarketDataWebSocketClient(api_key='YOUR_API_KEY', data_type='books', stream_type='throttle', instruments=['PETR4', 'VALE3'])
|
|
94
94
|
ws.run(on_message=lambda message: print(message))
|
|
95
95
|
|
|
96
96
|
## The following is optional to keep the program running in a .py file:
|
|
@@ -126,19 +126,6 @@ ws.run(on_message=lambda message: print(message))
|
|
|
126
126
|
# sleep(1)
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
##### Security List
|
|
130
|
-
|
|
131
|
-
```python
|
|
132
|
-
import btgsolutions_dataservices as btg
|
|
133
|
-
ws = btg.MarketDataWebSocketClient(api_key='YOUR_API_KEY', data_type='securities', data_subtype='derivatives')
|
|
134
|
-
ws.run(on_message=lambda message: print(message))
|
|
135
|
-
|
|
136
|
-
## The following is optional to keep the program running in a .py file:
|
|
137
|
-
# from time import sleep
|
|
138
|
-
# while True:
|
|
139
|
-
# sleep(1)
|
|
140
|
-
```
|
|
141
|
-
|
|
142
129
|
##### Security Status
|
|
143
130
|
|
|
144
131
|
```python
|
|
@@ -169,20 +156,6 @@ ws.run(on_message=lambda message: print(message))
|
|
|
169
156
|
# sleep(1)
|
|
170
157
|
```
|
|
171
158
|
|
|
172
|
-
##### Candles (1 second candles)
|
|
173
|
-
|
|
174
|
-
```python
|
|
175
|
-
import btgsolutions_dataservices as btg
|
|
176
|
-
ws = btg.MarketDataWebSocketClient(api_key='YOUR_API_KEY', data_type='candles-1S', stream_type='realtime')
|
|
177
|
-
ws.run(on_message=lambda message: print(message))
|
|
178
|
-
ws.candle_subscribe(list_instruments=['PETR4','VALE3'], candle_type='partial')
|
|
179
|
-
|
|
180
|
-
## The following is optional to keep the program running in a .py file:
|
|
181
|
-
# from time import sleep
|
|
182
|
-
# while True:
|
|
183
|
-
# sleep(1)
|
|
184
|
-
```
|
|
185
|
-
|
|
186
159
|
#### Intraday Candles
|
|
187
160
|
|
|
188
161
|
```python
|
|
@@ -220,7 +193,7 @@ last_event.get_trades(data_type='equities', ticker='VALE3')
|
|
|
220
193
|
```python
|
|
221
194
|
import btgsolutions_dataservices as btg
|
|
222
195
|
last_event = btg.TickerLastEvent(api_key='YOUR_API_KEY')
|
|
223
|
-
last_event.get_tobs(data_type='
|
|
196
|
+
last_event.get_tobs(data_type='equities')
|
|
224
197
|
```
|
|
225
198
|
|
|
226
199
|
#### Ticker Last Trading Status
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
base_url = "https://dataservices.btgpactualsolutions.com"
|
|
2
|
+
base_url_ws = "wss://dataservices.btgpactualsolutions.com"
|
|
2
3
|
|
|
3
4
|
# WS
|
|
4
5
|
url_ws = "wss://dataservices.btgpactualsolutions.com/stream/"
|
|
@@ -58,33 +59,33 @@ market_data_socket_urls = {
|
|
|
58
59
|
B3: {
|
|
59
60
|
TRADES: {
|
|
60
61
|
REALTIME: {
|
|
61
|
-
STOCKS: f'{
|
|
62
|
-
OPTIONS: f'{
|
|
63
|
-
DERIVATIVES: f'{
|
|
62
|
+
STOCKS: f'{base_url_ws}{ws_br_b3_base_path}trade/{STOCKS}',
|
|
63
|
+
OPTIONS: f'{base_url_ws}{ws_br_b3_base_path}trade/{OPTIONS}',
|
|
64
|
+
DERIVATIVES: f'{base_url_ws}{ws_br_b3_base_path}trade/{DERIVATIVES}',
|
|
64
65
|
},
|
|
65
66
|
DELAYED: {
|
|
66
|
-
STOCKS: f'{
|
|
67
|
-
OPTIONS: f'{
|
|
68
|
-
DERIVATIVES: f"{
|
|
67
|
+
STOCKS: f'{base_url_ws}{ws_br_b3_base_path}{DELAYED}/trade/{STOCKS}/{DELAYED}',
|
|
68
|
+
OPTIONS: f'{base_url_ws}{ws_br_b3_base_path}{DELAYED}/trade/{OPTIONS}/{DELAYED}',
|
|
69
|
+
DERIVATIVES: f"{base_url_ws}{ws_br_b3_base_path}{DELAYED}/trade/{DERIVATIVES}/{DELAYED}",
|
|
69
70
|
},
|
|
70
71
|
},
|
|
71
72
|
PROCESSEDTRADES: {
|
|
72
73
|
REALTIME: {
|
|
73
|
-
STOCKS: f'{
|
|
74
|
-
OPTIONS: f'{
|
|
75
|
-
DERIVATIVES: f'{
|
|
74
|
+
STOCKS: f'{base_url_ws}{ws_br_b3_base_path}{PROCESSED}-trade/{STOCKS}',
|
|
75
|
+
OPTIONS: f'{base_url_ws}{ws_br_b3_base_path}{PROCESSED}-trade/{OPTIONS}',
|
|
76
|
+
DERIVATIVES: f'{base_url_ws}{ws_br_b3_base_path}{PROCESSED}-trade/{DERIVATIVES}',
|
|
76
77
|
},
|
|
77
78
|
},
|
|
78
79
|
BOOKS: {
|
|
79
80
|
REALTIME: {
|
|
80
|
-
STOCKS: f'{
|
|
81
|
-
OPTIONS: f'{
|
|
82
|
-
DERIVATIVES: f'{
|
|
81
|
+
STOCKS: f'{base_url_ws}{ws_br_b3_base_path}book-snapshot-mbp/{STOCKS}',
|
|
82
|
+
OPTIONS: f'{base_url_ws}{ws_br_b3_base_path}book-snapshot-mbp/{OPTIONS}',
|
|
83
|
+
DERIVATIVES: f'{base_url_ws}{ws_br_b3_base_path}book-snapshot-mbp/{DERIVATIVES}',
|
|
83
84
|
},
|
|
84
85
|
THROTTLE: {
|
|
85
|
-
STOCKS: f"{
|
|
86
|
-
OPTIONS: f"{
|
|
87
|
-
DERIVATIVES: f"{
|
|
86
|
+
STOCKS: f"{base_url_ws}{ws_br_b3_base_path}throttled/book-snapshot-mbp/{STOCKS}",
|
|
87
|
+
OPTIONS: f"{base_url_ws}{ws_br_b3_base_path}throttled/book-snapshot-mbp/{OPTIONS}",
|
|
88
|
+
DERIVATIVES: f"{base_url_ws}{ws_br_b3_base_path}throttled/book-snapshot-mbp/{DERIVATIVES}",
|
|
88
89
|
},
|
|
89
90
|
},
|
|
90
91
|
INDICES: {
|
|
@@ -97,14 +98,14 @@ market_data_socket_urls = {
|
|
|
97
98
|
},
|
|
98
99
|
INSTRUMENTSTATUS: {
|
|
99
100
|
REALTIME: {
|
|
100
|
-
STOCKS: f"{
|
|
101
|
-
DERIVATIVES: f"{
|
|
102
|
-
OPTIONS: f"{
|
|
101
|
+
STOCKS: f"{base_url_ws}{ws_br_b3_base_path}instrument-status/{STOCKS}",
|
|
102
|
+
DERIVATIVES: f"{base_url_ws}{ws_br_b3_base_path}instrument-status/{DERIVATIVES}",
|
|
103
|
+
OPTIONS: f"{base_url_ws}{ws_br_b3_base_path}instrument-status/{OPTIONS}",
|
|
103
104
|
}
|
|
104
105
|
},
|
|
105
106
|
SETTLEMENTPRICES: {
|
|
106
107
|
REALTIME: {
|
|
107
|
-
ALL: f"{
|
|
108
|
+
ALL: f"{base_url_ws}{ws_br_b3_base_path}{SETTLEMENTPRICES}/stocks",
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
from typing import Optional
|
|
3
3
|
from ..exceptions import BadResponse, MarketTypeError, DelayError
|
|
4
4
|
import requests
|
|
5
|
-
from ..config import
|
|
5
|
+
from ..config import base_url
|
|
6
6
|
import json
|
|
7
7
|
import pandas as pd
|
|
8
8
|
from .authenticator import Authenticator
|
|
@@ -111,7 +111,7 @@ class IntradayCandles:
|
|
|
111
111
|
|
|
112
112
|
tickers = ','.join(tickers) if type(tickers) is list else tickers
|
|
113
113
|
|
|
114
|
-
url = f"{
|
|
114
|
+
url = f"{base_url}/api/v1/marketdata/br/b3/{delay}/intraday-candles/{market_type}?tickers={tickers}&candle_period={candle_period}&mode={mode}&timezone={timezone}"
|
|
115
115
|
|
|
116
116
|
if start: url += f'&start={start}'
|
|
117
117
|
|
|
@@ -153,7 +153,7 @@ class IntradayCandles:
|
|
|
153
153
|
|
|
154
154
|
if delay not in ['delayed', 'realtime']: raise DelayError(f"Must provide a valid 'delay' parameter. Input: '{delay}'. Accepted values: 'delayed' or 'realtime'.")
|
|
155
155
|
|
|
156
|
-
url = f"{
|
|
156
|
+
url = f"{base_url}/api/v1/marketdata/br/b3/{delay}/intraday-candles/{market_type}/available_tickers"
|
|
157
157
|
|
|
158
158
|
response = requests.request("GET", url, headers=self.headers)
|
|
159
159
|
if response.status_code == 200: return json.loads(response.text)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
from ..exceptions import BadResponse
|
|
3
3
|
import requests
|
|
4
|
-
from ..config import
|
|
4
|
+
from ..config import base_url
|
|
5
5
|
from .authenticator import Authenticator
|
|
6
6
|
import json
|
|
7
7
|
import pandas as pd
|
|
@@ -85,7 +85,7 @@ class Quotes:
|
|
|
85
85
|
except:
|
|
86
86
|
raise Exception(f"'tickers' parameter must be an array of strings.")
|
|
87
87
|
|
|
88
|
-
url = f"{
|
|
88
|
+
url = f"{base_url}/api/v1/marketdata/br/b3/{mode}/quotes/{market_type}/tickers?tickers={tickers}"
|
|
89
89
|
|
|
90
90
|
response = requests.request("GET", url, headers=self.headers)
|
|
91
91
|
if response.status_code == 200:
|
|
@@ -148,7 +148,7 @@ class Quotes:
|
|
|
148
148
|
if not isinstance(ticker_type, str):
|
|
149
149
|
raise Exception(f"'ticker_type' parameter must be a string. Input: '{ticker_type}'")
|
|
150
150
|
|
|
151
|
-
url = f"{
|
|
151
|
+
url = f"{base_url}/api/v1/marketdata/br/b3/{mode}/quotes/{market_type}/top-bottom?variation={variation}&n={n}&type={ticker_type}"
|
|
152
152
|
|
|
153
153
|
response = requests.request("GET", url, headers=self.headers)
|
|
154
154
|
if response.status_code == 200:
|
|
@@ -185,7 +185,7 @@ class Quotes:
|
|
|
185
185
|
if mode not in self.available_modes:
|
|
186
186
|
raise Exception(f"Must provide a valid 'mode' parameter. Input: '{mode}'. Accepted values: {self.available_modes}")
|
|
187
187
|
|
|
188
|
-
url = f"{
|
|
188
|
+
url = f"{base_url}/api/v1/marketdata/br/b3/{mode}/quotes/{market_type}/available-tickers"
|
|
189
189
|
response = requests.request("GET", url, headers=self.headers)
|
|
190
190
|
|
|
191
191
|
if response.status_code == 200:
|
|
@@ -58,7 +58,7 @@ class ReferenceData:
|
|
|
58
58
|
if raw_data:
|
|
59
59
|
return response.json()
|
|
60
60
|
else:
|
|
61
|
-
return pd.DataFrame(response.json()
|
|
61
|
+
return pd.DataFrame(response.json())
|
|
62
62
|
else:
|
|
63
63
|
response = json.loads(response.text)
|
|
64
64
|
raise BadResponse(f'Error: {response.get("ApiClientError", "")}')
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name:
|
|
3
|
-
Version: 3.1
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: btgsolutions_dataservices_python_client
|
|
3
|
+
Version: 3.2.1
|
|
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
|
-
License: UNKNOWN
|
|
8
|
-
Platform: UNKNOWN
|
|
9
7
|
Requires-Python: >=3.9,<3.14
|
|
10
8
|
Description-Content-Type: text/markdown
|
|
11
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
|
|
12
23
|
|
|
13
24
|
# BTG Solutions - Data Services
|
|
14
25
|
|
|
@@ -98,11 +109,11 @@ ws.run(on_message=lambda message: print(message))
|
|
|
98
109
|
# sleep(1)
|
|
99
110
|
```
|
|
100
111
|
|
|
101
|
-
#####
|
|
112
|
+
##### Books, throttle (1 second throttle)
|
|
102
113
|
|
|
103
114
|
```python
|
|
104
115
|
import btgsolutions_dataservices as btg
|
|
105
|
-
ws = btg.MarketDataWebSocketClient(api_key='YOUR_API_KEY', data_type='
|
|
116
|
+
ws = btg.MarketDataWebSocketClient(api_key='YOUR_API_KEY', data_type='books', stream_type='throttle', instruments=['PETR4', 'VALE3'])
|
|
106
117
|
ws.run(on_message=lambda message: print(message))
|
|
107
118
|
|
|
108
119
|
## The following is optional to keep the program running in a .py file:
|
|
@@ -138,19 +149,6 @@ ws.run(on_message=lambda message: print(message))
|
|
|
138
149
|
# sleep(1)
|
|
139
150
|
```
|
|
140
151
|
|
|
141
|
-
##### Security List
|
|
142
|
-
|
|
143
|
-
```python
|
|
144
|
-
import btgsolutions_dataservices as btg
|
|
145
|
-
ws = btg.MarketDataWebSocketClient(api_key='YOUR_API_KEY', data_type='securities', data_subtype='derivatives')
|
|
146
|
-
ws.run(on_message=lambda message: print(message))
|
|
147
|
-
|
|
148
|
-
## The following is optional to keep the program running in a .py file:
|
|
149
|
-
# from time import sleep
|
|
150
|
-
# while True:
|
|
151
|
-
# sleep(1)
|
|
152
|
-
```
|
|
153
|
-
|
|
154
152
|
##### Security Status
|
|
155
153
|
|
|
156
154
|
```python
|
|
@@ -181,20 +179,6 @@ ws.run(on_message=lambda message: print(message))
|
|
|
181
179
|
# sleep(1)
|
|
182
180
|
```
|
|
183
181
|
|
|
184
|
-
##### Candles (1 second candles)
|
|
185
|
-
|
|
186
|
-
```python
|
|
187
|
-
import btgsolutions_dataservices as btg
|
|
188
|
-
ws = btg.MarketDataWebSocketClient(api_key='YOUR_API_KEY', data_type='candles-1S', stream_type='realtime')
|
|
189
|
-
ws.run(on_message=lambda message: print(message))
|
|
190
|
-
ws.candle_subscribe(list_instruments=['PETR4','VALE3'], candle_type='partial')
|
|
191
|
-
|
|
192
|
-
## The following is optional to keep the program running in a .py file:
|
|
193
|
-
# from time import sleep
|
|
194
|
-
# while True:
|
|
195
|
-
# sleep(1)
|
|
196
|
-
```
|
|
197
|
-
|
|
198
182
|
#### Intraday Candles
|
|
199
183
|
|
|
200
184
|
```python
|
|
@@ -232,7 +216,7 @@ last_event.get_trades(data_type='equities', ticker='VALE3')
|
|
|
232
216
|
```python
|
|
233
217
|
import btgsolutions_dataservices as btg
|
|
234
218
|
last_event = btg.TickerLastEvent(api_key='YOUR_API_KEY')
|
|
235
|
-
last_event.get_tobs(data_type='
|
|
219
|
+
last_event.get_tobs(data_type='equities')
|
|
236
220
|
```
|
|
237
221
|
|
|
238
222
|
#### Ticker Last Trading Status
|
|
@@ -469,5 +453,3 @@ ref = btg.ReferenceData(api_key='YOUR_API_KEY')
|
|
|
469
453
|
ref.ticker_reference(tickers=['VALE3','PETR4'])
|
|
470
454
|
```
|
|
471
455
|
|
|
472
|
-
|
|
473
|
-
|
|
@@ -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='3.1
|
|
25
|
+
version='3.2.1',
|
|
26
26
|
description=description,
|
|
27
27
|
long_description=long_description,
|
|
28
28
|
long_description_content_type='text/markdown',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|