diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2a240ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +build +dist +NorenRestApiPy.egg-info +ven diff --git a/src/NorenApi.py b/NorenRestApiPy/NorenApi.py similarity index 96% rename from src/NorenApi.py rename to NorenRestApiPy/NorenApi.py index b3372bd..77828a5 100644 --- a/src/NorenApi.py +++ b/NorenRestApiPy/NorenApi.py @@ -10,7 +10,6 @@ from collections import OrderedDict from collections import namedtuple -#python setup.py bdist_wheel --universal Instrument = namedtuple('Instrument', ['exchange', 'token', 'symbol', 'name', 'expiry', 'lot_size']) @@ -40,7 +39,7 @@ def reportmsg(msg): #print(msg) logger.debug(msg) -class StarApi: +class NorenApi: __service_config = { 'host': 'http://wsapihost/', 'routes': { @@ -55,8 +54,8 @@ class StarApi: } def __init__(self, host, wsendpoint): - self.__service_config.host = host - self.__service_config.websocket_endpoint = wsendpoint + self.__service_config['host'] = host + self.__service_config['websocket_endpoint'] = wsendpoint self.__websocket = None self.__websocket_connected = False @@ -191,7 +190,7 @@ def start_websocket(self, subscribe_callback = None, def login(self, userid, password, twoFA, vendor_code, api_secret, imei): - config = StarApi.__service_config + config = NorenApi.__service_config #prepare the uri url = f"{config['host']}{config['routes']['authorize']}" @@ -255,7 +254,7 @@ def place_order(self, buy_or_sell, product_type, exchange, tradingsymbol, quantity, discloseqty, price_type, price=0.0, trigger_price=None, retention='DAY', amo='NO', remarks=None): - config = StarApi.__service_config + config = NorenApi.__service_config #prepare the uri url = f"{config['host']}{config['routes']['placeorder']}" @@ -291,7 +290,7 @@ def place_order(self, buy_or_sell, product_type, def modify_order(self, orderno, exchange, tradingsymbol, newquantity, newprice_type, newprice=0.0, newtrigger_price=None, amo='NO'): - config = StarApi.__service_config + config = NorenApi.__service_config #prepare the uri url = f"{config['host']}{config['routes']['modifyorder']}" @@ -322,7 +321,7 @@ def modify_order(self, orderno, exchange, tradingsymbol, newquantity, return resDict def cancel_order(self, orderno): - config = StarApi.__service_config + config = NorenApi.__service_config #prepare the uri url = f"{config['host']}{config['routes']['cancelorder']}" @@ -347,7 +346,7 @@ def cancel_order(self, orderno): return resDict def get_order_book(self): - config = StarApi.__service_config + config = NorenApi.__service_config #prepare the uri url = f"{config['host']}{config['routes']['orderbook']}" @@ -373,7 +372,7 @@ def get_order_book(self): return resDict def get_time_price_series(self, exchange, token, starttime=None, endtime=None): - config = StarApi.__service_config + config = NorenApi.__service_config #prepare the uri url = f"{config['host']}{config['routes']['TPSeries']}" diff --git a/src/__init__.py b/NorenRestApiPy/__init__.py similarity index 100% rename from src/__init__.py rename to NorenRestApiPy/__init__.py diff --git a/setup.py b/setup.py index 3b8ad07..434cc7d 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ import setuptools from distutils.core import setup +#python setup.py bdist_wheel --universal with open("README.md", "r") as fh: