Author

Topic: Bitcoin price APIs (Read 298 times)

legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
November 11, 2017, 12:47:27 AM
#9
Code:
curl -s 'https://poloniex.com/public?command=returnTicker' | python -c "import sys, json; print json.load(sys.stdin)['USDT_BTC']['last']"
member
Activity: 103
Merit: 10
November 11, 2017, 12:13:51 AM
#8
I don't know how to parse. :-)

Actually this code runs in Mac so it needs to be what ever Mac uses. API can return more than just price but then i need to parse it some how to integer.

what programming language do you use?

Bash? At least internets say that that is used in macOS Terminal app so i think it is Bash.

I can figure out rest of the script, only problem is parsing or finding API which returns just number.
newbie
Activity: 41
Merit: 0
November 10, 2017, 05:23:49 PM
#7
I don't know how to parse. :-)

Actually this code runs in Mac so it needs to be what ever Mac uses. API can return more than just price but then i need to parse it some how to integer.

what programming language do you use?
member
Activity: 103
Merit: 10
November 10, 2017, 02:24:57 PM
#6
I don't know how to parse. :-)

Actually this code runs in Mac so it needs to be what ever Mac uses. API can return more than just price but then i need to parse it some how to integer.
member
Activity: 243
Merit: 10
newbie
Activity: 41
Merit: 0
November 10, 2017, 01:40:46 PM
#4
What is a problem to parse the received JSON and round the price to the integer? In Go language it's really easy as you declare a struct with 1 field as Price and type float64 and after json.Unmarshal, you just cast it to int or use math library if you need.

What is the point to just get the integer and nothing else?
newbie
Activity: 42
Merit: 0
November 10, 2017, 01:14:19 PM
#3
Why don't use Python language? If the price is returned in JSON format, you can easily use from Python.
newbie
Activity: 35
Merit: 0
November 10, 2017, 08:36:14 AM
#2
i found some Apis like this ask user HCP will provide you with more information
member
Activity: 103
Merit: 10
November 10, 2017, 08:09:13 AM
#1
Is there any API which returns just Poloniex Bitcoin price and nothing else.

Usually these return some thing like:

"Price: 7600.3"

I just need

7600

Or if string is for instance:

{"result":{"price":6710.1},"allowance":{"cost":300445910,"remaining":7699554090}}

How i can extract just price without decimals: 6710

Best would be some thing like this

return characters from 20 to 23 in string "{"result":{"price":6710.1},"allowance":{"cost":300445910,"remaining":7699554090}}"

This way i could use this code in other unix scripts too.
Jump to: