Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    Relation Between exch_seg from instrument json and exchange type in WebSocket API

    Python SDK
    2
    2
    9
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sagargami777 last edited by

      Hi,
      I am trying to find exchange type for in WebSocket API from exch_seg value in instrument json.

      Can you provide Logic for this mapping? as Directly passing "exch_seg" does not return Market Data.

      => Unique Exchange from JSON
      CDS
      NCO
      NFO
      BSE
      NCDEX
      NSE
      MCX
      BFO

      =>Expected Exchange Type in WebSocket API
      NSE_CM = 1
      NSE_FO = 2
      BSE_CM = 3
      BSE_FO = 4
      MCX_FO = 5
      NCX_FO = 7
      CDE_FO = 13

      A 1 Reply Last reply Reply Quote 0
      • A
        algo_trading_50 @sagargami777 last edited by

        @sagargami777 Javascript example::

        // Reference:: https://smartapi.angelbroking.com/docs/WebSocket2
        let ExchangeType = {
          nse_cm: 1,
          nse_fo: 2,
          bse_cm: 3,
          bse_fo: 4,
          mcx_fo: 5,
          ncx_fo: 7,
          cde_fo: 13
        }
        
        // Reference: https://smartapi.angelbroking.com/docs/Orders#place
        let ExchangeMap = {
          BSE: 'bse_cm',
          NSE: 'nse_cm',
          NFO: 'nse_fo',
          MCX: 'mcx_fo',
          BFO: 'bse_fo',
          CDS: 'cde_fo'
        }
        
        let exch_seg = 'NSE'
        
        console.log(ExchangeType[ExchangeMap[exch_seg]])
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post