Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. namanviz
    N
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    namanviz

    @namanviz

    1
    Reputation
    8
    Posts
    3
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    namanviz Follow

    Best posts made by namanviz

    • making websocket callbacks as async

      Hello,
      so below is the code posted on github for accessing real time data.
      Can anyone please help me in converting this to a async code

      from smartapi import SmartWebSocket

      feed_token=092017047

      FEED_TOKEN="YOUR_FEED_TOKEN"
      CLIENT_CODE="YOUR_CLIENT_CODE"

      token="mcx_fo|224395"

      token="EXCHANGE|TOKEN_SYMBOL" #SAMPLE: nse_cm|2885&nse_cm|1594&nse_cm|11536&nse_cm|3045

      token="mcx_fo|226745&mcx_fo|220822&mcx_fo|227182&mcx_fo|221599"

      task="mw" # mw|sfi|dp

      ss = SmartWebSocket(FEED_TOKEN, CLIENT_CODE)

      def on_message(ws, message):
      print("Ticks: {}".format(message))

      def on_open(ws):
      print("on open")
      ss.subscribe(task,token)

      def on_error(ws, error):
      print(error)

      def on_close(ws):
      print("Close")

      Assign the callbacks.

      ss._on_open = on_open
      ss._on_message = on_message
      ss._on_error = on_error
      ss._on_close = on_close

      ss.connect()

      so i am trying to do something like this:

      async with smartapi_websocket(client_id, api_id, etc....) as ws:
      here I perform other async calls, and probably do not disturb the main thread*

      posted in Python SDK
      N
      namanviz

    Latest posts made by namanviz

    • RE: unable to connect to websocket order status

      @subodh I have built a solution/workaround but I am still testing it,
      @admin can you please share any update on this, I've also suggested to include all the details when you send the orderID just after the order is placed, https://smartapi.angelbroking.com/topic/1893/return-order-details-in-placeorder-function-instead-of-just-the-orderid

      posted in Python SDK
      N
      namanviz
    • return order details in placeOrder function instead of just the orderID

      @admin @administrators there is a function called 'placeOrder' in the 'SmartConnect' class in the SmartConnect.py file, and the function returns the order ID if the order is placed successfully.
      So instead of returning just the order ID can you please change it to return the completely executed order with the details such as orderID, trade executed price, quantity, time, etc.
      If this is done then we can possibly avoid the calls to getOrderBook.
      I understand that for a single order with large quantities of shares being traded on 'market-type' orders multiple trades will sum into one order but the above mentioned can be implemented.

      Thank you

      posted in Python SDK
      N
      namanviz
    • RE: Websocket Order status handshake 400 error

      @ashu27 yes, I am getting the same error.

      posted in Python SDK
      N
      namanviz
    • RE: Websocket Order status handshake 400 error

      @ashu27 ok, thank you for the update. Let's hope we get some update soon.

      posted in Python SDK
      N
      namanviz
    • RE: Websocket Order status handshake 400 error

      @ashu27 @admin @administrators Hello, was this issue resolved please? I have also sent an email on api@angelbroking.com, can the admin/s please assist on this?

      Best regards.

      posted in Python SDK
      N
      namanviz
    • RE: Websocket Order status

      @ananya Hello, I have emailed you few queries around this on ananya.aakash@zohomail.in, highly appreciate if you can assist on those.
      Best regards.

      posted in Python SDK
      N
      namanviz
    • RE: making websocket callbacks as async

      @Sukhwant280 Hi Sukhwant, actually I am just using tick data and previous day data to trade programmatically so I am not storing any thing, what is your requirement exactly? I'll try to assist.

      Best regards.

      posted in Python SDK
      N
      namanviz
    • making websocket callbacks as async

      Hello,
      so below is the code posted on github for accessing real time data.
      Can anyone please help me in converting this to a async code

      from smartapi import SmartWebSocket

      feed_token=092017047

      FEED_TOKEN="YOUR_FEED_TOKEN"
      CLIENT_CODE="YOUR_CLIENT_CODE"

      token="mcx_fo|224395"

      token="EXCHANGE|TOKEN_SYMBOL" #SAMPLE: nse_cm|2885&nse_cm|1594&nse_cm|11536&nse_cm|3045

      token="mcx_fo|226745&mcx_fo|220822&mcx_fo|227182&mcx_fo|221599"

      task="mw" # mw|sfi|dp

      ss = SmartWebSocket(FEED_TOKEN, CLIENT_CODE)

      def on_message(ws, message):
      print("Ticks: {}".format(message))

      def on_open(ws):
      print("on open")
      ss.subscribe(task,token)

      def on_error(ws, error):
      print(error)

      def on_close(ws):
      print("Close")

      Assign the callbacks.

      ss._on_open = on_open
      ss._on_message = on_message
      ss._on_error = on_error
      ss._on_close = on_close

      ss.connect()

      so i am trying to do something like this:

      async with smartapi_websocket(client_id, api_id, etc....) as ws:
      here I perform other async calls, and probably do not disturb the main thread*

      posted in Python SDK
      N
      namanviz