Comments (9)
Got something similar.
Not with a crypto, but with a value not on LSX.
pytr/portfolio.py sets ticker to only query LSX :
https://github.com/marzzzello/pytr/blob/4e3f141bc70546bc79407ad8acc17e20c07052e9/pytr/portfolio.py#L47
I fixed it in my own script, by querying the first exchange found in intrumentId :
portfolio=tr.run_blocking(tr.compact_portfolio())
for position in portfolio['positions'] :
isin = position['instrumentId']
# Get instrument details
instrument = tr.run_blocking(tr.instrument_details(isin))
exchange=instrument['exchangeIds'][0]
# Get price
ticker = tr.run_blocking(tr.ticker(isin,exchange=exchange))
price = ticker['last']['price']
from pytr.
@CorsiDanilo
I managed to have a seemingly working porfolio.py :
Let me know (you and others) if it works for you, I'll make a pull request.
portfolio.py.txt
from pytr.
@CorsiDanilo
The modifications were made to an old version of pytr.
I've just created an up-to-date pull request
You'll find the correct file here : https://github.com/cyrilpawelko/pytr/blob/master/pytr/portfolio.py
from pytr.
Got something similar. Not with a crypto, but with a value not on LSX. pytr/portfolio.py sets ticker to only query LSX :
I fixed it in my own script, by querying the first exchange found in intrumentId :
portfolio=tr.run_blocking(tr.compact_portfolio()) for position in portfolio['positions'] : isin = position['instrumentId'] # Get instrument details instrument = tr.run_blocking(tr.instrument_details(isin)) exchange=instrument['exchangeIds'][0] # Get price ticker = tr.run_blocking(tr.ticker(isin,exchange=exchange)) price = ticker['last']['price']
@cyrilpawelko I also have a similar problem, I don't know if it relates precisely to that but I wanted to ask you specifically where did you add that code? Did you have to edit anything else?
from pytr.
@CorsiDanilo
I wrote my own synchronous script using pytr librairies.
I guess portfolio.py:47 should extract an exchangeId from instrument_details, but I was not able to do it.
from pytr.
@CorsiDanilo I wrote my own synchronous script using pytr librairies. I guess portfolio.py:47 should extract an exchangeId from instrument_details, but I was not able to do it.
@cyrilpawelko Could you share it? I wanted to try and fix this too..
from pytr.
@CorsiDanilo
Here is my script (work in progress), renamed in .txt to allow uploading :
custom.txt
from pytr.
@CorsiDanilo I managed to have a seemingly working porfolio.py : Let me know (you and others) if it works for you, I'll make a pull request. portfolio.py.txt
@cyrilpawelko thanks it worked!
Is it now possible to export all transactions to a file (such as .csv)?
I tried with the command:
pytr portfolio -o /path/to/output
But apparently the function p.portfolio_to_csv
has not been implemented.
It gives me this error:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "c:\Users\danil\Documents\Repositories\NW-SCRIPTS\.venv\Scripts\pytr.exe\__main__.py", line 7, in <module>
File "c:\Users\danil\Documents\Repositories\NW-SCRIPTS\.venv\Lib\site-packages\pytr\main.py", line 223, in main
p.portfolio_to_csv(args.output)
^^^^^^^^^^^^^^^^^^
AttributeError: 'Portfolio' object has no attribute 'portfolio_to_csv'. Did you mean: 'portfolio_loop'?
from pytr.
This issue should be fixed in the current master.
from pytr.
Related Issues (20)
- event.shares has €-sign and causes an error decimal.InvalidOperation in transactions.py -> format_decimal(event.shares HOT 2
- Support for Visa Card transactions HOT 9
- Provide pre-build binaries HOT 1
- Export investments as CSV HOT 2
- pytr portfolio gets stuck while unsubscribeing HOT 4
- pytr portfolio stuck after connected to websocket HOT 2
- Saveback documents are not downloaded HOT 2
- portfolio_history is not working HOT 1
- pytr dl_docs shows new documents but does not download them HOT 15
- UnboundLocalError HOT 16
- Looking for (co-)maintainers HOT 8
- TypeError for timestamp HOT 1
- pytr download of docs fails if last_days option is provided HOT 8
- Download transactions from date HOT 1
- release is not visible in package manager HOT 3
- Names of Files and their Folders changed HOT 1
- Add the transaction title to the transaction details
- Formatting improvement HOT 2
- Add card transactions into csv automatically HOT 1
- Customizable destination folder structure HOT 9
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 pytr.