Comments (5)
Hi Kalypox, I already did it by putting in the quote tag. In your case it is EURJPY=X in the "sigle" and whatever name you want in "nom". Just use the part in the brackets from yahoo finance including the =X section. Like EUR/USD (EURUSD=X), you use EURUSD=X.
Only problem I'm dealing with is the quantitie has to be an integer. But this is not realistic when doing FX. Any ideas ?
from suivi-bourse.
Hi,
I'm working on it to transform all values in euro (or other) in your program. I'm learning python/influxdb/yfinance
from suivi-bourse.
I added 2 functions :
def getLastValue(ticker):
ticker = yf.Ticker(ticker)
history = ticker.history(interval="30m")
return history.tail(1)['Close'].iloc[0]
def toEur(cours,symbole):
if symbole != "EUR":
return cours / getLastValue("EUR" + symbole + "=X")
else:
return cours
def run():
try:
with open('data.json') as json_file:
json_loaded = json.load(json_file)
for info in json_loaded:
value = getLastValue(info['ticker'])
json_body = [{
"measurement": "bourse",
"tags": {
"nom": info['nom']
},
"fields": {
"value_origine": value,
"value": toEur(value,info['symbole']),
"qte": info['qte'],
"pru": info['pru']
}
}]
influxdbClient = InfluxDBClient(
host="192.168.1.2",
port="8086",
database="portfolio",
username="uuuu",
password="XXXXXXXXXX")
influxdbClient.write_points(json_body)
influxdbClient.close()
except Exception as e:
print(e)
And symbol in data.json
I made a lot of modifications on
from suivi-bourse.
Nice. Will try it out later.
To answer my previous question on the integer and real values, I find out that this it automatically assigned by InfluxDB when you first create the measurement. So if you put 0 or 1, it will assume it is an integer value and assign all values must be integers. To make it automatically assume a real number, then just put 0.0 or 1.0 and then you will have a real value assignment and you won't get errors when you put in 2.3 or other non whole number.
from suivi-bourse.
Hi,
In release 2.0, the app forces float casting for number to avoid this kind of issue (cf 27f956b)
from suivi-bourse.
Related Issues (17)
- suivi-bourse-app container exit after time.sleep
- InlfuxDB login and password HOT 1
- Possibility to change the refresh update HOT 2
- Add fee HOT 2
- Grafana not displaying data HOT 1
- Does not support partial shares; expects integers as quantity. HOT 1
- Grafana Candlestick Graph Support
- Grafana not displaying data (continued) HOT 4
- ModuleNotFoundError: No module named 'prometheus_client' HOT 2
- Expand standalone documentation section service HOT 1
- Grafana Candlestick Graph Support
- Support for InfluxDB V1 HOT 1
- Exchange/StockMarket Field HOT 1
- Dependency Dashboard
- KeyError: 'currentPrice' for crypto currencies HOT 2
- 404 Client Error: Not Found for url HOT 8
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 suivi-bourse.