2014년 12월 15일 월요일

Getting Error when trying to load CSV file


I'm trying to make a Bitcoin ticker that takes the API data from Bitstamp and displays a price. 

I am getting an error though.  

Here is my block setup.  The design page just has 2 labels on it.  One should be updated with the data.. 


Bitstamps API.  (Is this the right kind of data?)

RUNTIME ERROR
Cannot parse text argument to "list from csv row" as CSV-formatted row

Note: You will not see another error reported for 5 seconds

--
here is the bitstamp api. 


--
I'm guess the API isn't the right kind.  Can anyone tell me how one would make a a simple ticker reading from the information provided by bitstamp?

--
{"high": "358.59", "last": "349.99", "timestamp": "1418452068", "bid": "348.82", "vwap": "354.42", "volume": "7387.88011067", "low": "348.33", "ask": "349.85"} 

notice that there's a LOT of inconsistency in that line there... Open curly brace, closing paren. The values between the commas are strange... it's coming back as multiply quotified within the commas, and they're fields with values. You'd have to extract the value, then break it up into it's parts, and extract the part that you need. Can't believe Bitcoins dropped that much after the bust.

⦁ First, read the line in as is into a string. Remove the curly leading brace, and the trailing closed paren using the segment text block.
⦁ Then, break the string down by splitting at commas with the split block... 
⦁ Then, take each element of THAT list, and break it down again, removing the colon and the internal quotes breaking each into two pieces. 
⦁ Then use each as you need.

--
Thanks a lot. Why would they have it like this if it was such a pain to get running? Is this just because of limitations within app inventor?
I'm kinda new to API's and programming in general so thought I was missing something.. 
About Bitcoin, I've been with it since 70 cents .. so nothing surprises me. :)  Microsoft just started accepting. :)

--
You would have to parse the data stream in any computer language Mike.  Different languages have different tools to split the data. In this case, in many ways, this is not a very difficult stream to parse, based on a quick inspection.   I say not difficult, I did not say the solution is easy.   AI2's tools in this respect are probably no more onerous to the algorithms required to do something similar in say Eclipse or Android Studio for Android devices  or C++, Visual Basic for Windows etc.
Good luck with your project.  Try some blocks, if you have a specific problem post a screen capture of your blocks and someone will provide suggestions.

--
why don't you just use the Web.JsonDecode block together with thelookup in pairs block?

Thanks you are amazing

--

댓글 없음:

댓글 쓰기