quantplay 2.0.66__tar.gz → 2.0.67__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.
- {quantplay-2.0.66 → quantplay-2.0.67}/PKG-INFO +1 -1
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/five_paisa.py +1 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/flattrade.py +5 -4
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/ft_utils/flattrade_utils.py +31 -4
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/kotak.py +11 -8
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/motilal.py +2 -1
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/shoonya.py +8 -4
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/upstox.py +1 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/zerodha.py +1 -1
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay.egg-info/PKG-INFO +1 -1
- {quantplay-2.0.66 → quantplay-2.0.67}/setup.py +1 -1
- {quantplay-2.0.66 → quantplay-2.0.67}/README.md +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/pyproject.toml +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/aliceblue.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/angelone.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/auto_login/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/auto_login/aliceblue.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/broker_factory.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/dhan.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/finvasia_utils/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/finvasia_utils/fa_noren.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/ft_utils/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/ft_utils/ft_noren.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/generics/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/generics/broker.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/iifl_xts.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/kite_utils.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/noren.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/uplink/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/uplink/uplink_utils.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/xts.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/xts_utils/Connect.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/xts_utils/Exception.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/xts_utils/InteractiveSocketClient.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/broker/xts_utils/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/exception/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/exception/exceptions.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/model/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/model/broker.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/model/generics.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/model/instrument_data.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/model/order_event.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/py.typed +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/utils/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/utils/caching.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/utils/constant.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/utils/exchange.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/utils/number_utils.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/utils/pickle_utils.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/utils/selenium_utils.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/wrapper/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/wrapper/aws/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay/wrapper/aws/s3.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay.egg-info/SOURCES.txt +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay.egg-info/dependency_links.txt +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay.egg-info/requires.txt +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/quantplay.egg-info/top_level.txt +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/setup.cfg +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/tests/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/tests/conftest.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/tests/wrapper/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/tests/wrapper/aws/__init__.py +0 -0
- {quantplay-2.0.66 → quantplay-2.0.67}/tests/wrapper/aws/s3_test.py +0 -0
|
@@ -2,12 +2,13 @@ import binascii
|
|
|
2
2
|
import hashlib
|
|
3
3
|
from queue import Queue
|
|
4
4
|
|
|
5
|
+
from kiteconnect.exceptions import TokenException
|
|
5
6
|
import requests
|
|
6
7
|
|
|
7
8
|
from quantplay.broker.ft_utils.flattrade_utils import FlatTradeUtils
|
|
8
9
|
from quantplay.broker.ft_utils.ft_noren import FT_NorenApi
|
|
9
10
|
from quantplay.broker.noren import Noren
|
|
10
|
-
from quantplay.exception.exceptions import
|
|
11
|
+
from quantplay.exception.exceptions import RetryableException
|
|
11
12
|
from quantplay.model.order_event import OrderUpdateEvent
|
|
12
13
|
|
|
13
14
|
|
|
@@ -57,12 +58,12 @@ class FlatTrade(Noren):
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
else:
|
|
60
|
-
raise
|
|
61
|
+
raise TokenException("Missing Arguments")
|
|
61
62
|
|
|
62
|
-
except
|
|
63
|
+
except TokenException:
|
|
63
64
|
raise
|
|
64
65
|
except binascii.Error:
|
|
65
|
-
raise
|
|
66
|
+
raise TokenException("Invalid TOTP key provided")
|
|
66
67
|
except Exception as e:
|
|
67
68
|
raise RetryableException(str(e))
|
|
68
69
|
|
|
@@ -22,6 +22,7 @@ class FlatTradeUtils:
|
|
|
22
22
|
totp_xpath = '//*[@id="pan"]'
|
|
23
23
|
|
|
24
24
|
login_xpath = '//*[@id="sbmt"]'
|
|
25
|
+
error_xpath = '//*[@id="app"]/div/div/div[2]/div/div[2]/div[1]/div/form/div[5]/div'
|
|
25
26
|
|
|
26
27
|
@staticmethod
|
|
27
28
|
@retry(
|
|
@@ -58,8 +59,34 @@ class FlatTradeUtils:
|
|
|
58
59
|
|
|
59
60
|
url = driver.current_url
|
|
60
61
|
|
|
62
|
+
if url.split("/")[2] == flattrade_url.split("/")[2]:
|
|
63
|
+
error_message = ""
|
|
64
|
+
|
|
65
|
+
try:
|
|
66
|
+
error_attempt = driver.find_element(
|
|
67
|
+
"xpath", FlatTradeUtils.error_xpath
|
|
68
|
+
)
|
|
69
|
+
error_message = error_attempt.text
|
|
70
|
+
|
|
71
|
+
if error_message in [
|
|
72
|
+
"Invalid Input : Wrong Password",
|
|
73
|
+
"Invalid API key",
|
|
74
|
+
]:
|
|
75
|
+
raise InvalidArgumentException(
|
|
76
|
+
f"Flattrade Login Failed: {error_message}"
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
except Exception as e:
|
|
80
|
+
Constants.logger.error(f"Flattrade Selenium Error : {e}")
|
|
81
|
+
traceback.print_exc()
|
|
82
|
+
|
|
83
|
+
finally:
|
|
84
|
+
Constants.logger.error(
|
|
85
|
+
f"Flattrade Unkown Selenium Error : {error_message}"
|
|
86
|
+
)
|
|
87
|
+
raise Exception(f"Flattrade Unkown Selenium Error : {error_message}")
|
|
88
|
+
|
|
61
89
|
try:
|
|
62
|
-
# TODO: IndexError: list index out of range
|
|
63
90
|
request_token = url.split("code=")[1].split("&")[0]
|
|
64
91
|
except Exception as e:
|
|
65
92
|
Constants.logger.error(f"Flattrade Selenium Error for {url}")
|
|
@@ -72,10 +99,10 @@ class FlatTradeUtils:
|
|
|
72
99
|
|
|
73
100
|
except binascii.Error:
|
|
74
101
|
raise InvalidArgumentException("Invalid TOTP key provided")
|
|
75
|
-
except InvalidArgumentException:
|
|
76
|
-
raise
|
|
102
|
+
except InvalidArgumentException as e:
|
|
103
|
+
raise e
|
|
77
104
|
except WebDriverException:
|
|
78
105
|
raise WrongLibrarySetup("Selenium setup need to be fixed")
|
|
79
106
|
except Exception as e:
|
|
80
|
-
|
|
107
|
+
traceback.print_exc()
|
|
81
108
|
raise RetryableException(str(e))
|
|
@@ -21,11 +21,8 @@ PROD_BASE_URL = "https://gw-napi.kotaksecurities.com/"
|
|
|
21
21
|
SESSION_PROD_BASE_URL = "https://napi.kotaksecurities.com/"
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
#
|
|
25
|
-
# pVwafvF3ssA_jFVbKPrwhKt7igwa
|
|
26
|
-
# Kotak@123
|
|
27
|
-
# +918149949114
|
|
28
|
-
# 491700
|
|
24
|
+
# from quantplay.broker.kotak import Kotak
|
|
25
|
+
# client = Kotak(None,"EvOUzPVqkwvlFl_6cZYZSCO5mwQa","pVwafvF3ssA_jFVbKPrwhKt7igwa","+918149949114","Kotak@123","491700")
|
|
29
26
|
|
|
30
27
|
|
|
31
28
|
class Kotak(Broker):
|
|
@@ -84,8 +81,6 @@ class Kotak(Broker):
|
|
|
84
81
|
data=json.dumps({"grant_type": "client_credentials"}),
|
|
85
82
|
)
|
|
86
83
|
|
|
87
|
-
print(session_init)
|
|
88
|
-
|
|
89
84
|
if not session_init.ok:
|
|
90
85
|
raise Exception("")
|
|
91
86
|
|
|
@@ -185,7 +180,15 @@ class Kotak(Broker):
|
|
|
185
180
|
return {"user_id": self.user_id or ""}
|
|
186
181
|
|
|
187
182
|
def margins(self) -> Dict[str, float]:
|
|
188
|
-
|
|
183
|
+
limits_resp = self.request(
|
|
184
|
+
"limits", body={"seg": "ALL", "exch": "ALL", "prod": "ALL"}
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
margins = {
|
|
188
|
+
"margin_used": limits_resp["MarginUsed"],
|
|
189
|
+
"margin_available": limits_resp["Net"],
|
|
190
|
+
}
|
|
191
|
+
return margins
|
|
189
192
|
|
|
190
193
|
# **
|
|
191
194
|
# ** POST/PUT Api's
|
|
@@ -139,8 +139,9 @@ class Motilal(Broker):
|
|
|
139
139
|
raise Exception("Missing Arguments")
|
|
140
140
|
|
|
141
141
|
self.user_id = self.headers["vendorinfo"]
|
|
142
|
+
|
|
142
143
|
except binascii.Error:
|
|
143
|
-
raise
|
|
144
|
+
raise TokenException("Invalid TOTP key provided")
|
|
144
145
|
except InvalidArgumentException:
|
|
145
146
|
raise
|
|
146
147
|
except Exception as e:
|
|
@@ -5,7 +5,11 @@ import pyotp
|
|
|
5
5
|
|
|
6
6
|
from quantplay.broker.finvasia_utils.fa_noren import FA_NorenApi
|
|
7
7
|
from quantplay.broker.noren import Noren
|
|
8
|
-
from quantplay.exception.exceptions import
|
|
8
|
+
from quantplay.exception.exceptions import (
|
|
9
|
+
InvalidArgumentException,
|
|
10
|
+
RetryableException,
|
|
11
|
+
TokenException,
|
|
12
|
+
)
|
|
9
13
|
from quantplay.model.order_event import OrderUpdateEvent
|
|
10
14
|
|
|
11
15
|
|
|
@@ -48,12 +52,12 @@ class FinvAsia(Noren):
|
|
|
48
52
|
imei=imei,
|
|
49
53
|
)
|
|
50
54
|
else:
|
|
51
|
-
raise
|
|
55
|
+
raise TokenException("Missing Args")
|
|
52
56
|
|
|
53
|
-
except
|
|
57
|
+
except TokenException:
|
|
54
58
|
raise
|
|
55
59
|
except binascii.Error:
|
|
56
|
-
raise
|
|
60
|
+
raise TokenException("Invalid TOTP key provided")
|
|
57
61
|
except Exception as e:
|
|
58
62
|
raise RetryableException(str(e))
|
|
59
63
|
|
|
@@ -133,6 +133,7 @@ class Upstox(Broker):
|
|
|
133
133
|
try:
|
|
134
134
|
symbol_info = self.symbol_data[f"{exchange}:{tradingsymbol}"]
|
|
135
135
|
# Market quotes and instruments - LTP quotes.
|
|
136
|
+
# TODO:Check Get FN->symbol_info
|
|
136
137
|
api_response = api_instance.ltp( # type: ignore
|
|
137
138
|
symbol_info.get("instrument_key"), self.api_version
|
|
138
139
|
)
|
|
@@ -112,7 +112,7 @@ class Zerodha(Broker):
|
|
|
112
112
|
|
|
113
113
|
def stream_order_data(self):
|
|
114
114
|
if self.wrapper.api_key is None or self.wrapper.access_token is None:
|
|
115
|
-
raise InvalidArgumentException("")
|
|
115
|
+
raise InvalidArgumentException("Zerodha WS: API Key or Access Token Missing")
|
|
116
116
|
|
|
117
117
|
kite_ticker = KiteTicker(self.wrapper.api_key, self.wrapper.access_token)
|
|
118
118
|
kite_ticker.on_order_update = self.on_order_update
|
|
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
|
|
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
|