diegomanuel / binance-to-google-sheets

Google Spreadsheets add-on to get data directly from Binance API without any intermediaries! :rocket:
GNU General Public License v3.0
429 stars 76 forks source link

[FEATURE] Historical data #21

Closed almeidaaraujo closed 3 years ago

almeidaaraujo commented 3 years ago

Hi, Great job so far. I really appreciate the tool.

Is your feature request related to a problem? Please describe. For the tool to be complete, I needed the historical data (prices, volume ...).

Describe the solution you'd like So I decided to implement a new function, BinDoHistoricalData. In it, I take the historical data from "api/v3/klines".

function call:

BINANCE ("history"; "price"; "symbol: BCTUSDT, interval: 1d, startTime: 1614211200000, endTime: 1614816000000") for close price BINANCE ("history"; "volume"; "symbol: BCTUSDT, interval: 1d, startTime: 1614211200000, endTime: 1614816000000") for volume It needs some improvements.

feel free to ask anything.

sheets

Thanks.

diegomanuel commented 3 years ago

Hey @almeidaaraujo thanks in advance for taking the time to create a new operation! :clap:

That could be a good one to add if we are able to get the data with the minimal API request possible. The ideal case, is just making one request to have all the needed data and having just one operation (like: "history") that includes both price and volume in the results. Returning data to have something like your screenshot looks great!

Feel free to create a PR or if you want (and maybe easier) just copy the contents of BinDoHistoricalData code here in the comments, so I can take a look and do the improvements to make it work in harmony with the rest of the add-on.

Thanks once again! :beers:

diegomanuel commented 3 years ago

Taken your initial approach @almeidaaraujo from PR #22 and made it to work in a single operation/result. Commited at: https://github.com/diegomanuel/binance-to-google-sheets/commit/dbdb1dc25e0603c9e12cfc69c88511a9509feeba I mentioned you in the operation top description! :smiley:

It should be useful in your use case as it is right now, you could easily have what you have displayed in your screenshot! You can draw the SPARKLINE using any of the returned column values. You can also play around with different options setup (interval, start, end, limit) to get different lists to feed any graph.

Hope it helps, let me know how it goes. Thanks and enjoy! :beers: