Giter VIP home page Giter VIP logo

Comments (4)

kirkthaker avatar kirkthaker commented on July 3, 2024

Thanks for the feedback! I've made pretty much all of the fixes you've recommended. The only thing I've left is making getPortfolioStatus more elegant - I'll probably need to use a library like BeautifulSoup to do that, so I I need to read up on it first. Let me know what you think of the changes.

from investopedia-trading-api.

eugene-eeo avatar eugene-eeo commented on July 3, 2024

Very nicely done. Note that the namedtuple constructor is only meant to be created once- for example,

Status = namedtuple('Status', '...')

class Account:
    def getPortfolioStatus(self):
        ...
        return Status(...)

You can also use keyword arguments when creating your Status object, for example

Status(
    cash_value=something,
    ...
)

Just to make your code clearer; but it's optional.

from investopedia-trading-api.

eugene-eeo avatar eugene-eeo commented on July 3, 2024

I am on mobile so I'm sorry that I couldn't squash this into a single comment- is there a good reason to return True and False in the Account.trade method? Normally we'll just let exceptions be raised.

from investopedia-trading-api.

kirkthaker avatar kirkthaker commented on July 3, 2024

Initially, I thought it would be useful to suppress any exceptions during trading (so that an error wouldn't bring the whole trading algorithm to a halt). Looking at it now, it's probably more sensible to let users do whatever they want with exceptions (instead of this class already suppressing it for them).

from investopedia-trading-api.

Related Issues (18)

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.