BitShares Forum
Main => Technical Support => Topic started by: sharique-knysys on January 26, 2016, 06:34:51 am
-
Hi I want to convert any currency to BTS. I have checked currencies on cryptofresh.com. For example how can I calculate that how many bts equal to $1. Like it is displayed on cryptofresh.com
Exchange rate 0.00327 USD/BTS
-
In wallet, click on the "USD/BTS".
-
What abit wants to say is that in the BTS/OL wallet you can flip any market by clicking the market in the top navigation bar or by searching for y:x instead of x:y market
-
What abit wants to say is that in the BTS/OL wallet you can flip any market by clicking the market in the top navigation bar or by searching for y:x instead of x:y market
Thanks for explanation.
But if OP wants to see something different on CryptoFresh, I have no idea..
-
I am using following api.
https://bitshares.openledger.info/ws/
I can get this response. How can I calculate exchange rate from this reponse
{
"id": 2,
"result": [
{
"id": "1.3.102",
"symbol": "KRW",
"precision": 4,
"issuer": "1.2.0",
"options": {
"max_supply": "1000000000000000",
"market_fee_percent": 0,
"max_market_fee": "1000000000000000",
"issuer_permissions": 511,
"flags": 128,
"core_exchange_rate": {
"base": {
"amount": 43,
"asset_id": "1.3.102"
},
"quote": {
"amount": 104,
"asset_id": "1.3.0"
}
},
"whitelist_authorities": [],
"blacklist_authorities": [],
"whitelist_markets": [],
"blacklist_markets": [],
"description": "1 South Korean won",
"extensions": []
},
"dynamic_asset_data_id": "2.3.102",
"bitasset_data_id": "2.4.2"
}
]
}
-
You can use the core_exchange_rate object which defines a price. Since this is a bitasset you can also fetch the bitasset_data_id object which contains a settlement_price which is more precise.
-
I tried to calculate from base which has amount 43 and quote has amount 104. I divided base amount/quote amount which means 43/104 = 0.4134. When I checked KRW on cryptofresh.com it showed 4.11 KRW/BTS. So what is the mistake in that? Please point it out. Thanks
-
This is what I do:
https://github.com/xeroc/python-graphenelib/blob/master/grapheneexchange/exchange.py#L170-L182
you will need the assets precisions aswell!
The example above derives the price as quote/base .. you may want to have it the other way round depending on your application!