Getting Error when trying to load CSV file

4246 views
Skip to first unread message

Mike M

unread,
Dec 12, 2014, 11:08:51 PM12/12/14
to mitappinv...@googlegroups.com
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

Mike M

unread,
Dec 12, 2014, 11:43:25 PM12/12/14
to mitappinv...@googlegroups.com
here is the bitstamp api. 

Mike M

unread,
Dec 13, 2014, 1:32:52 AM12/13/14
to mitappinv...@googlegroups.com
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?

Enis

unread,
Dec 13, 2014, 1:33:07 AM12/13/14
to
{"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.

I don't believe this can be simply extracted to a list, but needs to be broken down, element by element.

  • 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.

Mike M

unread,
Dec 13, 2014, 1:54:28 AM12/13/14
to mitappinv...@googlegroups.com
Thanks alot. 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. :)

SteveJG

unread,
Dec 13, 2014, 8:03:52 AM12/13/14
to mitappinv...@googlegroups.com
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.


Regards,
Steve

Taifun

unread,
Dec 13, 2014, 10:11:46 AM12/13/14
to
why don't you just use the Web.JsonTextDecode block together with the lookup in pairs block?


How does the lookup in pairs block work?
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Mike M

unread,
Dec 13, 2014, 10:40:40 AM12/13/14
to mitappinv...@googlegroups.com
Thanks taifun you are amazing
Reply all
Reply to author
Forward
0 new messages