Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CurrencyLayer API #55

Closed
ghost opened this issue Jan 8, 2017 · 4 comments
Closed

CurrencyLayer API #55

ghost opened this issue Jan 8, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Jan 8, 2017

Getting some strange results trying to setup this API, eg:
Price for asset EUR has change from 0.003400 to 1607.205657 (47276524.082367%)! Do you want to continue? [Y/n] n

Keys Config

################################################################################
# Feed Keys
################################################################################
#~ # Acquire a OpenExchange API Key from:
#~ # https://openexchangerates.org
#~ OpenExchangeApiKey = "mykey"

# Acquire a CurrencyLayer API Key from:
# https://currencylayer.com
CurrencyLayerApiKey = "mykey"

Sources Config

                    "sources" : [  # Required Exchanges for FIAT
                                 "btcavg",    # To get from BTC into USD/CNY/EUR
                                 "yahoo",     # To get from USD/CNY/EUR into other FIAT currencies
                                 "quandl",
                                 "google",
                                 "currencylayer",
                                 # BTC/BTS exchanges (include BTC/* if available)
                                 "poloniex",
                                 "bittrex",
                                 "btc38",
                                 "yunbi",
                                 "bitshares",
                                 # ## BTC/* exchanges
                                 # "okcoin",   # no trading-fees
                                 # "btcchina", # no trading-fees
                                 # "huobi",    # no trading-fees
                                 ],

FeedSources Config

feedSources["currencylayer"] = feedsources.CurrencyLayer(api_key=CurrencyLayerApiKey,
                                                                  free_subscription=True,
                                                                  allowFailure=True,
                                                                  quotes=["BTC", "CNY", "EUR", "GBP", "JPY"], # more available
                                                                  bases=["USD"]) # only USD with free subscription

CurrencyLayer also has XAU and XAG. Can this be added?

Output

bts_feed.sh 
(poloniex)(okcoin)(currencylayer)(yahoo)(coincap)(btcchina)(bitshares)(google)(quandl)(btcavg)(yunbi)(btc38)(bittrex)(coinmarketcap)(huobi).
Google We encountered an error loading live data. Trying to recover from cache! (
Error fetching results from Google! (division by zero))
........
Btc38 We encountered an error loading live data. Trying to recover from cache! (
Error fetching results from Btc38! (Expecting value: line 1 column 1 (char 0)))
......Fetching data from wallet...
[Warning] Only a single source for the CNY price could be identified
[Warning] Only a single source for the CNY price could be identified
Asset EUR shows high variance in fetched prices!
Asset EUR shows high variance in fetched prices!
Asset USD shows high variance in fetched prices!
Asset USD shows high variance in fetched prices!
Asset KRW shows high variance in fetched prices!
Asset KRW shows high variance in fetched prices!
Asset USD shows high variance in fetched prices!
Asset USD shows high variance in fetched prices!
Asset USD shows high variance in fetched prices!
Asset USD shows high variance in fetched prices!
BTC: New Feeds differs too much: 0.97986205% > 0.50000000%! Force updating!
SILVER: New Feeds differs too much: 1.20004751% > 0.50000000%! Force updating!
GOLD: New Feeds differs too much: 1.19925675% > 0.50000000%! Force updating!
TRY: New Feeds differs too much: 1.08972450% > 0.50000000%! Force updating!
SGD: New Feeds differs too much: 1.08360665% > 0.50000000%! Force updating!
HKD: New Feeds differs too much: 1.11903551% > 0.50000000%! Force updating!
NZD: New Feeds differs too much: 1.08019301% > 0.50000000%! Force updating!
MXN: New Feeds differs too much: 1.01760493% > 0.50000000%! Force updating!
CAD: New Feeds differs too much: 1.14250986% > 0.50000000%! Force updating!
CHF: New Feeds differs too much: 1.09792122% > 0.50000000%! Force updating!
AUD: New Feeds differs too much: 1.20703801% > 0.50000000%! Force updating!
GBP: New Feeds differs too much: 9.19652930% > 0.50000000%! Force updating!
JPY: New Feeds differs too much: 1.09084877% > 0.50000000%! Force updating!
Price for asset EUR has change from 0.003400 to 1607.205657 (47276524.082367%)! Do you want to continue? [Y/n] n
Price for asset USD has change from 0.003582 to 0.182824 (5003.948787%)! Do you want to continue? [Y/n] n
KRW: New Feeds differs too much: 0.94970559% > 0.50000000%! Force updating!
Price for asset TUSD has change from 0.003582 to 0.182824 (5003.948787%)! Do you want to continue? [Y/n] n
Price for asset CASH.USD has change from 0.003582 to 0.182824 (5003.948787%)! Do you want to continue? [Y/n] n
CASH.BTC: New Feeds differs too much: 0.97986205% > 0.50000000%! Force updating!
ARS: New Feeds differs too much: 1.11614093% > 0.50000000%! Force updating!
+----------+------------+---------------+-------------------------+----------------------------+------------------------+------------------+----------------------------+----------------------------+--------------------+---------+
|  asset   | feed quote |   new price   |           mean          |           median           |       wgt. avg.        |   wgt. std (#)   |         blockchain         |       my last price        |    last update     | publish |
+----------+------------+---------------+-------------------------+----------------------------+------------------------+------------------+----------------------------+----------------------------+--------------------+---------+
|   NZD    |    BTS     |   0.00520572  |   0.01014700 (-48.70%)  |    0.00534065 (-2.53%)     |  0.00520572 (+0.00%)   |    0.10% (96)    |    0.00520727 (-0.03%)     |    0.00515009 (+1.08%)     | 0:18:56.452804 ago |    X    |
|  SILVER  |    BTS     |   0.00022665  |   0.00127680 (-82.25%)  |    0.00023286 (-2.67%)     |  0.00022665 (+0.00%)   |    0.01% (10)    |    0.00021843 (+3.76%)     |    0.00022396 (+1.20%)     | 0:18:56.452987 ago |    X    |
|  ALTCAP  |    BTC     |   6.02019352  |   6.02073131 (-0.01%)   |    6.02073131 (-0.01%)     |  6.02019352 (+0.00%)   |    5.69% ( 2)    |    6.02661515 (-0.11%)     |    6.01854414 (+0.03%)     | 0:18:56.453110 ago |         |
|   GBP    |    BTS     |   0.00318309  |   0.00756291 (-57.91%)  |    0.00302424 (+5.25%)     |  0.00318309 (+0.00%)   |    0.10% (106)   |    0.00294758 (+7.99%)     |    0.00291501 (+9.20%)     | 0:18:56.453385 ago |    X    |
|   TUSD   |    BTS     |   0.18282425  |   2.04582338 (-91.06%)  |   0.00371346 (+4823.29%)   |  0.18282425 (+0.00%)   |  125.39% (100)   |   0.00361554 (+4956.62%)   |   0.00358202 (+5003.95%)   | 0:18:56.453504 ago |         |
|   CAD    |    BTS     |   0.00479158  |   0.00934227 (-48.71%)  |    0.00491693 (-2.55%)     |  0.00479158 (+0.00%)   |    0.09% (96)    |    0.00479309 (-0.03%)     |    0.00473746 (+1.14%)     | 0:18:56.453616 ago |    X    |
|   CNY    |    BTS     |   0.02570000  |   0.02570000 (+0.00%)   |    0.02570000 (+0.00%)     |  0.02570000 (+0.00%)   |    0.00% ( 1)    |    0.02570000 (+0.00%)     |    0.02570000 (+0.00%)     | 0:17:05.453729 ago |         |
|   JPY    |    BTS     |   0.42379437  |   0.87139527 (-51.37%)  |    0.43467145 (-2.50%)     |  0.42379437 (+0.00%)   |    7.82% (166)   |    0.42607700 (-0.54%)     |    0.41922130 (+1.09%)     | 0:18:56.453837 ago |    X    |
|   MXN    |    BTS     |   0.07691696  |   0.14984090 (-48.67%)  |    0.07886905 (-2.48%)     |  0.07691696 (+0.00%)   |    1.41% (96)    |    0.07697050 (-0.07%)     |    0.07614213 (+1.02%)     | 0:18:56.453947 ago |    X    |
|   SGD    |    BTS     |   0.00521145  |   0.01016193 (-48.72%)  |    0.00534874 (-2.57%)     |  0.00521145 (+0.00%)   |    0.10% (96)    |    0.00521627 (-0.09%)     |    0.00515558 (+1.08%)     | 0:18:56.454057 ago |    X    |
|   USD    |    BTS     |   0.18282425  |   2.04582338 (-91.06%)  |   0.00371346 (+4823.29%)   |  0.18282425 (+0.00%)   |  125.39% (100)   |   0.00361554 (+4956.62%)   |   0.00358202 (+5003.95%)   | 0:18:56.454167 ago |         |
| CASH.BTC |    BTS     |   0.00000399  |   0.00000402 (-0.86%)   |    0.00000399 (+0.00%)     |  0.00000399 (+0.00%)   |    0.00% ( 3)    |    0.00000398 (+0.38%)     |    0.00000395 (+0.98%)     | 1:18:53.454274 ago |    X    |
|   AUD    |    BTS     |   0.00496286  |   0.00967642 (-48.71%)  |    0.00509593 (-2.61%)     |  0.00496286 (+0.00%)   |    0.09% (96)    |    0.00496018 (+0.05%)     |    0.00490367 (+1.21%)     | 0:18:56.454390 ago |    X    |
|   GOLD   |    BTS     |   0.00000314  |   0.00001771 (-82.25%)  |    0.00000323 (-2.67%)     |  0.00000314 (+0.00%)   |    0.00% (10)    |    0.00000307 (+2.47%)     |    0.00000311 (+1.20%)     | 0:18:56.454502 ago |    X    |
|   CHF    |    BTS     |   0.00368531  |   0.00718512 (-48.71%)  |    0.00378140 (-2.54%)     |  0.00368531 (+0.00%)   |    0.07% (96)    |    0.00368717 (-0.05%)     |    0.00364529 (+1.10%)     | 0:18:56.454614 ago |    X    |
|   KRW    |    BTS     |   4.35982718  |   8.57440599 (-49.15%)  |    4.46726625 (-2.41%)     |  4.35982718 (+0.00%)   |   82.80% (96)    |    4.47583000 (-2.59%)     |    4.31881119 (+0.95%)     | 0:18:56.454721 ago |    X    |
|   TRY    |    BTS     |   0.01319735  |   0.02573650 (-48.72%)  |    0.01354336 (-2.55%)     |  0.01319735 (+0.00%)   |    0.24% (96)    |    0.01321423 (-0.13%)     |    0.01305508 (+1.09%)     | 0:18:56.454830 ago |    X    |
| CASH.USD |    BTS     |   0.18282425  |   2.04582338 (-91.06%)  |   0.00371346 (+4823.29%)   |  0.18282425 (+0.00%)   |  125.39% (100)   |   0.00361151 (+4962.27%)   |   0.00358202 (+5003.95%)   | 0:18:56.454940 ago |         |
|   BTC    |    BTS     |   0.00000399  |   0.00000402 (-0.86%)   |    0.00000399 (+0.00%)     |  0.00000399 (+0.00%)   |    0.00% ( 3)    |    0.00000398 (+0.25%)     |    0.00000395 (+0.98%)     | 1:18:53.455049 ago |    X    |
|   ARS    |    BTS     |   0.05742601  |   0.11218609 (-48.81%)  |    0.05915520 (-2.92%)     |  0.05742601 (+0.00%)   |    1.06% (48)    |    0.05744799 (-0.04%)     |    0.05679213 (+1.12%)     | 0:18:56.455157 ago |    X    |
|   EUR    |    BTS     | 1607.20565743 | 18.04607372 (+8806.12%) | 0.00352730 (+45564666.01%) | 1607.20565743 (+0.00%) | 147353.76% (164) | 0.00343366 (+46807319.02%) | 0.00339958 (+47276524.08%) | 0:18:56.455265 ago |         |
|   HKD    |    BTS     |   0.02808064  |   0.05985779 (-53.09%)  |    0.02880878 (-2.53%)     |  0.02808064 (+0.00%)   |    0.52% (160)   |    0.02809660 (-0.06%)     |    0.02776988 (+1.12%)     | 0:18:56.455373 ago |    X    |
+----------+------------+---------------+-------------------------+----------------------------+------------------------+------------------+----------------------------+----------------------------+--------------------+---------+
Blamefile: /home/ihashfury/git/iPerky-python-graphenelib/scripts/pricefeeds/blame/12942498.json
Are you SURE you would like to publish this feed? [Y/n] n
@xeroc
Copy link
Owner

xeroc commented Jan 9, 2017

Have you taken a look at the prices that you obtain from the new API?
it looks as if there was some massive divergency

@ghost
Copy link
Author

ghost commented Jan 9, 2017

Here is the output from Currencylayer Dashboard - Make an API Request

{
  "success":true,
  "terms":"https:\/\/currencylayer.com\/terms",
  "privacy":"https:\/\/currencylayer.com\/privacy",
  "timestamp":1483958175,
  "source":"USD",
  "quotes":{
    "USDBTC":0.001111,
    "USDCNY":6.934896,
    "USDEUR":0.950904,
    "USDGBP":0.823901,
    "USDJPY":117.147003,
    "USDXAU":0.000851,
    "USDXAG":0.060698
  }
}

PM me if you would like to borrow my API key.

@ghost
Copy link
Author

ghost commented Jan 19, 2017

I think the prices are inverted.
openexchangerates and fixer produce similar results when enabled.

Here is my latest config:
https://github.com/iPerky/python-graphenelib/blob/master/scripts/pricefeeds/config-example.py

@ghost
Copy link
Author

ghost commented Jan 28, 2017

I would like to use this api to feed prices for:

    "USDCNY":6.876704,
    "USDXAG":0.058343,
    "USDXAU":0.00084,
    "USDXDR":0.737741,

but I am not getting any usable results:

Traceback (most recent call last):
  File "pricefeeds.py", line 629, in <module>
    update_price_feed()
  File "pricefeeds.py", line 476, in update_price_feed
    derived_prices = derive_prices(feed)
  File "pricefeeds.py", line 238, in derive_prices
    price[base][quote].append(feed[datasource][base][quote]["price"])
KeyError: 'XDR'

@xeroc xeroc closed this as completed Aug 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant