Navigation

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

    ananthapad

    @ananthapad

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

    ananthapad Unfollow Follow

    Latest posts made by ananthapad

    • issue with placing ROBO order using SmartAPI(stoploass and traget in ANGELONE UI shown is different) – is my payload correct?

      def place_robo_order(
      self,
      instrument_list: List[Dict[str, Union[str, int]]],
      ticker: str,
      buy_sell: str,
      prices: List[float],
      quantity: int,
      exchange: str = 'NSE',
      ) -> Optional[Dict[str, Union[str, int]]]:
      """Place a robo order."""
      ltp: Optional[float] = self.get_ltp(instrument_list, ticker, exchange)
      if not ltp:
      return None
      limit_price = ltp + 1 if buy_sell == 'BUY' else ltp - 1
      if buy_sell == "SELL":
      stop_loss_price = limit_price * 1.01 # 1% above
      else: # BUY
      stop_loss_price = limit_price * 0.99 # 1% below

          capital = 5000
          quantity, target_price = calculate_quantity(capital, limit_price, stop_loss_price, risk_pct=0.01, rr=2)
          params: Dict[str, Union[str, int, float]] = {
              'variety': 'ROBO',
              'tradingsymbol': '{}-EQ'.format(ticker),
              'symboltoken': token_lookup(ticker, instrument_list),
              'transactiontype': buy_sell,
              'exchange': exchange,
              'ordertype': 'LIMIT',
              'producttype': 'BO',
              'price': limit_price,
              'duration': 'DAY',
              'stoploss': round(stop_loss_price, 1),
              'squareoff': round(target_price, 1),
              'quantity': quantity,
          }
          try:
              print('Payload of robo order:', params)
              response = self.smart_api.placeOrder(params)
              return response
          except Exception as e:
              print(e)
              return None
      

      my stoploss and traget should be point diffence to the buy price or actual price?

      posted in Python SDK
      A
      ananthapad
    • RE: "YOUR USER ID OR PASSWORD IS INVALID","errorcode":"AB1007"

      @admin Please migrate this USER ID for API access: S427978

      posted in General Discussion
      A
      ananthapad