pyalgotrading 2025.3.1__py3-none-any.whl → 2026.2.1__py3-none-any.whl
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.
- pyalgotrading/algobulls/api.py +7 -7
- pyalgotrading/algobulls/connection.py +6 -4
- pyalgotrading/strategy/__init__.py +1 -0
- {pyalgotrading-2025.3.1.dist-info → pyalgotrading-2026.2.1.dist-info}/METADATA +1 -1
- {pyalgotrading-2025.3.1.dist-info → pyalgotrading-2026.2.1.dist-info}/RECORD +8 -8
- {pyalgotrading-2025.3.1.dist-info → pyalgotrading-2026.2.1.dist-info}/LICENSE +0 -0
- {pyalgotrading-2025.3.1.dist-info → pyalgotrading-2026.2.1.dist-info}/WHEEL +0 -0
- {pyalgotrading-2025.3.1.dist-info → pyalgotrading-2026.2.1.dist-info}/top_level.txt +0 -0
pyalgotrading/algobulls/api.py
CHANGED
|
@@ -26,6 +26,7 @@ class AlgoBullsAPI:
|
|
|
26
26
|
"""
|
|
27
27
|
self.connection = connection
|
|
28
28
|
self.headers = None
|
|
29
|
+
self.cookies = None
|
|
29
30
|
self.page_size = 1000
|
|
30
31
|
self.__key_backtesting = {} # strategy-cstc_id mapping
|
|
31
32
|
self.__key_papertrading = {} # strategy-cstc_id mapping
|
|
@@ -45,8 +46,8 @@ class AlgoBullsAPI:
|
|
|
45
46
|
access_token: Access token generated by logging to the URL given by the `get_authorization_url()` method
|
|
46
47
|
"""
|
|
47
48
|
|
|
48
|
-
self.
|
|
49
|
-
'
|
|
49
|
+
self.cookies = {
|
|
50
|
+
'auth_token': f'{access_token}',
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
def _send_request(self, method: str = 'get', endpoint: str = '', base_url: str = SERVER_ENDPOINT, params: [str, dict] = None, json_data: [str, dict] = None, requires_authorization: bool = True,
|
|
@@ -67,8 +68,8 @@ class AlgoBullsAPI:
|
|
|
67
68
|
"""
|
|
68
69
|
|
|
69
70
|
url = f'{base_url}{endpoint}'
|
|
70
|
-
|
|
71
|
-
r = requests.request(method=method, headers=headers, url=url, params=params, json=json_data)
|
|
71
|
+
cookies = self.cookies if requires_authorization else None
|
|
72
|
+
r = requests.request(method=method, headers=self.headers, cookies=cookies, url=url, params=params, json=json_data)
|
|
72
73
|
|
|
73
74
|
if r.status_code == 200:
|
|
74
75
|
try:
|
|
@@ -240,9 +241,8 @@ class AlgoBullsAPI:
|
|
|
240
241
|
`GET` v3/build/python/user/strategy/code/{strategy_code}
|
|
241
242
|
"""
|
|
242
243
|
|
|
243
|
-
params = {}
|
|
244
244
|
endpoint = f'v3/build/python/user/strategy/code/{strategy_code}'
|
|
245
|
-
response = self._send_request(endpoint=endpoint, params=
|
|
245
|
+
response = self._send_request(endpoint=endpoint, params={'type': 'user'})
|
|
246
246
|
|
|
247
247
|
return response
|
|
248
248
|
|
|
@@ -304,7 +304,7 @@ class AlgoBullsAPI:
|
|
|
304
304
|
|
|
305
305
|
# Configure the params
|
|
306
306
|
key = self.__get_key(strategy_code=strategy_code, trading_type=trading_type)
|
|
307
|
-
endpoint = f'
|
|
307
|
+
endpoint = f'v2/portfolio/tweakconfig/{key}'
|
|
308
308
|
print('Setting Strategy Config...', end=' ')
|
|
309
309
|
response = self._send_request(method='post', endpoint=endpoint, json_data=strategy_config)
|
|
310
310
|
print('Success.')
|
|
@@ -66,7 +66,7 @@ class AlgoBullsConnection:
|
|
|
66
66
|
Returns:
|
|
67
67
|
Token URL
|
|
68
68
|
"""
|
|
69
|
-
url = '
|
|
69
|
+
url = f'{AlgoBullsAPI.SERVER_ENDPOINT}settings?section=developerOptions'
|
|
70
70
|
print(f'Please login to this URL to get your unique token: {url}')
|
|
71
71
|
|
|
72
72
|
def set_access_token(self, access_token, validate_token=True):
|
|
@@ -796,7 +796,7 @@ class AlgoBullsConnection:
|
|
|
796
796
|
if len(_) == 2 and EXCHANGE_LOCALE_MAP.get(_[0]) is not None:
|
|
797
797
|
location = EXCHANGE_LOCALE_MAP[_[0]]
|
|
798
798
|
else:
|
|
799
|
-
print('Warning: Valid exchange not given, assuming exchange as "NSE_EQ".\n Expected format for giving an instrument "<EXCHANGE>:<TRADING_SYMBOL>"\nPossible exchange values include: {EXCHANGE_LOCALE_MAP.keys()}')
|
|
799
|
+
print(f'Warning: Valid exchange not given, assuming exchange as "NSE_EQ".\n Expected format for giving an instrument "<EXCHANGE>:<TRADING_SYMBOL>"\nPossible exchange values include: {EXCHANGE_LOCALE_MAP.keys()}')
|
|
800
800
|
location = EXCHANGE_LOCALE_MAP[Locale.DEFAULT.value]
|
|
801
801
|
|
|
802
802
|
# generate instruments' id list
|
|
@@ -805,7 +805,10 @@ class AlgoBullsConnection:
|
|
|
805
805
|
exchange, tradingsymbol = _instrument.split(':')
|
|
806
806
|
instrument_results = self.search_instrument(instrument=tradingsymbol, exchange=exchange)
|
|
807
807
|
for _ in instrument_results:
|
|
808
|
-
|
|
808
|
+
_exchange, _tradingsymbol = _['value'].split(':')
|
|
809
|
+
|
|
810
|
+
# The function `search_instrument` returns `NSE_EQ` instead of `NSE`; The below like handles that scenario
|
|
811
|
+
if _tradingsymbol == tradingsymbol and (_exchange == exchange or _exchange.split('_')[0] == exchange):
|
|
809
812
|
instrument_list.append({'id': _["id"]})
|
|
810
813
|
break
|
|
811
814
|
|
|
@@ -834,7 +837,6 @@ class AlgoBullsConnection:
|
|
|
834
837
|
'instruments': {
|
|
835
838
|
'instruments': instrument_list
|
|
836
839
|
},
|
|
837
|
-
'lots': lots,
|
|
838
840
|
'userParams': restructured_strategy_parameters,
|
|
839
841
|
'candleDuration': candle_interval.value,
|
|
840
842
|
'strategyMode': strategy_mode.value
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
pyalgotrading/__init__.py,sha256=UzrsH5H2VlSxwdH8z0MnFqQoj_ggI6nEcVr4dLVFEeI,213
|
|
2
2
|
pyalgotrading/constants.py,sha256=bLSLD8oWMviPRXbytxjuNq7m6_VMJft5jvlxCTusGac,8054
|
|
3
3
|
pyalgotrading/algobulls/__init__.py,sha256=IRkbWtJfgQnPH7gikjqpa6QsYnmk_NQ1lwtx7LPIC6c,133
|
|
4
|
-
pyalgotrading/algobulls/api.py,sha256=
|
|
5
|
-
pyalgotrading/algobulls/connection.py,sha256=
|
|
4
|
+
pyalgotrading/algobulls/api.py,sha256=tetKc9hdqywxSWRxuG4WM_GGmr4xpYpHLSzXWNLSfys,19775
|
|
5
|
+
pyalgotrading/algobulls/connection.py,sha256=1QtrlLriI1267PVZJrMGEhAMsL79Dq_2cshB_CigdCs,59996
|
|
6
6
|
pyalgotrading/algobulls/exceptions.py,sha256=B96On8cN8tgtX7i4shKOlYfvjSjvspIRPbOpyF-jn0I,2187
|
|
7
7
|
pyalgotrading/broker/__init__.py,sha256=jXVWBVRlqzevKxNDqrPANJz9WubROBes8gaKcxcYz58,66
|
|
8
8
|
pyalgotrading/broker/broker_connection_base.py,sha256=vAJN5EAQuVfL8Ngf03wsaI5TTGdziCHKCb0bczGgSJ0,7594
|
|
@@ -16,7 +16,7 @@ pyalgotrading/order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
|
16
16
|
pyalgotrading/order/order_base.py,sha256=trC_bvazLNvvuGqZEdacxzlacc3g73ZvqpedYYwuKJA,1742
|
|
17
17
|
pyalgotrading/order/order_bracket_base.py,sha256=7Sj0nlCWE20wZiZ12NciptPYKKGE9KsnKLCjdO7sKV4,3576
|
|
18
18
|
pyalgotrading/order/order_regular_base.py,sha256=wOFmv7QnxJvNKtqdoZn0a-cbTotik4cap5Z5mz0Qcs0,2313
|
|
19
|
-
pyalgotrading/strategy/__init__.py,sha256=
|
|
19
|
+
pyalgotrading/strategy/__init__.py,sha256=w6V14SfMsVSWQp5Nmx789pzk4DNzJkDYsbT7anM6Ro8,181
|
|
20
20
|
pyalgotrading/strategy/strategy_base.py,sha256=9I6ZdZT1IimO9g03QURrFo2Pxvs4Dsk8Ybdtij8ZIUQ,4717
|
|
21
21
|
pyalgotrading/strategy/strategy_options_base_v2.py,sha256=3SfCvWjz8eGXtlB2hIXREAODV0PbrtXIYgXRFB08UjQ,2765
|
|
22
22
|
pyalgotrading/strategy/utils.py,sha256=fEQw5jndBSIMDfSdWPHz1xjfskuN5uyiytOoeyiVPFU,627
|
|
@@ -29,8 +29,8 @@ pyalgotrading/utils/candlesticks/__init__.py,sha256=maIn__tvTvJDjldPhU9agBcNNuRO
|
|
|
29
29
|
pyalgotrading/utils/candlesticks/heikinashi.py,sha256=SpcuK7AYV0sgzcw-DMfLNtTDn2RfWqGvWBt4no7yKD4,2003
|
|
30
30
|
pyalgotrading/utils/candlesticks/linebreak.py,sha256=cYwoETMrenWOa06d03xASZoiou-qRz7n2mZYCi5ilEs,1434
|
|
31
31
|
pyalgotrading/utils/candlesticks/renko.py,sha256=zovQ6D658pBLas86FuTu9fU3-Kkv2hM-4h7OQJjdxng,2089
|
|
32
|
-
pyalgotrading-
|
|
33
|
-
pyalgotrading-
|
|
34
|
-
pyalgotrading-
|
|
35
|
-
pyalgotrading-
|
|
36
|
-
pyalgotrading-
|
|
32
|
+
pyalgotrading-2026.2.1.dist-info/LICENSE,sha256=-LLEprvixKS-LwHef99YQSOFon_tWeTwJRAWuUwwr1g,1066
|
|
33
|
+
pyalgotrading-2026.2.1.dist-info/METADATA,sha256=Xzrq2U1EWTc0reXv966TLYJvBAI33jCXRwHIbn5_Hmk,5829
|
|
34
|
+
pyalgotrading-2026.2.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
35
|
+
pyalgotrading-2026.2.1.dist-info/top_level.txt,sha256=A12PTnbXqO3gsZ0D0Gkyzf_OYRQxjJvtg3MqN-Ur2zY,14
|
|
36
|
+
pyalgotrading-2026.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|