btgsolutions-dataservices-python-client 4.6.0__tar.gz → 4.7.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 (50) hide show
  1. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/PKG-INFO +11 -1
  2. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/README.md +10 -0
  3. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/__init__.py +1 -1
  4. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/__init__.py +1 -0
  5. btgsolutions_dataservices_python_client-4.7.0/btgsolutions_dataservices/rest/algohunter.py +73 -0
  6. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/bulk_data.py +10 -4
  7. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices_python_client.egg-info/PKG-INFO +11 -1
  8. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices_python_client.egg-info/SOURCES.txt +1 -0
  9. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/LICENSE +0 -0
  10. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/MANIFEST.in +0 -0
  11. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/config.py +0 -0
  12. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/exceptions.py +0 -0
  13. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/alternative_data_catalog.py +0 -0
  14. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/alternative_data_companies.py +0 -0
  15. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/alternative_data_funds.py +0 -0
  16. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/alternative_data_macro_markets.py +0 -0
  17. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/alternative_data_metadata.py +0 -0
  18. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/alternative_data_ownership.py +0 -0
  19. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/alternative_data_people.py +0 -0
  20. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/authenticator.py +0 -0
  21. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/book_scope.py +0 -0
  22. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/broker_analytics.py +0 -0
  23. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/broker_reference.py +0 -0
  24. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/company_data.py +0 -0
  25. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/corporate_events.py +0 -0
  26. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/dataservices_catalog.py +0 -0
  27. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/hfn.py +0 -0
  28. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/historical_candles.py +0 -0
  29. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/historical_candles_crypto.py +0 -0
  30. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/intraday_candles.py +0 -0
  31. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/intraday_tick_data.py +0 -0
  32. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/public_sources.py +0 -0
  33. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/quotes.py +0 -0
  34. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/reference_data.py +0 -0
  35. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/stock_loan.py +0 -0
  36. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/ticker_last_event.py +0 -0
  37. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/rest/ticker_last_event_polling.py +0 -0
  38. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/websocket/__init__.py +0 -0
  39. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/websocket/broker_analytics.py +0 -0
  40. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/websocket/hfn_websocket_client.py +0 -0
  41. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/websocket/market_data_feed.py +0 -0
  42. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/websocket/market_data_websocket_client.py +0 -0
  43. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices/websocket/websocket_default_functions.py +0 -0
  44. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices_python_client.egg-info/dependency_links.txt +0 -0
  45. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices_python_client.egg-info/requires.txt +0 -0
  46. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/btgsolutions_dataservices_python_client.egg-info/top_level.txt +0 -0
  47. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/pyproject.toml +0 -0
  48. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/requirements.txt +0 -0
  49. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.0}/setup.cfg +0 -0
  50. {btgsolutions_dataservices_python_client-4.6.0 → btgsolutions_dataservices_python_client-4.7.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.6.0
3
+ Version: 4.7.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
+
@@ -1,4 +1,4 @@
1
- __version__ = "4.6.0"
1
+ __version__ = "4.7.0"
2
2
 
3
3
  from .websocket import *
4
4
  from .rest import *
@@ -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-Current-Rows",
17
- "X-Contracted-Limit-Rows",
18
- "X-Remaining-Rows",
19
- "X-Already-Billed",
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: btgsolutions-dataservices-python-client
3
- Version: 4.6.0
3
+ Version: 4.7.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