Navigation

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

    Login execute ho chuka hai ya nhi for niche di coding ki mutabik

    General Discussion
    0
    7
    21
    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.
    • A
      as5320029 last edited by

      Respected Sir/ma'am,

      Sir/ma'am muje app ki ik help chahiye thi kafi din parshan hu

      Problem - yeh aa rahi hai ke Jab order place hota hai execute nhi huya hota hai tab LIVE_FEED_JSON['3045']['ltp'] < 760 hone par short sell order lag jata hai

      Main chatahu - Jab order place hota hai fir execute ho tab hi place order ki position exit ke liye sell order request lagaye

      Execute ka logic add kare - jab place huya order execute na ho tab tak place order ki position exit karne ki liye sell order request na Lage

      def monitor_and_place_orders():
      order_1_placed = False
      order_1_id = None

      while True:
          try:
              if not order_1_placed and '3045' in LIVE_FEED_JSON and LIVE_FEED_JSON['3045']['ltp'] > 764:
                  trigger_price_1 = LIVE_FEED_JSON['3045']['ltp'] 
                  order_price_1 = LIVE_FEED_JSON['3045']['ltp'] 
                  order_1_id = place_order_1('3045', '1', trigger_price_1, order_price_1)
                  if order_1_id:
                      print('place_order_1', LIVE_FEED_JSON['3045']['ltp'])
                      order_1_placed = True
                      
      
              # Check for condition to place sell order
              if order_1_placed and '3045' in LIVE_FEED_JSON and LIVE_FEED_JSON['3045']['ltp'] < 760:
                  sell_order_id = place_sell_order('3045', '1', order_1_id)
                  if sell_order_id:
                      print('Sell order placed for order ID:', order_1_id)
                      break # Exit loop after placing sell order
      
          except Exception as e:
              print("Main loop error:", e)
              # Retry placing orders if an error occurs
              continue
      
          time.sleep(10)
      
      Mnagesh A 2 Replies Last reply Reply Quote 0
      • Mnagesh
        Mnagesh @as5320029 last edited by

        @as5320029 write in English so that we may understand and help if possible

        Now I am full time Algo Trader and successfully developed my own Apps for my personal use.

        A 3 Replies Last reply Reply Quote 0
        • A
          as5320029 @Mnagesh last edited by

          @Mnagesh Sir, I wanted your help for a long time

          Below is the coding related - sell part

          Problem - I have that when the order place is pending but not executed then LIVE_FEED_JSON['3045']['ltp'] < 760 (less than 760) then a short sell order appears.

          I want - when the order is placed and then executed, then only sell order request is made to exit the position of the place order. (If the order is only pending but not executed, then the sell order request should not appear)

          Which function will be required to find out the status of an order through order status so that we can take an action after that.

          def monitor_and_place_orders():
          order_1_placed = False
          order_1_id = None

           while True:
               try:
                   if not order_1_placed and '3045' in LIVE_FEED_JSON and LIVE_FEED_JSON['3045']['ltp'] > 764:
                       trigger_price_1 = LIVE_FEED_JSON['3045']['ltp']
                       order_price_1 = LIVE_FEED_JSON['3045']['ltp']
                       order_1_id = place_order_1('3045', '1', trigger_price_1, order_price_1)
                       if order_1_id:
                           print('place_order_1', LIVE_FEED_JSON['3045']['ltp'])
                           order_1_placed = True
                          
          
                   # Check for condition to place sell order
                   if order_1_placed and '3045' in LIVE_FEED_JSON and LIVE_FEED_JSON['3045']['ltp'] < 760:
                       sell_order_id = place_sell_order('3045', '1', order_1_id)
                       if sell_order_id:
                           print('Sell order placed for order ID:', order_1_id)
                           break # Exit loop after placing sell order
          
          1 Reply Last reply Reply Quote 0
          • A
            as5320029 last edited by

            Sir, I wanted your help for a long time

            Below is the coding related - sell part

            Problem - I have that when the order place is pending but not executed then LIVE_FEED_JSON['3045']['ltp'] < 760 (less than 760) then a short sell order appears.

            I want - when the order is placed and then executed, then only sell order request is made to exit the position of the place order. (If the order is only pending but not executed, then the sell order request should not appear)

            Which function will be required to find out the status of an order through order status so that we can take an action after that.

            def monitor_and_place_orders():
            order_1_placed = False
            order_1_id = None

             while True:
                 try:
                     if not order_1_placed and '3045' in LIVE_FEED_JSON and LIVE_FEED_JSON['3045']['ltp'] > 764:
                         trigger_price_1 = LIVE_FEED_JSON['3045']['ltp']
                         order_price_1 = LIVE_FEED_JSON['3045']['ltp']
                         order_1_id = place_order_1('3045', '1', trigger_price_1, order_price_1)
                         if order_1_id:
                             print('place_order_1', LIVE_FEED_JSON['3045']['ltp'])
                             order_1_placed = True
                            
            
                     # Check for condition to place sell order
                     if order_1_placed and '3045' in LIVE_FEED_JSON and LIVE_FEED_JSON['3045']['ltp'] < 760:
                         sell_order_id = place_sell_order('3045', '1', order_1_id)
                         if sell_order_id:
                             print('Sell order placed for order ID:', order_1_id)
                             break # Exit loop after placing sell order
            
            1 Reply Last reply Reply Quote 0
            • A
              as5320029 @as5320029 last edited by

              @as5320029 Sir, I wanted your help for a long time

              Below is the coding related - sell part

              Problem - I have that when the order place is pending but not executed then LIVE_FEED_JSON['3045']['ltp'] < 760 (less than 760) then a short sell order appears.

              I want - when the order is placed and then executed, then only sell order request is made to exit the position of the place order. (If the order is only pending but not executed, then the sell order request should not appear)

              Which function will be required to find out the status of an order through order status so that we can take an action after that.

              def monitor_and_place_orders():
              order_1_placed = False
              order_1_id = None

               while True:
                   try:
                       if not order_1_placed and '3045' in LIVE_FEED_JSON and LIVE_FEED_JSON['3045']['ltp'] > 764:
                           trigger_price_1 = LIVE_FEED_JSON['3045']['ltp']
                           order_price_1 = LIVE_FEED_JSON['3045']['ltp']
                           order_1_id = place_order_1('3045', '1', trigger_price_1, order_price_1)
                           if order_1_id:
                               print('place_order_1', LIVE_FEED_JSON['3045']['ltp'])
                               order_1_placed = True
                              
              
                       # Check for condition to place sell order
                       if order_1_placed and '3045' in LIVE_FEED_JSON and LIVE_FEED_JSON['3045']['ltp'] < 760:
                           sell_order_id = place_sell_order('3045', '1', order_1_id)
                           if sell_order_id:
                               print('Sell order placed for order ID:', order_1_id)
                               break # Exit loop after placing sell order
              
              1 Reply Last reply Reply Quote 0
              • A
                as5320029 @Mnagesh last edited by

                @Mnagesh Sir, I wanted your help for a long time

                Below is the coding related - sell part

                Problem - I have that when the order place is pending but not executed then LIVE_FEED_JSON['3045']['ltp'] < 760 (less than 760) then a short sell order appears.

                I want - when the order is placed and then executed, then only sell order request is made to exit the position of the place order. (If the order is only pending but not executed, then the sell order request should not appear)

                Which function will be required to find out the status of an order through order status so that we can take an action after that.

                def monitor_and_place_orders():
                order_1_placed = False
                order_1_id = None

                 while True:
                     try:
                         if not order_1_placed and '3045' in LIVE_FEED_JSON and LIVE_FEED_JSON['3045']['ltp'] > 764:
                             trigger_price_1 = LIVE_FEED_JSON['3045']['ltp']
                             order_price_1 = LIVE_FEED_JSON['3045']['ltp']
                             order_1_id = place_order_1('3045', '1', trigger_price_1, order_price_1)
                             if order_1_id:
                                 print('place_order_1', LIVE_FEED_JSON['3045']['ltp'])
                                 order_1_placed = True
                                
                
                         # Check for condition to place sell order
                         if order_1_placed and '3045' in LIVE_FEED_JSON and LIVE_FEED_JSON['3045']['ltp'] < 760:
                             sell_order_id = place_sell_order('3045', '1', order_1_id)
                             if sell_order_id:
                                 print('Sell order placed for order ID:', order_1_id)
                                 break # Exit loop after placing sell order
                
                1 Reply Last reply Reply Quote 0
                • A
                  as5320029 @Mnagesh last edited by

                  @Mnagesh Sir, I wanted your help for a long time

                  Below is the coding related - sell part

                  Problem - I have that when the order place is pending but not executed then LIVE_FEED_JSON['3045']['ltp'] < 760 (less than 760) then a short sell order appears.

                  I want - when the order is placed and then executed, then only sell order request is made to exit the position of the place order. (If the order is only pending but not executed, then the sell order request should not appear)

                  Which function will be required to find out the status of an order through order status so that we can take an action after that.

                  def monitor_and_place_orders():
                  order_1_placed = False
                  order_1_id = None

                   while True:
                       try:
                           if not order_1_placed and '3045' in LIVE_FEED_JSON and LIVE_FEED_JSON['3045']['ltp'] > 764:
                               trigger_price_1 = LIVE_FEED_JSON['3045']['ltp']
                               order_price_1 = LIVE_FEED_JSON['3045']['ltp']
                               order_1_id = place_order_1('3045', '1', trigger_price_1, order_price_1)
                               if order_1_id:
                                   print('place_order_1', LIVE_FEED_JSON['3045']['ltp'])
                                   order_1_placed = True
                                  
                  
                           # Check for condition to place sell order
                           if order_1_placed and '3045' in LIVE_FEED_JSON and LIVE_FEED_JSON['3045']['ltp'] < 760:
                               sell_order_id = place_sell_order('3045', '1', order_1_id)
                               if sell_order_id:
                                   print('Sell order placed for order ID:', order_1_id)
                                   break # Exit loop after placing sell order
                  
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post