Home > Blockchain >  The calculation of digital currency
The calculation of digital currency

Time:09-22

Digital currency trading, price, quantity calculation
A scenario:
1) request is CNY/BTC buying CNY
(2) access BTS block links mouth get_limit_orders
(3) the response data:
{
"Id" : 36,
"Jsonrpc" : "2.0",
"Result" : [
{
"Id" : "1.7.447,"
"Expiration", "the 2023-08-31 T05:55:47",
"Seller" : "1.2.19,"
"For_sale" : 14611,
"Sell_price" : {
"The base" : {
"The amount" : 100000,
"Asset_id" : "1.3.1" BTC gdex_btc
},
"Quote" : {
"The amount" : 1307189,
"Asset_id" : "1.3.0
"}
},
"Deferred_fee" : 0,
"Deferred_paid_fee" : {
"The amount" : 0,
"Asset_id" : "1.3.0
"}
}
]
}
(4)
If for_sale. Id=sell_price. Base. Asset_id
A, namely sell CNY, buy BTC
B, that is, the base=CNY quote=BTC
C, saleAmount=cnyAmount=baseAmount
C, cnyPrice=btcAmount/cnyAmount=quoteAmount/baseAmount
If for_sale id!=sell_price. Base. Asset_id
A, namely sell BTC, buy CNY
B, that is, the base=BTC quote=CNY
C, saleAmount=btcAmount=baseAmount
D, btcPrice=cnyAmount/btcAmount=quoteAmount/baseAmount
  • Related