pbrissaud / suivi-bourse Goto Github PK
View Code? Open in Web Editor NEWMonitor the stock shares you own with Python and Prometheus !
Home Page: https://pbrissaud.github.io/suivi-bourse/
License: MIT License
Monitor the stock shares you own with Python and Prometheus !
Home Page: https://pbrissaud.github.io/suivi-bourse/
License: MIT License
Hi,
I'm trying to use your application but how can i set a login and a pass for my influxdb connexion ?
(I use my influxdb database and my grafana)
Thanks
I have a working database with InfluxDB V1. Unfortunately, transferring the collected data from the app has not yet worked. It works fine with Prometheus. Is there also a solution to transfer this to InfluxDB V1?
I use the following docker compose
`version: "3.8"
services:
app:
container_name: suivi-bourse-app
restart: unless-stopped
environment:
- SB_SCRAPING_INTERVAL=120
- INFLUXDB_HOST=http://192.168.x.x
- INFLUXDB_PORT=8086
- INFLUXDB_DATABASE=stocks
- INFLUXDB_USER=user_stocks
- INFLUXDB_PASSWORD=secretpw
image: paulbrissaud/suivi-bourse-app:3.1.0
volumes:
- /volume1/docker/suivi-bourse-app/config/config.yaml:/home/appuser/.config/SuiviBourse/config.yaml:ro`
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
This repository currently has no open or pending branches.
docker-compose/docker-compose.dev.yaml
grafana/grafana 11.0.0
prom/prometheus v2.52.0
docker-compose/docker-compose.yaml
paulbrissaud/suivi-bourse-app 3.7.1
grafana/grafana 11.0.0
prom/prometheus v2.52.0
app/Dockerfile
python 3.12-slim
.github/workflows/create-release.yml
actions/checkout v4
actions/setup-python v5.1.0
BSFishy/pip-action v1
.github/workflows/pull-request.yml
tisonkun/actions-dco v1.1
actions/checkout v4
ricardochaves/python-lint v1.4.0
actions/checkout v4
actions/setup-python v5.1.0
BSFishy/pip-action v1
BSFishy/pip-action v1
actions/checkout v4
tj-actions/changed-files v44
.github/workflows/release.yml
actions/checkout v4
docker/metadata-action v5
docker/setup-qemu-action v3
docker/setup-buildx-action v3
docker/login-action v3
docker/login-action v3
docker/build-push-action v5
actions/checkout v4
actions/configure-pages v5
actions/upload-pages-artifact v3
actions/deploy-pages v4
website/package.json
@docusaurus/core ^3.0.1
@docusaurus/preset-classic ^3.0.1
@mdx-js/react ^3.0.0
clsx 2.1.1
prism-react-renderer ^2.1.0
react ^18.2.0
react-dom ^18.2.0
@docusaurus/module-type-aliases ^3.0.1
@docusaurus/types ^3.0.1
node >=18.0
app/requirements.txt
APScheduler ==3.10.4
Cerberus == 1.3.5
PyYAML ==6.0.1
confuse == 2.0.1
logfmt_logger == 0.1.2
prometheus_client ==0.20.0
urllib3 ==2.2.1
yfinance ==0.2.40
numpy >=1.22.2
setuptools >=65.5.1
Describe the bug
In the protocoll of the "suivi-bourse-app"-Container I receive the message "ModuleNotFoundError: No module named 'prometheus_client'" after strating successfully the docker-compose.yaml.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No error message because, 'prometheus_client' should be part of the container
Installation mode: (choose one)
regards
Alex
Originally posted by pbrissaud February 13, 2022
New Grafana 8.3 version add candlestick panel which can be useful in this project
Additional context
Hi,
I think it could be good if we can add brokerage fees too.
For example when i bought 100 JPY stock, it cost 10โฌ.
I try tomorrow too !
Hi,
We can also add a variable to change the refresh update.
60s is too much for me. 1 hour is good for me.
I changed the value directly, but maybe we could use a ENV_VAR to do this ?
Is your feature request related to a problem? Please describe.
The current documentation section Deployment - Standalone states how to start the tool by running
python3 src/main.py
, but when doing so, it is required to have the command line open all the time. Otherwise, the tool stops.
Describe the solution you'd like
An extension on how to set up a service that runs the python script automatically may be added for a better user experience.
Describe alternatives you've considered
This is how I solved the issue on a Raspberry Pi
Create a new file
sudo nano /etc/systemd/system/suivibourse.service
Content
Description=Suivi-bourse Stock Monitoring
Documentation=https://suivibourse-docs.netlify.app/
After=network-online.target
[Service]
User=pi
Restart=on-failure
ExecStart=/usr/bin/python3 /home/pi/suivi-bourse/app/src/main.py
[Install]
WantedBy=multi-user.target
Enable the service
sudo systemctl enable suivibourse
Start the service
sudo systemctl start suivibourse
Check the status
sudo systemctl status suivibourse
I would suggest to extend the existing documentation :)
It would be useful if you could add an Exchange or StockMarket field, like share_name.
if you have shares from different markets then it will be possible to list shares only from a certain market.
- name: Infineon Technologies
symbol: IFX.DE
StockMarket: DAX
purchase:
quantity: 1
fee: 1
cost_price: 7
estate:
quantity: 1
received_dividend: 2
- name: Microsoft Corp.
symbol: MSFT
StockMarket: NASDAQ
purchase:
quantity: 0
fee: 0
cost_price: 0
estate:
quantity: 0
received_dividend: 0
Hi,
I think it can be nice if we could integrate the forex, i have JPY, CAD, USD, GBP, and it doesn't works on a grafana. We see only JPY because graphs are bigger than others.
Objective is to get EUR/USD, EUR/JPY, etc... and multiply the value
https://fr.finance.yahoo.com/quote/EURJPY=X?ltr=1
I already did it with excel (powerquerry) but i prefer with python and influxdb ! But i'm really noob in python...
And why not add a category FOREX to the portfolio to follow the evolution ;)
I'll try tomorrow ;)
Describe the bug
Trying partial shares, the app throws an error because the quantity field is an integer.
An error has occured: 400: {"error":"partial write: field type conflict: input field "quantity" on measurement "purchase" is type float, already exists as type integer dropped=1"}
To Reproduce
Steps to reproduce the behavior:
Add a stock with float quantity:
[ { "name": "Bitcoin", "symbol": "BTC-EUR", "purchase": { "quantity": 0.02047884, "fee": 2, "cost_price": 985 }, "estate": { "quantity": 0 , "received_dividend": 0 } } ]
Expected behavior
If the field would support floats, the float would be written to the db.
Screenshots
Installation mode: (choose one)
Standalone
Hi Paul,
I will not reopen issue #7, but have quite the same issue after running docker-compose with portainer. I have attached two screenshots that may help to find the reason for not displaying data.
It seems to me that prometheus does not receive data, but I am not deep enough in your image/model.
From your article I do miss InfluxDB, but I guess you switched meanwhile to prometheus instead.
So, how can I display data in Grafana? Do you need my docker-compose-file? Or any logs?
Thanks for your help in advance
regards Alex
Describe the bug
Tried default installation via docker compose with default config and get the following stack trace:
suivi-bourse-app | time=2023-12-28T16:41:11.297000 level=INFO location=main.py:127: msg="SuiviBourse is running !"
suivi-bourse-app | time=2023-12-28T16:41:11.773000 level=CRITICAL location=main.py:151: msg="An error occurred" exception="Traceback (most recent call last):
suivi-bourse-app | File "/home/appuser/main.py", line 144, in
suivi-bourse-app | sb_metrics.run()
suivi-bourse-app | File "/home/appuser/main.py", line 123, in run
suivi-bourse-app | self.expose_metrics()
suivi-bourse-app | File "/home/appuser/main.py", line 111, in expose_metrics
suivi-bourse-app | info_values = label_values + [ticker.info.get('currency', 'undefined'), ticker.info.get('exchange', 'undefined'), ticker.info.get('quoteType', 'undefined')]
suivi-bourse-app | ^^^^^^^^^^^
suivi-bourse-app | File "/usr/local/lib/python3.11/site-packages/yfinance/ticker.py", line 138, in info
suivi-bourse-app | return self.get_info()
suivi-bourse-app | ^^^^^^^^^^^^^^^
suivi-bourse-app | File "/usr/local/lib/python3.11/site-packages/yfinance/base.py", line 1496, in get_info
suivi-bourse-app | data = self._quote.info
suivi-bourse-app | ^^^^^^^^^^^^^^^^
suivi-bourse-app | File "/usr/local/lib/python3.11/site-packages/yfinance/scrapers/quote.py", line 563, in info
suivi-bourse-app | self._fetch(self.proxy)
suivi-bourse-app | File "/usr/local/lib/python3.11/site-packages/yfinance/scrapers/quote.py", line 594, in _fetch
suivi-bourse-app | result = self._data.get_raw_json(
suivi-bourse-app | ^^^^^^^^^^^^^^^^^^^^^^^^
suivi-bourse-app | File "/usr/local/lib/python3.11/site-packages/yfinance/data.py", line 75, in get_raw_json
suivi-bourse-app | response.raise_for_status()
suivi-bourse-app | File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
suivi-bourse-app | raise HTTPError(http_error_msg, response=self)
suivi-bourse-app | requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://query2.finance.yahoo.com/v6/finance/quoteSummary/AAPL?modules=financialData&modules=quoteType&modules=defaultKeyStatistics&modules=assetProfile&modules=summaryDetail&ssl=true"
suivi-bourse-app exited with code 1
To Reproduce
Take files from https://github.com/pbrissaud/suivi-bourse/tree/master/docker-compose (except docker-compose.dev.yaml)
Run docker compose up -d and bam, 404.
Expected behavior
I would expect that it gets quotes? :)
Installation mode: (choose one)
Environnement:
Probably not the cause, but: Ubuntu 22.04 Server and Docker version 24.0.7, build afdd53b
PS: I really like your project and would love to use it. But it seems that I stumble over something obvious?! Or did yahoo changed something on their side recently?
I hope it's unlikely that I tried during some yahoo outage.
Also, I probably want to trim down the docker compose file to just the app getting data. I already have prometheus and grafana running... :)
Describe the bug
Hi There
I'm getting python KeyError: 'currentPrice' in the logs. I'm using the latest arm64 image (this). I see this error only for crypto currencies (tried a few like BTC-USD, BTC-EUR, ETH-USD). Upon further digging, looks like the issue is in the yfinance library.
import yfinance as yf
ticker_info = yf.Ticker("BTC-USD").info
last_quote = ticker_info['currentPrice']
print(last_quote)
Traceback (most recent call last):
File "main.py", line 13, in <module>
last_quote = ticker_info['currentPrice']
KeyError: 'currentPrice'
There is no key called "currentPrice" for cryptos. Will have to handle that
Installation mode: (choose one)
Additional comments
I had worked on something similar (python finance/portfolio dashboard) and I cant recall but there were several inconsistency issues with the data ingestion from yfinance but things might've changed for better since I last used. I had decided to use yahoo_fin instead. Worked fine for cypto/non-crypto.
I'm in no way/shape/form have any association with yahoo_fin. Cheers! ๐
Thanks for the project, I'm trying to play with it.
But for some reason container suivi-bourse-app exit after first run of main.py file - "exited with code 0". So it stores only one value for the stock and die :(.
After short investigation I found that it exit after time.sleep(60).
Do you know why this can happen ?
Is your feature request related to a problem? Please describe.
New Grafana 8.3 version add candlestick panel, useful in this project
Describe the solution you'd like
Replace time series panel to candlestick
Additional context
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.