cryptoqween / cryptoqween.github.io

CryptoCompare API tutorials
194 stars 114 forks source link

Conversion If the crypto does not trade directly into the symbol requested #20

Closed btflgame closed 6 years ago

btflgame commented 6 years ago

Hi,

I'am having some problems to understand conversion when the crypto does not trade directly into the symbol requested. For example if i call the Subswatchlist API for BTPL to USD it says that conversion of type multiply is need:

https://min-api.cryptocompare.com/data/subsWatchlist?fsyms=BTPL&tsym=USD

{  
   "BTPL":{  
      "Conversion":"multiply",
      "ConversionSymbol":"BTC",
      "CurrencyFrom":"BTPL",
      "CurrencyTo":"USD",
      "Market":"CCCAGG",
      "Supply":6323098,
      "TotalVolume24H":0,
      "SubBase":"5~",
      "SubsNeeded":[  
         "5~CCCAGG~BTPL~BTC",
         "5~CCCAGG~BTC~USD"
      ],
      "RAW":[  
         "5~CCCAGG~BTPL~BTC~4~0.0000011~1510552626~119.99998961~0.000131999988571~1510552626001~0~0~2981.60547588~0.0031467340322768006~0.0000011~0.0000011~0.0000011~0.00000101~0.0000011~0.00000101~Novaexchange~7ffe9",
         "5~CCCAGG~BTC~USD~4~6844.52~1522868284~0.0098013~66.832908414~41075622~102732.02342399546~732012286.0325726~121610.80288089329~873375007.7504779~7434.3~7442.42~6756.34~7497.83~7533.47~6752.96~Coinbase~7ffe9"
      ]
   }
}

So from the doc if i understand well it says to multiply values BTPL to BTC by BTC to USD. It works well for the price field but for fields like openDay or change24Hour it is not giving right values: i verify it by calling the full data price API which also uses BTC as conversion:

https://min-api.cryptocompare.com/data/pricemultifull?fsyms=BTPL&tsyms=USD

{  
   "RAW":{  
      "BTPL":{  
         "USD":{  
            "TYPE":"5",
            "MARKET":"CCCAGG",
            "FROMSYMBOL":"BTPL",
            "TOSYMBOL":"USD",
            "FLAGS":"4",
            "PRICE":"0.007540",
            "LASTUPDATE":1522868668,
            "LASTVOLUME":0,
            "LASTVOLUMETO":0,
            "LASTTRADEID":0,
            "VOLUMEDAY":0,
            "VOLUMEDAYTO":0,
            "VOLUME24HOUR":0,
            "VOLUME24HOURTO":0,
            "OPENDAY":"0.007540",
            "HIGHDAY":"0.007540",
            "LOWDAY":"0.007540",
            "OPEN24HOUR":"0.006923",
            "HIGH24HOUR":"0.007540",
            "LOW24HOUR":"0.006923",
            "LASTMARKET":"Novaexchange",
            "CHANGE24HOUR":0.0006169999999999995,
            "CHANGEPCT24HOUR":8.912321248013859,
            "CHANGEDAY":0,
            "CHANGEPCTDAY":0,
            "SUPPLY":6323098,
            "MKTCAP":47676.15892,
            "TOTALVOLUME24H":0,
            "TOTALVOLUME24HTO":0
         }
      }
   }
}

I would like to know if you have a conversion example that you could post for a crypto that does not trade directly into the symbol requested.

Thanks.

cryptoqween commented 4 years ago

Hi there, just wanted to let you know that this version of the streaming API is being sunset in the next couple of weeks as we are moving to version 2, that has a lot more features and better support. Please visit our documentation page which provides code examples in javascript, node, python and golang: https://min-api.cryptocompare.com/documentation/websockets.