Metadata-Version: 2.1
Name: smartapi-python
Version: 1.0.3.1
Summary: Angel Broking openApi integration
Home-page: https://github.com/angelbroking-github/smartapi-python
Author: ab-smartapi
Author-email: smartapi.sdk@gmail.com
License: UNKNOWN
Description: # SMARTAPI-PYTHON
        
        SMARTAPI-PYTHON is a Python library for dealing AMX,that is a set of REST-like HTTP APIs that expose many capabilities required to build stock market investment and trading platforms. It lets you execute orders in real time.
        
        ## Installation
        
        Use the package manager [pip](https://pip.pypa.io/en/stable/) to install smartapi-python.
        
        ```bash
        pip install smartapi-python
        ```
        
        ## Usage
        
        ```python
        # package import statement
        from smartapi.smartConnect import SmartConnect
        
        #create object of call
        obj=SmartConnect()
        
        #login api call
        
        data = obj.generateSession("D88311","Angel@444")
        refreshToken= data['data']['refreshToken']
        
        #fetch User Profile
        userProfile= obj.getProfile(refreshToken)
        #place order
        try:
            orderparams = {
                "variety": "NORMAL",
                "tradingsymbol": "SBIN-EQ",
                "symboltoken": "3045",
                "transactiontype": "BUY",
                "exchange": "NSE",
                "ordertype": "LIMIT",
                "producttype": "INTRADAY",
                "duration": "DAY",
                "price": "19500",
                "squareoff": "0",
                "stoploss": "0",
                "quantity": "1"
                }
            orderId=obj.placeOrder(orderparams)
            print("The order id is: {}".format(orderId))
        except Exception as e:
            print("Order placement failed: {}".format(e.message))
        
        #logout
        try:
            logout=obj.terminateSession('D88311')
            print("Logout Successfull")
        except Exception as e:
            print("Logout failed: {}".format(e.message))
        
        #websocket
        from smartapi.smartSocket import SmartSocket
        FEED_TOKEN= "your feed token"
        CLIENT_CODE="your client code"
        token="channel you want the information of" #"nse_cm|2885&nse_cm|1594&nse_cm|11536"
        
        ss = SmartSocket(FEED_TOKEN, CLIENT_CODE)
        
        def on_tick(ws, tick):
            print("Ticks: {}".format(tick))
        
        def on_connect(ws, response):
            ws.send_request(token)
        
        def on_close(ws, code, reason):
            ws.stop()
        
        # Assign the callbacks.
        ss.on_ticks = on_tick
        ss.on_connect = on_connect
        ss.on_close = on_close
        
        ss.connect( )
        
        
        License
        MIT
        
        
        
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Programming Language :: Python
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Libraries
Description-Content-Type: text/markdown
