Skip to content

Commit

Permalink
first release
Browse files Browse the repository at this point in the history
  • Loading branch information
kambalatech committed Jul 29, 2021
1 parent 7d48d3e commit c36172e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
dist
NorenRestApiPy.egg-info
ven
19 changes: 9 additions & 10 deletions src/NorenApi.py → NorenRestApiPy/NorenApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down Expand Up @@ -40,7 +39,7 @@ def reportmsg(msg):
#print(msg)
logger.debug(msg)

class StarApi:
class NorenApi:
__service_config = {
'host': 'http://wsapihost/',
'routes': {
Expand All @@ -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
Expand Down Expand Up @@ -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']}"
Expand Down Expand Up @@ -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']}"
Expand Down Expand Up @@ -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']}"
Expand Down Expand Up @@ -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']}"
Expand All @@ -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']}"
Expand All @@ -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']}"
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import setuptools
from distutils.core import setup
#python setup.py bdist_wheel --universal


with open("README.md", "r") as fh:
Expand Down

0 comments on commit c36172e

Please sign in to comment.