Navigation

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

    projectSB

    @projectSB

    5
    Reputation
    37
    Posts
    16
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    projectSB Follow

    Best posts made by projectSB

    • AngelOne RMS is unable to quickly adjust margins for spreads!

      @admin @Moderator_1 @Moderator_2

      Hi folks,

      Please explain in which way the RMS system in AngelOne works?

      Consider a simple Calendar spread - a near PUT sell, a far PUT buy.
      Approx margin required is Rs.30000 for the whole spread.

      Situation 1:
      When I want to sell the near PUT, if I have already bought the far PUT, do I get the margin benefit?
      That is will the order execute if I have 30000 in funds, instead of the naked PUT sell margin of RS 1,20,000 approx.

      or Situation 2:
      When I want to sell the near PUT, I MUST have the full margin available (Rs. 1,20, 000 approx), regardless of the the previous far PUT (hedge) being bought or not?

      Please confirm!

      Note: In Zerodha, this margin benefit is automatic. That is, it happens like in situation 1. If I have bought my hedge beforehand, I get full margin benefit during my sell leg.

      posted in General Discussion
      P
      projectSB
    • RE: Websocket2.0 just stops after running for 1 min without any errors etc.

      @af I'm using the Websocket version 2.0 code as provided in this Github link:

      https://github.com/angel-one/smartapi-python

      This portion:

      ####### Websocket V2 sample code #######

      from SmartApi.smartWebSocketV2 import SmartWebSocketV2
      from logzero import logger

      AUTH_TOKEN = "Your Auth_Token"
      API_KEY = "Your Api_Key"
      CLIENT_CODE = "Your Client Code"
      FEED_TOKEN = "Your Feed_Token"
      correlation_id = "abc123"
      action = 1
      mode = 1
      token_list = [
      {
      "exchangeType": 1,
      "tokens": ["26009"]
      }
      ]
      sws = SmartWebSocketV2(AUTH_TOKEN, API_KEY, CLIENT_CODE, FEED_TOKEN)

      def on_data(wsapp, message):
      logger.info("Ticks: {}".format(message))
      # close_connection()

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

      def on_error(wsapp, error):
      logger.error(error)

      def on_close(wsapp):
      logger.info("Close")

      def close_connection():
      sws.close_connection()

      Assign the callbacks.

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

      sws.connect()

      posted in Python SDK
      P
      projectSB
    • Websocket2.0 just stops after running for 1 min without any errors etc.

      @admin - Please look into this. I'm trying to run the WebSocket 2.0. The App starts fine, tokens were subscribed, and I start getting feed properly.
      But after around 30 seconds, I see a message Attempting to Reconnect.. feed still goes fine. After, this around 20-30 seconds later the App just exits, WITHOUT any errors. This is becoming a real pain!

      Here is the log:
      2023-08-30 14:32:42,571 [{'exchangeType': 2, 'tokens': ['35048']}]
      2023-08-30 14:32:42,714 Websocket connected
      2023-08-30 14:32:42,714 Connection opened, subscriptions done
      2023-08-30 14:33:02,774 error from callback <bound method SmartWebSocketV2._on_pong of <SmartApi.smartWebSocketV2.SmartWebSocketV2 object at 0x000001AB63A9FFD0>>: byte indices must be integers or slices, not str
      2023-08-30 14:33:02,962 Websocket connected
      2023-08-30 14:33:02,962 Connection opened, subscriptions done
      2023-08-30 14:33:23,056 error from callback <bound method SmartWebSocketV2._on_pong of <SmartApi.smartWebSocketV2.SmartWebSocketV2 object at 0x000001AB63A9FFD0>>: byte indices must be integers or slices, not str
      2023-08-30 14:33:23,103 error from callback <bound method SmartWebSocketV2._on_close of <SmartApi.smartWebSocketV2.SmartWebSocketV2 object at 0x000001AB63A9FFD0>>: SmartWebSocketV2._on_close() takes 2 positional arguments but 4 were given
      2023-08-30 14:33:23,103 error from callback <bound method SmartWebSocketV2._on_close of <SmartApi.smartWebSocketV2.SmartWebSocketV2 object at 0x000001AB63A9FFD0>>: SmartWebSocketV2._on_close() takes 2 positional arguments but 4 were given

      posted in Python SDK
      P
      projectSB
    • This is how a profitable position ends up losing due to unreliable SmartAPIs: Max retries exceeded with url: /rest/secure/angelbroking/order/v1/placeOrder (Caused by ConnectTimeoutError

      @admin @Moderator_1 @Moderator_2

      Could someone please explain why I got this error while placing orders today?

      Sequence of events:
      1 order was placed and it was Completed
      LOG entry: 2024-02-16 15:04:40,330 BUY avgPrice of BANKNIFTY29FEB2446600CE: 623.45 order_ID: 240216001663375 complete

      The second order got the following error:

      LOG entry: 2024-02-16 15:04:47,346 HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Max retries exceeded with url: /rest/secure/angelbroking/order/v1/placeOrder (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0F5F12C8>, 'Connection to apiconnect.angelbroking.com timed out. (connect timeout=7)'))

      Client code: S382492

      Note:

      1. The failed order did not reach the portal at all. Had to exit remaining ones manually, with loss!

      2. I have been using the same code block for last few days, and it was working fine, so its NOT a code issue.

      3. It was only the 2nd order, thus rate limit could NOT have exceeded.

      Please provide a proper explanation, and how to rectify it. Else I will have to switch back to Zerodha. Also, try answering my previous queries, which are still open without replies.

      posted in Python SDK
      P
      projectSB

    Latest posts made by projectSB

    • getMargin function is not considering active positions for margin calculations

      Hi @admin ,

      smartApi.getMarginApi(position_params) - This API is supposed to calculate the margin requirement for the basket of orders included in the 'position_params'.

      However, this is not considering the already open positions for margin calculations. So, it becomes very difficult to calculate the exact cash requirement for us traders in real time, for legged option positions.

      Is this expected? Or how do I force the API to consider active positions?

      Please help!
      Thanks!
      -Sid

      posted in Python SDK
      P
      projectSB
    • RE: Web Socket Issue

      @Nichil72 I have messaged you, and shared my email.

      posted in Java SDK
      P
      projectSB
    • RE: Web Socket Issue

      @Nichil72 Message me directly. I can help with Python development.

      posted in Java SDK
      P
      projectSB
    • RE: Release Note: Free Historical Data Access for Indices, NSE, NFO, BSE, BFO, MCX, and CDS with SmartAPI!

      @Moderator_1 Yes please! OI data will help us a lot

      posted in General Discussion
      P
      projectSB
    • RE: Websocket Connection automatically closes after placing a order

      @rohit4417k Are you placing orders from the same thread as Websocket?
      If yes, then it will disconnect as order placement makes the Websocket out of sync. Always, use a separate thread for monitoring data and placing orders etc. Your Websocket thread should ONLY fetch the data and store in some data structure.

      I had faced this issue, and this was my way of resolving it. Others might have different opinion as well.

      posted in Python SDK
      P
      projectSB
    • How many simultaneous instances are allowed for a single client of SmartAPI?

      @admin @Moderator_1 @Moderator_2 @Moderator_3

      How many simultaneous instances of SmartAPI applications are allowed for a single client of AngelOne?

      posted in General Discussion
      P
      projectSB
    • RE: I think they are changing or updating the script master

      @Mnagesh I hate when A1 folks change things without notification! They don't understand the kind of disruption and anxiety it creates.

      @admin @Moderator_1 @Moderator_2 - What is the update regarding this issue?

      posted in General Discussion
      P
      projectSB
    • SmartAPI website shows weird URL - cloudFront

      Hi @admin @Moderator_1 @Moderator_2

      Is there a change in the URL of the SmartAPI pages? When I try to login to SmartAPI to enable TOTP, I see this as the URL:

      https://d24vxxstyf61rc.cloudfront.net/enable-totp

      Is this valid? Or this might be a phishing attack?? Please confirm ASAP!

      Here is the screenshot for the same:

      SmartAPI_cloudFront.JPG

      posted in General Discussion
      P
      projectSB
    • RE: AngelOne RMS is unable to quickly adjust margins for spreads!

      @Moderator_1 Hello, what is the update on this issue?

      Also, please mention if there is any difference in INTRADAY margin vs CARRYFORWARD margin. If yes, then by how much?
      Or you can use current week's Nifty ATM options to get the answer.

      You can use the example mentioned in the screenshot itself. I don't think that we get any leverage in FNO trading from AngelOne. Please confirm. In that case we will use only CARRYFORWARD orders.

      posted in General Discussion
      P
      projectSB
    • RE: AngelOne RMS is unable to quickly adjust margins for spreads!

      @Moderator_1 And also note that, I always trigger BUY orders, wait for its completion and then trigger SELL orders to get the margin benefits. FYI

      posted in General Discussion
      P
      projectSB