Navigation

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

    Bhanu

    @Bhanu

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

    Bhanu Follow

    Best posts made by Bhanu

    This user hasn't posted anything yet.

    Latest posts made by Bhanu

    • Not getting ticks

      Hi @admin
      when i tried to use websocketv2
      i am getting tick and after that i am getting b'\x00'

      below is the output

      on open
      Ticks: {'subscription_mode': 3, 'exchange_type': 1, 'token': '26009', 'sequence_number': 15648232, 'exchange_timestamp': 1698230200000, 'last_traded_price': 4283200, 'subscription_mode_val': 'SNAP_QUOTE', 'last_traded_quantity': 0, 'average_traded_price': 0, 'volume_trade_for_the_day': 0, 'total_buy_quantity': 0.0, 'total_sell_quantity': 0.0, 'open_price_of_the_day': 0, 'high_price_of_the_day': 0, 'low_price_of_the_day': 0, 'closed_price': 4315120, 'last_traded_timestamp': 0, 'open_interest': 21203640, 'open_interest_change_percentage': 4633259491834387275, 'upper_circuit_limit': 0, 'lower_circuit_limit': 0, '52_week_high_price': 0, '52_week_low_price': 0, 'best_5_buy_data': [{'flag': 1, 'quantity': 0, 'price': 0, 'no of orders': 0}, {'flag': 1, 'quantity': 0, 'price': 0, 'no of orders': 0}, {'flag': 1, 'quantity': 0, 'price': 0, 'no of orders': 0}, {'flag': 1, 'quantity': 0, 'price': 0, 'no of orders': 0}, {'flag': 1, 'quantity': 0, 'price': 0, 'no of orders': 0}], 'best_5_sell_data': [{'flag': 0, 'quantity': 0, 'price': 0, 'no of orders': 0}, {'flag': 0, 'quantity': 0, 'price': 0, 'no of orders': 0}, {'flag': 0, 'quantity': 0, 'price': 0, 'no of orders': 0}, {'flag': 0, 'quantity': 0, 'price': 0, 'no of orders': 0}, {'flag': 0, 'quantity': 0, 'price': 0, 'no of orders': 0}]}
      Ticks: b'\x00'
      Ticks: b'\x00'
      Ticks: b'\x00'
      Ticks: b'\x00'
      Ticks: b'\x00'
      Ticks: b'\x00'
      Ticks: b'\x00'
      Ticks: b'\x00'
      Ticks: b'\x00'
      Ticks: b'\x00'
      Ticks: b'\x00'

      below is my code

      from SmartApi import SmartConnect
      from SmartApi.smartWebSocketV2 import SmartWebSocketV2
      feed_token = obj.getfeedToken()

      sws = SmartWebSocketV2(data["data"]["jwtToken"], key_secret[0], key_secret[2], feed_token)

      correlation_id = "stream_1" #any string value which will help identify the specific streaming in case of concurrent streaming
      action = 1 #1 subscribe, 0 unsubscribe
      mode = 3 #1 for LTP, 2 for Quote and 2 for SnapQuote

      token_list = [{"exchangeType": 1, "tokens": ["26009"]}]

      def on_data(wsapp, message):
      print("Ticks: {}".format(message))

      def on_open(wsapp):
      print("on open")
      sws.subscribe(correlation_id, mode, token_list)

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

      Assign the callbacks.

      sws.on_open = on_open
      sws.on_data = on_data
      sws.on_error = on_error

      sws.connect()

      can you please tell me what is the issue

      posted in Python SDK
      B
      Bhanu