btgsolutions-dataservices-python-client 4.6.0__tar.gz → 4.8.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-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/PKG-INFO +11 -1
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/README.md +10 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/__init__.py +1 -1
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/__init__.py +1 -0
- btgsolutions_dataservices_python_client-4.8.0/btgsolutions_dataservices/rest/algohunter.py +73 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/bulk_data.py +10 -4
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/dataservices_catalog.py +15 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/ticker_last_event.py +27 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices_python_client.egg-info/PKG-INFO +11 -1
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices_python_client.egg-info/SOURCES.txt +1 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/LICENSE +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/MANIFEST.in +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/config.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/exceptions.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/alternative_data_catalog.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/alternative_data_companies.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/alternative_data_funds.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/alternative_data_macro_markets.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/alternative_data_metadata.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/alternative_data_ownership.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/alternative_data_people.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/authenticator.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/book_scope.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/broker_analytics.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/broker_reference.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/company_data.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/corporate_events.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/hfn.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/historical_candles.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/historical_candles_crypto.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/intraday_candles.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/intraday_tick_data.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/public_sources.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/quotes.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/reference_data.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/stock_loan.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/rest/ticker_last_event_polling.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/websocket/__init__.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/websocket/broker_analytics.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/websocket/hfn_websocket_client.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/websocket/market_data_feed.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/websocket/market_data_websocket_client.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices/websocket/websocket_default_functions.py +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices_python_client.egg-info/dependency_links.txt +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices_python_client.egg-info/requires.txt +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/btgsolutions_dataservices_python_client.egg-info/top_level.txt +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/pyproject.toml +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/requirements.txt +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/setup.cfg +0 -0
- {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.8.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: btgsolutions_dataservices_python_client
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.8.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
|
|
@@ -751,3 +751,13 @@ ref = btg.ReferenceData(api_key='YOUR_API_KEY')
|
|
|
751
751
|
ref.ticker_reference(tickers=['VALE3','PETR4'])
|
|
752
752
|
```
|
|
753
753
|
|
|
754
|
+
#### Algo Hunter
|
|
755
|
+
|
|
756
|
+
```python
|
|
757
|
+
import btgsolutions_dataservices as btg
|
|
758
|
+
algohunter = AlgoHunter(api_key='YOUR_API_KEY')
|
|
759
|
+
algohunter.get_thermometer()
|
|
760
|
+
algohunter.get_recently_detected(ticker='PETR4')
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
|
|
@@ -741,3 +741,13 @@ ref = btg.ReferenceData(api_key='YOUR_API_KEY')
|
|
|
741
741
|
ref.ticker_reference(tickers=['VALE3','PETR4'])
|
|
742
742
|
```
|
|
743
743
|
|
|
744
|
+
#### Algo Hunter
|
|
745
|
+
|
|
746
|
+
```python
|
|
747
|
+
import btgsolutions_dataservices as btg
|
|
748
|
+
algohunter = AlgoHunter(api_key='YOUR_API_KEY')
|
|
749
|
+
algohunter.get_thermometer()
|
|
750
|
+
algohunter.get_recently_detected(ticker='PETR4')
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
|
|
@@ -16,6 +16,7 @@ from .ticker_last_event_polling import TickerLastEventPolling
|
|
|
16
16
|
from .broker_reference import BrokerReference
|
|
17
17
|
from .book_scope import BookScope
|
|
18
18
|
from .broker_analytics import BrokerAnalytics
|
|
19
|
+
from .algohunter import AlgoHunter
|
|
19
20
|
from .alternative_data_metadata import AlternativeDataMetadata
|
|
20
21
|
from .alternative_data_companies import AlternativeDataCompanies
|
|
21
22
|
from .alternative_data_people import AlternativeDataPeople
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
from ..exceptions import BadResponse
|
|
3
|
+
import requests
|
|
4
|
+
from ..config import url_api_v1
|
|
5
|
+
from .authenticator import Authenticator
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AlgoHunter:
|
|
9
|
+
"""
|
|
10
|
+
This class provides access to the AlgoHunter analytics endpoints.
|
|
11
|
+
|
|
12
|
+
* Main use case:
|
|
13
|
+
|
|
14
|
+
>>> from btgsolutions_dataservices import AlgoHunter
|
|
15
|
+
>>> algohunter = AlgoHunter(api_key='YOUR_API_KEY')
|
|
16
|
+
>>> algohunter.get_thermometer()
|
|
17
|
+
>>> algohunter.get_recently_detected(ticker='PETR4')
|
|
18
|
+
|
|
19
|
+
Parameters
|
|
20
|
+
----------------
|
|
21
|
+
api_key: str
|
|
22
|
+
User identification key.
|
|
23
|
+
Field is required.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
_BASE_PATH = f"{url_api_v1}/marketdata/analytics/algohunter"
|
|
27
|
+
|
|
28
|
+
def __init__(self, api_key: str):
|
|
29
|
+
self.api_key = api_key
|
|
30
|
+
self.__authenticator = Authenticator(self.api_key)
|
|
31
|
+
|
|
32
|
+
def get_thermometer(self) -> List[dict]:
|
|
33
|
+
"""
|
|
34
|
+
Returns thermometer values for assets with algorithmic activity
|
|
35
|
+
detected in the last 5 minutes.
|
|
36
|
+
"""
|
|
37
|
+
url = f"{self._BASE_PATH}/thermometer"
|
|
38
|
+
headers = {"authorization": f"Bearer {self.__authenticator.token}"}
|
|
39
|
+
response = requests.get(url, headers=headers, timeout=30)
|
|
40
|
+
|
|
41
|
+
if response.status_code != 200:
|
|
42
|
+
self._raise_error(response)
|
|
43
|
+
|
|
44
|
+
return response.json()
|
|
45
|
+
|
|
46
|
+
def get_recently_detected(self, ticker: str) -> dict:
|
|
47
|
+
"""
|
|
48
|
+
Returns algorithms likely running in the last few minutes
|
|
49
|
+
for a given ticker, grouped by side (buyer/seller) and broker.
|
|
50
|
+
|
|
51
|
+
Parameters
|
|
52
|
+
----------
|
|
53
|
+
ticker : str
|
|
54
|
+
Ticker symbol. Required.
|
|
55
|
+
|
|
56
|
+
"""
|
|
57
|
+
url = f"{self._BASE_PATH}/recently-detected"
|
|
58
|
+
headers = {"authorization": f"Bearer {self.__authenticator.token}"}
|
|
59
|
+
response = requests.get(url, params={"ticker": ticker}, headers=headers, timeout=30)
|
|
60
|
+
|
|
61
|
+
if response.status_code != 200:
|
|
62
|
+
self._raise_error(response)
|
|
63
|
+
|
|
64
|
+
return response.json()
|
|
65
|
+
|
|
66
|
+
@staticmethod
|
|
67
|
+
def _raise_error(response):
|
|
68
|
+
try:
|
|
69
|
+
error_body = response.json()
|
|
70
|
+
detail = error_body.get("detail", error_body.get("error", response.text))
|
|
71
|
+
except Exception:
|
|
72
|
+
detail = response.text
|
|
73
|
+
raise BadResponse(f"Error {response.status_code}: {detail}")
|
|
@@ -13,11 +13,17 @@ BILLING_HEADER_NAMES = (
|
|
|
13
13
|
"X-Dry-Run",
|
|
14
14
|
"X-Billable",
|
|
15
15
|
"X-Requested-Rows",
|
|
16
|
-
"X-
|
|
17
|
-
"X-
|
|
18
|
-
"X-
|
|
19
|
-
"X-
|
|
16
|
+
"X-Billing-Period",
|
|
17
|
+
"X-Charge-Type",
|
|
18
|
+
"X-Contract-Type",
|
|
19
|
+
"X-Price-Per-Million-Ticks-BRL",
|
|
20
|
+
"X-Billing-Amount-BRL",
|
|
21
|
+
"X-Current-Month-Billing-Amount-BRL",
|
|
22
|
+
"X-Monthly-Billing-Limit-BRL",
|
|
23
|
+
"X-Remaining-Monthly-Billing-Amount-BRL",
|
|
20
24
|
"X-Would-Exceed-Limit",
|
|
25
|
+
"X-License-Active-Before-Access",
|
|
26
|
+
"X-Leased-Until",
|
|
21
27
|
)
|
|
22
28
|
|
|
23
29
|
|
|
@@ -575,6 +575,20 @@ DATASERVICES_ENDPOINTS: dict[str, dict[str, Any]] = {
|
|
|
575
575
|
"not a last trade or top-of-book snapshot."
|
|
576
576
|
),
|
|
577
577
|
},
|
|
578
|
+
"TickerLastEvent.get_settlement_price": {
|
|
579
|
+
"category": "last_event",
|
|
580
|
+
"path": "/api/v1/marketdata/br/b3/snapshot/settlement-price/batch",
|
|
581
|
+
"method": "GET",
|
|
582
|
+
"client": "TickerLastEvent",
|
|
583
|
+
"description": (
|
|
584
|
+
"Return the most recent settlement price records for a list of B3 "
|
|
585
|
+
"derivatives tickers. Results are grouped by ticker and price type."
|
|
586
|
+
),
|
|
587
|
+
"parameters": {
|
|
588
|
+
"tickers": "List of derivatives tickers such as ['WDOH25', 'WINM25'].",
|
|
589
|
+
},
|
|
590
|
+
"relationships": ["ticker_discovery", "reference_enrichment"],
|
|
591
|
+
},
|
|
578
592
|
"ReferenceData.ticker_reference": {
|
|
579
593
|
"category": "reference_data",
|
|
580
594
|
"path": "/api/v1/marketdata/br/b3/snapshot/instruments/batch",
|
|
@@ -997,6 +1011,7 @@ DATASERVICES_TOOL_ENDPOINTS: dict[str, str] = {
|
|
|
997
1011
|
"get_last_top_of_book": "TickerLastEvent.get_tobs",
|
|
998
1012
|
"get_trading_status": "TickerLastEvent.get_status",
|
|
999
1013
|
"list_last_event_tickers": "TickerLastEvent.get_available_tickers",
|
|
1014
|
+
"get_last_settlement_price": "TickerLastEvent.get_settlement_price",
|
|
1000
1015
|
"get_ticker_reference": "ReferenceData.ticker_reference",
|
|
1001
1016
|
"get_corporate_events": "CorporateEvents.get",
|
|
1002
1017
|
"get_company_general_info": "CompanyData.general_info",
|
|
@@ -145,6 +145,33 @@ class TickerLastEvent:
|
|
|
145
145
|
response = json.loads(response.text)
|
|
146
146
|
raise BadResponse(f'Error: {response}')
|
|
147
147
|
|
|
148
|
+
def get_settlement_price(self, tickers: List[str], raw_data: bool = False):
|
|
149
|
+
|
|
150
|
+
"""
|
|
151
|
+
This method provides the most recent settlement price records for a list of B3 derivatives tickers.
|
|
152
|
+
|
|
153
|
+
Parameters
|
|
154
|
+
----------------
|
|
155
|
+
tickers: List[str]
|
|
156
|
+
List of ticker symbols.
|
|
157
|
+
Field is required. Example: ['WDOH25', 'WINM25'].
|
|
158
|
+
raw_data: bool
|
|
159
|
+
If false, returns data in a dataframe. If true, returns raw data.
|
|
160
|
+
Field is not required. Default: False.
|
|
161
|
+
"""
|
|
162
|
+
|
|
163
|
+
url = f"{base_url}/api/v1/marketdata/br/b3/snapshot/settlement-price/batch?tickers={','.join(tickers)}"
|
|
164
|
+
|
|
165
|
+
response = requests.request("GET", url, headers={"authorization": f"Bearer {self.authenticator.token}"})
|
|
166
|
+
if response.status_code == 200:
|
|
167
|
+
if raw_data:
|
|
168
|
+
return response.json()
|
|
169
|
+
else:
|
|
170
|
+
return pd.DataFrame([r for records in response.json().values() for r in records])
|
|
171
|
+
else:
|
|
172
|
+
response = json.loads(response.text)
|
|
173
|
+
raise BadResponse(f'Error: {response.get("ApiClientError", response.get("error", ""))}')
|
|
174
|
+
|
|
148
175
|
def get_available_tickers(self,type:str, data_type:str):
|
|
149
176
|
|
|
150
177
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: btgsolutions-dataservices-python-client
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.8.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
|
|
@@ -751,3 +751,13 @@ ref = btg.ReferenceData(api_key='YOUR_API_KEY')
|
|
|
751
751
|
ref.ticker_reference(tickers=['VALE3','PETR4'])
|
|
752
752
|
```
|
|
753
753
|
|
|
754
|
+
#### Algo Hunter
|
|
755
|
+
|
|
756
|
+
```python
|
|
757
|
+
import btgsolutions_dataservices as btg
|
|
758
|
+
algohunter = AlgoHunter(api_key='YOUR_API_KEY')
|
|
759
|
+
algohunter.get_thermometer()
|
|
760
|
+
algohunter.get_recently_detected(ticker='PETR4')
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
|
|
@@ -8,6 +8,7 @@ btgsolutions_dataservices/__init__.py
|
|
|
8
8
|
btgsolutions_dataservices/config.py
|
|
9
9
|
btgsolutions_dataservices/exceptions.py
|
|
10
10
|
btgsolutions_dataservices/rest/__init__.py
|
|
11
|
+
btgsolutions_dataservices/rest/algohunter.py
|
|
11
12
|
btgsolutions_dataservices/rest/alternative_data_catalog.py
|
|
12
13
|
btgsolutions_dataservices/rest/alternative_data_companies.py
|
|
13
14
|
btgsolutions_dataservices/rest/alternative_data_funds.py
|
|
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
|
|
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
|