btgsolutions-dataservices-python-client 2.18.2__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.
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/PKG-INFO +15 -6
- btgsolutions_dataservices_python_client-3.0.0/btgsolutions_dataservices/config.py +137 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/reference_data.py +2 -2
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/ticker_last_event.py +11 -11
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices_python_client.egg-info/PKG-INFO +16 -7
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/setup.py +1 -1
- btgsolutions_dataservices_python_client-2.18.2/btgsolutions_dataservices/config.py +0 -179
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/LICENSE +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/MANIFEST.in +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/README.md +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/__init__.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/exceptions.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/__init__.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/authenticator.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/bulk_data.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/company_data.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/corporate_events.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/hfn.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/historical_candles.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/intraday_candles.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/intraday_tick_data.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/public_sources.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/quotes.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/stock_loan.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/rest/ticker_last_event_polling.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/websocket/__init__.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/websocket/hfn_websocket_client.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/websocket/market_data_feed.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/websocket/market_data_websocket_client.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices/websocket/websocket_default_functions.py +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices_python_client.egg-info/SOURCES.txt +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices_python_client.egg-info/dependency_links.txt +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices_python_client.egg-info/requires.txt +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/btgsolutions_dataservices_python_client.egg-info/top_level.txt +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/pyproject.toml +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/requirements.txt +0 -0
- {btgsolutions_dataservices_python_client-2.18.2 → btgsolutions_dataservices_python_client-3.0.0}/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
|
+
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
|
-
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
|
|
|
@@ -469,5 +480,3 @@ ref = btg.ReferenceData(api_key='YOUR_API_KEY')
|
|
|
469
480
|
ref.ticker_reference(tickers=['VALE3','PETR4'])
|
|
470
481
|
```
|
|
471
482
|
|
|
472
|
-
|
|
473
|
-
|
|
@@ -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
|
+
}
|
|
@@ -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
|
|
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"{
|
|
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
|
|
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 = '
|
|
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": ['
|
|
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"{
|
|
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: '
|
|
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"{
|
|
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"{
|
|
134
|
+
url = f"{base_url}/api/v1/marketdata/br/b3/snapshot/status/batch?tickers={tickers}"
|
|
135
135
|
else:
|
|
136
|
-
url = f"{
|
|
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'
|
|
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"{
|
|
172
|
-
f"{
|
|
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,14 +1,25 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name:
|
|
3
|
-
Version:
|
|
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
|
-
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
|
|
|
@@ -469,5 +480,3 @@ ref = btg.ReferenceData(api_key='YOUR_API_KEY')
|
|
|
469
480
|
ref.ticker_reference(tickers=['VALE3','PETR4'])
|
|
470
481
|
```
|
|
471
482
|
|
|
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='
|
|
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
|
-
}
|
|
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
|
|
File without changes
|
|
File without changes
|