question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pylivetrader fails to call `order_target_percent` if there are untradable stocks

See original GitHub issue

If your portfolio has stocks that are stuck/untradable, and you attempt any sort of order_target_percent action, Pylivetrader crashes when it attempts to lookup the stock price of said-stuck-stock.

It doesn’t matter how large or small the percent is, when the order_target_percent method is invoked it tries to evaluate the size of the portfolio (ie lookup the existing stocks) and the whole action fails.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
szheng3commented, Sep 15, 2020

i also have the same problem. [2020-09-15 15:07:06.867731] ERROR: Executor: Cannot order TMF, as it not tradable Traceback (most recent call last): File “/usr/local/anaconda3/envs/trade/lib/python3.6/site-packages/pylivetrader/executor/executor.py”, line 67, in wrapper func(*args, **kwargs) File “/usr/local/anaconda3/envs/trade/lib/python3.6/site-packages/pylivetrader/executor/executor.py”, line 88, in every_bar handle_data(algo, current_data, dt_to_use) File “/usr/local/anaconda3/envs/trade/lib/python3.6/site-packages/pylivetrader/misc/events.py”, line 218, in handle_data dt, File “/usr/local/anaconda3/envs/trade/lib/python3.6/site-packages/pylivetrader/misc/events.py”, line 237, in handle_data self.callback(context, data) File “/usr/local/anaconda3/envs/trade/lib/python3.6/site-packages/pylivetrader/algorithm.py”, line 236, in handle_data self._handle_data(self, data) File “algo.py”, line 64, in handle_data order_target_percent(tmf_symbol, 0.3) File “/usr/local/anaconda3/envs/trade/lib/python3.6/site-packages/pylivetrader/misc/api_context.py”, line 62, in wrapped return getattr(algorithm, f.name)(*args, **kwargs) File “/usr/local/anaconda3/envs/trade/lib/python3.6/site-packages/pylivetrader/algorithm.py”, line 621, in order_target_percent amount = self._calculate_order_target_percent_amount(asset, target) File “/usr/local/anaconda3/envs/trade/lib/python3.6/site-packages/pylivetrader/algorithm.py”, line 860, in _calculate_order_target_percent_amount target_amount = self._calculate_order_percent_amount(asset, target) File “/usr/local/anaconda3/envs/trade/lib/python3.6/site-packages/pylivetrader/algorithm.py”, line 850, in _calculate_order_percent_amount return self._calculate_order_value_amount(asset, value) File “/usr/local/anaconda3/envs/trade/lib/python3.6/site-packages/pylivetrader/algorithm.py”, line 825, in _calculate_order_value_amount msg=“Cannot order {0}, as it not tradable”.format(asset.symbol) pylivetrader.errors.CannotOrderDelistedAsset: Cannot order TMF, as it not tradable

0reactions
camelpaccommented, May 29, 2021

closing due to lack of activity. please re-open if still relevant

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's an untradeable stock? - Robinhood
Stocks may not be searchable, or may be labeled as untradable for a few reasons: The exchange has paused trading. The stock was...
Read more >
Fails-to-Deliver Data - SEC.gov
File Format Size File: November 2022, second half Format:ZIP Size:1.4 MB File: November 2022, first half Format:ZIP Size:1.11 MB File: October 2022, second half Format:ZIP Size:1.35...
Read more >
alpacahq/pylivetrader: Python live trade execution ... - GitHub
pylivetrader run starts live trading using your algorithm script. It starts by calling the initialize() function if any, and waits until the market...
Read more >
What Is Failure to Deliver, and What Happens With FTDs?
Failure to deliver (FTD) refers to a situation where one party in a transaction does not meet their obligation to either pay for...
Read more >
Why are some stocks suddenly unavailable to trade? - Webull
However, if one stock is going through a corporate action, the affected stock may be temporarily unavailable for trading while the changes are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found