ilgizar / ilgizar-candlestick-panel

Grafana candlestick panel plugin
MIT License
226 stars 54 forks source link

Using candlestick with mongodb-grafana #21

Open moonlight16 opened 6 years ago

moonlight16 commented 6 years ago

I'm trying to get candlesticks to work with the plugin 'mongodb-grafana': https://github.com/JamesOsgood/mongodb-grafana

I have a mongodb query like this:

db.5b8f88f33345af4961e38a62.aggregate( [
{"$match": {"symbol": "ES", "interval": "15m"} },
{"$sort": {"dts": 1}},
{"$project": {"name": "ES backtest", "ts": "$dts", "value": {"open": "$Open", "high": "$High", "low": "$Low", "close": "$Close"}, "_id": 0}}
])

But the chart isn't displaying anything (no error either).

I assume I need to provide "name", "ts" (timestamp), and "value" as per instructions for the mongodb-grafana. Is the approach I'm taking correct? Any tips on getting this to work?

NOTE: I did get something like this working w/o candlesticks:

db.5b8f88f33345af4961e38a62.aggregate( [
{"$match": {"symbol": "ES", "interval": "15m"} },
{"$sort": {"dts": 1}},
{"$project": {"name": "ES backtest", "ts": "$dts", "value": "$Close", "_id": 0}}
])

Any help is much appreicated.