Bitcoin Forum
May 04, 2024, 09:24:39 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to pull Coinmarketcap.com Data to a text file?  (Read 183 times)
BTC Turkiye (OP)
Sr. Member
****
Offline Offline

Activity: 472
Merit: 254


Anlik Coin Fiyatlari BTCkur.com


View Profile WWW
December 06, 2018, 11:43:08 PM
 #1

I know how to pull data from coinmarketcap into an excel sheet already but it's not efficient. So I need a way to download the data to a text file so I can grab it from there with my excel workbook.

So is there anyone that knows How to pull data to a text file from Coinmarketcap.com API?

I'd greatly appreciate it if someone can help me on this



EDIT: I openned this topic in economics also. But couldnt remove this one. So mods, feel free to remove this topic from here. Thank you

Farklı Borsaların Anlık Bitcoin, Litecoin, Ethereum ve Bitcoin Cash Kurunu Takip Edebilirsiniz.
BTCkur.com
If you want to be a moderator, report many posts with accuracy. You will be noticed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714857879
Hero Member
*
Offline Offline

Posts: 1714857879

View Profile Personal Message (Offline)

Ignore
1714857879
Reply with quote  #2

1714857879
Report to moderator
1714857879
Hero Member
*
Offline Offline

Posts: 1714857879

View Profile Personal Message (Offline)

Ignore
1714857879
Reply with quote  #2

1714857879
Report to moderator
OmegaStarScream
Staff
Legendary
*
Offline Offline

Activity: 3472
Merit: 6120



View Profile
December 08, 2018, 08:02:04 PM
 #2

I'm not aware of any methods to do that like with Excel where you could install plugins. It shouldn't be hard to achieve though (If I understood what you're trying to achieve). Try to go with C# and Json.net.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Initscri
Hero Member
*****
Offline Offline

Activity: 1540
Merit: 759


View Profile WWW
December 11, 2018, 03:14:23 AM
 #3

I know how to pull data from coinmarketcap into an excel sheet already but it's not efficient. So I need a way to download the data to a text file so I can grab it from there with my excel workbook.

So is there anyone that knows How to pull data to a text file from Coinmarketcap.com API?

I'd greatly appreciate it if someone can help me on this



EDIT: I openned this topic in economics also. But couldnt remove this one. So mods, feel free to remove this topic from here. Thank you

This is actually the correct place for the thread, the thread on economics should probably be closed.

How would you want this as a text file? Right now the following URL is JSON: https://api.coinmarketcap.com/v1/ticker/
You can just convert that to text, although it may not be as easy to handle

For example: https://pastebin.com/PHG0bf5g

----------------------------------
Web Developer. PM for details.
----------------------------------
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10546



View Profile
December 11, 2018, 04:11:40 AM
 #4

have you tried fetching the data from the API using some programming language and then using some library to convert the JSON data into a .csv file?
there are quite a lot of them available out there depending on the programming language you are using. for example python: https://stackoverflow.com/questions/46350765/convert-json-to-csv-with-python-3

the .csv file can then be opened with excel and you can start doing anything you want with that data.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Initscri
Hero Member
*****
Offline Offline

Activity: 1540
Merit: 759


View Profile WWW
December 11, 2018, 04:24:46 AM
Last edit: December 11, 2018, 04:36:15 AM by Initscri
Merited by pooya87 (1)
 #5

have you tried fetching the data from the API using some programming language and then using some library to convert the JSON data into a .csv file?
there are quite a lot of them available out there depending on the programming language you are using. for example python: https://stackoverflow.com/questions/46350765/convert-json-to-csv-with-python-3

the .csv file can then be opened with excel and you can start doing anything you want with that data.

To be fair, no programming required (although if he's looking to automate this, it would be better). There are hundreds of sites w/ simple scripts to convert JSON to CSVs

For example: https://json-csv.com/

If you do want to automatically create a CSV file, you can do something like the following (in PHP for example):
Idea/some code from: http://thisinterestsme.com/php-convert-json-csv/

Code:
// Pull the information from the API
$apiUrl = 'https://api.coinmarketcap.com/v1/ticker/';
$apiData = file_get_contents($apiUrl);

//Decode the JSON and convert it into an associative array.
$jsonDecoded = json_decode($apiData, true);
 
//Give our CSV file a name.
$csvFileName = 'data_export.csv';
 
//Open file pointer.
$fp = fopen($csvFileName, 'w');
 
//Loop through the associative array.
foreach($jsonDecoded as $row){
    //Write the row to the CSV file.
    fputcsv($fp, $row);
}
 
//Finally, close the file pointer.
fclose($fp);

// Say something.
print "Complete!";

If you run the script, it will create a file named 'data_export.csv' with the JSON to CSV data. It may require a few edits to make it perfect/flawless, but hopefully you get the gist.

----------------------------------
Web Developer. PM for details.
----------------------------------
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!