Stellar API

Stellar API is available in different programming languages.

Javascript users:
Method 1:

you can downlod the SDK from this link Js SDK , unzip it, you will find a file named "stellar-sdk" you can use it as your SDK.

Method 2:

you can follow the stellar guide on how to use javascript SDK Javascript SDK

Java users:

you can use the SDK from this link: Java SDK

Rest programming languages:

you can find the SDK in this link: Stellar SDK

Javascript:

Use this code below to get the last price of CHRC in XLM:
<script src="stellar-sdk/stellar-sdk.js" ></script> <script> var server = new StellarSdk.Server('https://horizon.stellar.org'); var assetcode = "CHRC"; var assetissuer = "GBRPTWEZTUKYM6VJXLHXBFI23M2GSY3TCVIQSZKFQLMOJXH7VPDGKBDP"; server.orderbook( new StellarSdk.Asset(assetcode, assetissuer),new StellarSdk.Asset.native()).limit(1) .order("desc").call() .then(function(CHRCbids_asks) { console.log("current bid: 1 XLM="+CHRCbids_asks["bids"][0]["price"]+" CHRC"); console.log("current ask: 1 XLM="+CHRCbids_asks["asks"][0]["price"]+" CHRC"); }) </script>

results:

PHP:

Use this code below to get the last price of CHRC in XLM:
			
<?php
    $json_CHRCprice ='https://horizon.stellar.org/order_book?selling_asset_type=credit_alphanum4&selling_asset_code=CHRC&s
    elling_asset_issuer=GBRPTWEZTUKYM6VJXLHXBFI23M2GSY3TCVIQSZKFQLMOJXH7VPDGKBDP&buying_asset_type
    =native';
    $jsonGetCHRCprice = file_get_contents($json_CHRCprice);
    $CHRCbids_asks = json_decode($jsonGetCHRCprice,true);
    echo "current bid: 1 XLM=".$CHRCbids_asks["bids"][0]["price"]." CHRC";
    echo "current ask: 1 XLM=".$CHRCbids_asks["asks"][0]["price"]." CHRC";
?>
						

results:

CHRC current bid: 1 XLM=0.0000020 CHRC
CHRC current ask: 1 XLM=0.0000144 CHRC

Java

Will be available soon.

Go

Will be available soon.

Ruby

Will be available soon.

Python

Will be available soon.