Comments (4)
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.
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.
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.
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)
- name 'Account' is not defined
- Account statement HOT 1
- AttributeError: 'module' object has no attribute '_base' HOT 1
- AttributeError: 'str' object has no attribute 'value' HOT 3
- Gain_loss field not returned by get_current_securities function HOT 1
- pull request HOT 8
- No status report when doing an action HOT 2
- no connection could be made
- get_portfolio_status() returns AttributeError HOT 3
- Failed to handle prices more than 1000 HOT 1
- Is this API still useable? HOT 2
- Error when trying to log in. HOT 6
- 1 HOT 1
- error get portfolio_status() HOT 2
- FormNotFoundError: no form matching name 'simTradePreview' HOT 5
- Intraday trading and data using this API? HOT 1
- How to install investopedia-trading-api in ubuntu HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from investopedia-trading-api.