shner-elmo / tradezero-api Goto Github PK
View Code? Open in Web Editor NEWA package for executing orders and retrieving data through the TradeZero web platform
License: MIT License
A package for executing orders and retrieving data through the TradeZero web platform
License: MIT License
hello is there a way to know only the locates price and not locate
Can you add 'Top List' with column filters? Tks
Hello again.
I could run your project under linux whitout issues, but I am having dificulties to run under windows trought vscode.
After cloning the repo and setting a enviroment with the IDE, I get this output:
PS C:\Users\gonza\Documents\tradezero-api-1> c:; cd 'c:\Users\gonza\Documents\tradezero-api-1'; & 'c:\Users\gonza\Documents\tradezero-api-1\.venv\Scripts\python.exe'
'c:\Users\gonza\.vscode\extensions\ms-python.python-2023.8.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '62578' '--' 'c:\Users\gonza\Documents\tradezero-api-1\tradezero_api\tradeZero.py'
last: 1.43, Quantity 100, High: 3.11, Low: 1.51
Traceback (most recent call last):
File "c:\Users\gonza\Documents\tradezero-api-1\tradezero_api\tradeZero.py", line 21, in <module>
if (tz.Portfolio.invested(symbol_name)):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gonza\Documents\tradezero-api-1\tradezero_api\portfolio.py", line 58, in invested
data = self.portfolio('dict')
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gonza\Documents\tradezero-api-1\tradezero_api\portfolio.py", line 33, in portfolio
df.columns = [
^^^^^^^^^^
File "c:\Users\gonza\Documents\tradezero-api-1\.venv\Lib\site-packages\pandas\core\generic.py", line 5915, in __setattr__
return object.__setattr__(self, name, value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pandas\_libs\properties.pyx", line 69, in pandas._libs.properties.AxisProperty.__set__
File "c:\Users\gonza\Documents\tradezero-api-1\.venv\Lib\site-packages\pandas\core\generic.py", line 823, in _set_axis
self._mgr.set_axis(axis, labels)
File "c:\Users\gonza\Documents\tradezero-api-1\.venv\Lib\site-packages\pandas\core\internals\managers.py", line 230, in set_axis
self._validate_set_axis(axis, new_labels)
File "c:\Users\gonza\Documents\tradezero-api-1\.venv\Lib\site-packages\pandas\core\internals\base.py", line 70, in _validate_set_axis
raise ValueError(
ValueError: Length mismatch: Expected axis has 1 elements, new values have 11 elements
Any clues what to do to resolve this ?
Thanks
When I run this:
from tradezero_api import TradeZero
tz = TradeZero(user_name='username', password='password')
tz.login(True)
tz.conn(True)
It loads fine, but eventually just a second or two later it disconnect and the browser shut down. Why does it produce that?
Nice app! This is a request. Would you care adding a gainers or gap up/down scanner?
Hi,
Think I found a bug in your code regarding function "Portfolio.invested(symbol_name)"
It only works when the account already have a position on that symbol, otherwise it fails always with something like this log.
Traceback (most recent call last):
File "c:\Users\gonza\Documents\tradezero-api\tradezero_api\tz.py", line 22, in <module>
if (tz.Portfolio.invested(symbol_name)):
File "C:\Users\gonza\Documents\tradezero-api\tradezero_api\portfolio.py", line 58, in invested
data = self.portfolio('dict')
File "C:\Users\gonza\Documents\tradezero-api\tradezero_api\portfolio.py", line 33, in portfolio
df.columns = [
File "c:\Users\gonza\Documents\tradezero-api\.venv\lib\site-packages\pandas\core\generic.py", line 5915, in __setattr__
return object.__setattr__(self, name, value)
File "pandas\_libs\properties.pyx", line 69, in pandas._libs.properties.AxisProperty.__set__
File "c:\Users\gonza\Documents\tradezero-api\.venv\lib\site-packages\pandas\core\generic.py", line 823, in _set_axis
self._mgr.set_axis(axis, labels)
File "c:\Users\gonza\Documents\tradezero-api\.venv\lib\site-packages\pandas\core\internals\managers.py", line 230, in set_axis
self._validate_set_axis(axis, new_labels)
File "c:\Users\gonza\Documents\tradezero-api\.venv\lib\site-packages\pandas\core\internals\base.py", line 70, in _validate_set_axis
raise ValueError(
ValueError: Length mismatch: Expected axis has 1 elements, new values have 11 elements
I have been triying to fix it for weeks to later do a pull request to you, but no results.
Could you guide me or give me some clues to fix this ?
Thank you!
Hello, first and foremost thank you for sharing your project.
As you may already know, tipical stop orders only work in regular time market hours, only limit orders do.
So your project could be very usefull to implement a feature that most brokers like tradezero don't have.
I made a first approach to this idea with something like the following code:
import time
from tradezero_api import TradeZero
from tradezero_api import Order
tz = TradeZero(user_name='TzUsername', password='TzPassword')
tz.login()
symbol_name='XELA'
quantity=1
offset=1.0
high=6.0
low=5.5
while (True):
if not tz.conn():
tz.login()
ticker = tz.data(symbol_name)
if (tz.Portfolio.invested(symbol_name)):
if (str({ticker.last}) >= str({high})):
tz.limit_order(Order.COVER, symbol_name, quantity, high+offset)
if (str({ticker.last}) <= str({low})):
tz.limit_order(Order.COVER, symbol_name, quantity, low)
time.sleep(1)
I just tested and it worked.
it surelly could be made way better than this, but that would be the main idea.
Further improvements can be:
Do you think would possible to achieve this in a way better way than this very basic and uggly code ?
If I can help in some way please let me know.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.