Fetching a position on Ibridgepy

Helo there:



 I have noticed that in order t make reference to a particular ticker… the superSymbol() method is used… 



Now let's suppose I have a portafolio with more than one position open… is it possible to fetch the arguments of this method??? is it possible for example to fetch the primary exchange  and the tickers in order to apply certain strategies to each one using the superSymbol() method??

 

Hi Ghery,



Sorry for the late reply. Yes, you are right the "superSymbol()" function is used to create a security object or reference to a particular ticker. So is the "symbol" function. If you want to make a list of security objects or reference a list of tickers, you can use the "symbols()" function also. If you want to know the difference between these functions and how to use them, you can go to this youtube video guide: https://www.youtube.com/watch?v=QHj9AJLhg9c



If you wish to see the parameters of the "superSymbol()" function, you can check the documentation.



You can check every individual argument passed like this"

 

def initialize(context):
    context.security = superSymbol(secType='STK', symbol=['GOOG', 'AAPL'], currency='USD', exchange='SMART', primaryExchange='NASDAQ')
    

def handle_data(context, data):
    print('security = ', context.security)
    # symbol argument
    print(context.security.symbol)
    # exchange argument
    print(context.security.exchange)

Hope this is helpful. And sorry I didn't understand the last part of your question.

Thanks a lot… But what I mean was… if I have opened positions in two  stocks  like for example   OWUV, TSOI   and PIK, (the two first  are in the otcs, the last in Nasdaq)…   if I use the superSymbol() method… I need to specify primaryExchange='PINK', right??  I tested using the Symbol function and I got and error…

Hi Ghery,



If you are referring to multiple stocks you can use the "symbols()" function. Here is the link to the documentation of this function. You can also watch this youtube video guide on how to use this function: https://www.youtube.com/watch?v=QHj9AJLhg9c



Sorry, I am not sure how you can make reference to multiple stocks that are listed on different exchanges, using the "superSymbol()" function. You can ask this question directly to IBridgePy. Their email address is "IBridgePy@gmail.com". They will be able to answer your question better.