help with curl along jqHow can I give an argument as an external file to curl with url encode?POST json data...
Are there variations of the regular runtimes of the Big-O-Notation?
What's the word for the soldier salute?
How are one-time password generators like Google Authenticator different from having two passwords?
51% attack - apparently very easy? refering to CZ's "rollback btc chain" - How to make sure such corruptible scenario can never happen so easily?
How to cope with regret and shame about not fully utilizing opportunities during PhD?
Extrude the faces of a cube symmetrically along XYZ
How are Core iX names like Core i5, i7 related to Haswell, Ivy Bridge?
Smallest Guaranteed hash collision cycle length
How to make a language evolve quickly?
What to do if SUS scores contradict qualitative feedback?
How can this pool heater gas line be disconnected?
What's the difference between a Bunsen burner and a gas stove?
Can a tourist shoot a gun in the USA?
Does kinetic energy warp spacetime?
Two researchers want to work on the same extension to my paper. Who to help?
Why was Endgame Thanos so different than Infinity War Thanos?
Exception propagation: When should I catch exceptions?
How can a layman easily get the consensus view of what academia *thinks* about a subject?
Can I use my laptop, which says 100-240V, in the USA?
Can 'sudo apt-get remove [write]' destroy my Ubuntu?
Is the schwa sound consistent?
Is taking modulus on both sides of an equation valid?
What is the significance of 4200 BCE in context of farming replacing foraging in Europe?
How can I answer high-school writing prompts without sounding weird and fake?
help with curl along jq
How can I give an argument as an external file to curl with url encode?POST json data with cURL from a while loop - bash shellLog Curl OutputSelecting a value from a drop-down menu with curlUsing curl with certificates on Ubuntu 16.04A file on AkamaiGlobalHost downloads with a browser but not with curlcurl from sitemap.xml?curl in Jenkins,Trying to find better way to read BTC price from specific exchange using LinuxHow to pass JSON in a curl GET request?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
The following command achieve my goal by grepping BTC
price from specific exchange.
curl -sS https://api.binance.com/api/v1/ticker/price?symbol=BTCUSDT | jq -r '.price'
the output will be for the moment 7222.25000000
but i would like to get it 7222.25
curl jq
add a comment |
The following command achieve my goal by grepping BTC
price from specific exchange.
curl -sS https://api.binance.com/api/v1/ticker/price?symbol=BTCUSDT | jq -r '.price'
the output will be for the moment 7222.25000000
but i would like to get it 7222.25
curl jq
add a comment |
The following command achieve my goal by grepping BTC
price from specific exchange.
curl -sS https://api.binance.com/api/v1/ticker/price?symbol=BTCUSDT | jq -r '.price'
the output will be for the moment 7222.25000000
but i would like to get it 7222.25
curl jq
The following command achieve my goal by grepping BTC
price from specific exchange.
curl -sS https://api.binance.com/api/v1/ticker/price?symbol=BTCUSDT | jq -r '.price'
the output will be for the moment 7222.25000000
but i would like to get it 7222.25
curl jq
curl jq
asked 14 mins ago
αԋɱҽԃ αмєяιcαηαԋɱҽԃ αмєяιcαη
4652624
4652624
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Pass the price through tonumber
:
curl -sS 'https://api.binance.com/api/v1/ticker/price?symbol=BTCUSDT' |
jq -r '.price | tonumber'
This would convert the price from a string to a number, removing the trailing zeros. See the manual for jq
.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f518496%2fhelp-with-curl-along-jq%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Pass the price through tonumber
:
curl -sS 'https://api.binance.com/api/v1/ticker/price?symbol=BTCUSDT' |
jq -r '.price | tonumber'
This would convert the price from a string to a number, removing the trailing zeros. See the manual for jq
.
add a comment |
Pass the price through tonumber
:
curl -sS 'https://api.binance.com/api/v1/ticker/price?symbol=BTCUSDT' |
jq -r '.price | tonumber'
This would convert the price from a string to a number, removing the trailing zeros. See the manual for jq
.
add a comment |
Pass the price through tonumber
:
curl -sS 'https://api.binance.com/api/v1/ticker/price?symbol=BTCUSDT' |
jq -r '.price | tonumber'
This would convert the price from a string to a number, removing the trailing zeros. See the manual for jq
.
Pass the price through tonumber
:
curl -sS 'https://api.binance.com/api/v1/ticker/price?symbol=BTCUSDT' |
jq -r '.price | tonumber'
This would convert the price from a string to a number, removing the trailing zeros. See the manual for jq
.
answered 1 min ago
Kusalananda♦Kusalananda
146k18274455
146k18274455
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f518496%2fhelp-with-curl-along-jq%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown