shner-elmo / tradezero-api

A package for executing orders and retrieving data through the TradeZero web platform

Home Page:https://shner-elmo.github.io/tradezero-api/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to know only locate price and not locate

Stockxavier opened this issue · comments

hello is there a way to know only the locates price and not locate

Yes, there is a way.
To get the locate-price without accepting it, you must pass: max_price=0.

Because if the locate-price is less than max_price it will just decline the locate.
Check out the docstring here, and you can see that here it will click on the cancel button instead of accept, and you can view the price from the named tuple that is returned by the function (try this: print(tz.locate_stock('GME', 100, max_price=0).price_per_share).

thanks that will solve my problem ill test it out when market opens. also another question while i have the library connected to my tz account i cant open my tradezero right to watch charts etc?

Yes, there is a way. To get the locate-price without accepting it, you must pass: max_price=0.

Because if the locate-price is less than max_price it will just decline the locate. Check out the docstring here, and you can see that here it will click on the cancel button instead of accept, and you can view the price from the named tuple that is returned by the function (try this: print(tz.locate_stock('GME', 100, max_price=0).price_per_share).

this is the error i am getting ---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[9], line 1
----> 1 print(tz.locate_stock('GME', 100, max_price=0).price_per_share)

AttributeError: 'NoneType' object has no attribute 'price_per_share'

thanks that will solve my problem ill test it out when market opens. also another question while i have the library connected to my tz account i cant open my tradezero right to watch charts etc?

Thats a good question. Unfortunately, you can only have one instance of the TZ WebFree platform open at a time,
so if you open a second (whether it's a second tab or a different device) it will disconnect you from the last one, you can test this, but you can't open a second instance.

So if you want to view the charts or place an order you should use the same instance as the tradezero-api is using.

This error:

AttributeError: 'NoneType' object has no attribute 'price_per_share'

Means that the value returned by the tz.locate_stock()method is None, try while the market is open (not today:)