[Cloud Technology] Build a Cryptocurrency Price Tracker in Five Minutes
foreword
Following the successful establishment of a GAS (Google Apps Script) last time, I kept thinking about what applications could be used, and then I thought that maybe I could go fishing and check the price of cryptocurrencies, so I found Cryptofinance developed by Cryptowatch, and I can use it to develop GAS. Let's implement and build a set of cryptocurrency price trackers. If you find it interesting, please share it with everyone.
Therefore, this implementation will use Google Sheet combined with GAS to string together the data provided by Cryptofinance to complete a small work. It should not be necessary to write any programs in the process, so it should not be too difficult for those who do not write procedural methods. .
If you are interested, you can refer to the previous article to learn about how to start using the GAS service.
Further reading: [Cloud Technology] Use Google Apps Script to connect daily cloud services
Open new project and GAS code deployment
Select the extension above, click Apps Script to open the .gs project of this Google Sheet.
Since we want to directly use the Cryptofinance suite developed by Cryptowatch, we can directly copy and paste it into our GAS archive for execution. The URL is: https://raw.githubusercontent.com/cryptofinance-ai/cryptofinance-google-sheets-add- on/master/CRYPTOFINANCE.gs
To make it run smoothly, we need to authorize our Google account to this GAS project, so that it can write these currency price information into our data table.
If you see that the execution is completed, it means that there is no problem with the execution record, then switch to the Google Sheet side, let's call the function in GAS.
Google Sheet to get the currency price
Let's try to call Cryptofinance to see if there is any value. The most basic way to call is to enter it directly in a cell:
=CRYPTOFINANCE("BTC/USD")
Then you will see that it takes a little while to read and get the current price of bitcoin against the dollar.
So using CRYPTOFINANCE is very convenient, we only need to give it a string, the content of the string is "cryptocurrency/fiat currency", so that the corresponding quotation can be obtained.
If I tested it myself, all the cryptocurrencies that I can name can be read normally, even Likecoin! The common USD, GBP, AUD, EUR, JPY can be used in the legal currency part, but neither NTD nor RMB can be used for QQ.
Designing the Google Sheet Interface - Cryptocurrency Price Tracker
After the currency price can be obtained, the next step is to rely on everyone's imagination to design their own form functions. I will give the simplest example here, which is the cryptocurrency price tracker:
The formula for table B2 is:
=if(A2 <> "", CRYPTOFINANCE(A2&"/USD"),"")
This means that if the A2 box is not blank, use the value filled in A2 combined with the US dollar quotation. For example, A2 fills in ETH, then B2 will call CRYPTOFINANCE("ETH/USD"), and if the A2 box is blank , then B2 is also a blank value and the function will not be called.
We can pull down the formula and let the formula written in B2 directly become the formula of the entire B column. The advantage of this is that if you want to track the price of one more coin in the future, as long as you continue to fill in the A column, the next column B will be The automatic call function to fish out the currency price will be very convenient in practice.
Design the interface of Google Sheet - Personal Crypto Asset Statistics
Or you can design an automatic calculator for encrypted assets, enter the holding currency and the number of holdings, and you can write a formula to automatically calculate the total value converted into US dollars in the subsequent design of the table, and even a certain currency accounts for all the encrypted assets. The percentage of assets, isn't it very convenient?
Attached are some implemented formulas (ABCD for the column, N for the cell):
CN field (currently corresponding to USD price)
=if(AN <> "", CRYPTOFINANCE(AN&"/USD"),"")
DN field (the value of our position in USD)
=BN*CN
EN field (% of the total encrypted assets of each currency, the percentage should be set separately, click "Format" → "Value" → "Percentage" above to complete the setting)
=DN/F$N
FN field (total crypto assets)
=SUM(D:D)
Epilogue
The above is that we use the GAS cloud service to obtain the currency price data provided by Cryptofinance, and then use the table formula to create our own customized cloud products. There is no need to think about how to connect the data during the development process. Effort, I think this is where these cloud products are great.
However, it should be noted that the service data of this free version seems to have an upper limit of the number of times of fishing per day, so if an ERROR suddenly appears after using it, it may be because the number of times has reached the upper limit. After a while, delete and reset the data in the table and it will be back to normal. Maybe there is an easier way, please leave a message and tell me.
The Cryptofinance suite not only has the function of obtaining the currency price, but also has other functions to obtain different data. If you want to commercialize this thing, you can study the Cryptofinance Plans , which are provided in their documents. Check out the different plans and fees.
Further reading
【Cloud Technology】Understanding what is cloud service from three aspects
【Cloud Technology】Use Google Apps Script to connect daily cloud services
Finally, thank you for taking the time out of your busy schedule to read my articles. If you still like these content, I hope to get your follow-up and small sponsorship support, which will give me more motivation to continue writing. EVM compatible wallet The address is 0xae1dd06d57f582999a9c50b86ba913eecd7155ce.
Also welcome to join the Line community or Telegram group to discuss related topics
See you next time o((>ω< ))o~
Original link ITechNote technology essay
Like my work? Don't forget to support and clap, let me know that you are with me on the road of creation. Keep this enthusiasm together!
- Author
- More