Code Monkey home page Code Monkey logo

tradezero-api's People

Contributors

shner-elmo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tradezero-api's Issues

Top List

Can you add 'Top List' with column filters? Tks

Order Confirmation

Hello! It is asked to confirm an order when I place a market or limit order.

image

How can I confirm that automatically using your module?

Thanks in advance!

Can't run under Windows (vscode)

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

Connect and disconnect very quickly

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?

Portfolio.invested(symbol)

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!

Stop Loss "Range" Orders for Pre Market and After Hours

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:

  • Specify multiple symbols (even if they aren't yet in porfolio)
  • Once they are in portfolio, Retrieve the quantity from there (since partials executions can occur)
  • Ability to send alerts (email)
  • (minor bug) Avoid put the same order again and again (while it's waiting to execute the order that has been placed)

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.