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

Historical BTC rates intermittently available from 2022-05-18 and then not available at all from 2022-07-10 #150

Open
michelcrypt4d4mus opened this issue Nov 5, 2023 · 1 comment

Comments

@michelcrypt4d4mus
Copy link

michelcrypt4d4mus commented Nov 5, 2023

Code

from pendulum import now, datetime
from forex_python.bitcoin import BtcConverter


btc_converter = BtcConverter()
date = datetime(2022, 5, 1)

while date < now():
     btc_usd_rate = btc_converter.get_previous_price('USD', date)

     if btc_usd_rate:
        print(f"{date} BTC = {round(btc_converter.get_previous_price('USD', date), 2)}")
     else:
        print(f"{date} no BTC rate found!")
     
     date = date.add(days=1)

Output

2022-05-01T00:00:00+00:00 BTC = 37923.81
2022-05-02T00:00:00+00:00 BTC = 38913.88
2022-05-03T00:00:00+00:00 BTC = 38580.5
2022-05-04T00:00:00+00:00 BTC = 38368.5
2022-05-05T00:00:00+00:00 BTC = 39690.5
2022-05-06T00:00:00+00:00 BTC = 36469.28
2022-05-07T00:00:00+00:00 BTC = 35933.5
2022-05-08T00:00:00+00:00 BTC = 34637.31
2022-05-09T00:00:00+00:00 BTC = 33528.5
2022-05-10T00:00:00+00:00 BTC = 32050.5
2022-05-11T00:00:00+00:00 BTC = 31474.35
2022-05-12T00:00:00+00:00 BTC = 27127.96
2022-05-13T00:00:00+00:00 BTC = 30219.84
2022-05-14T00:00:00+00:00 BTC = 29378.75
2022-05-15T00:00:00+00:00 BTC = 29817.5
2022-05-16T00:00:00+00:00 BTC = 30376.44
2022-05-17T00:00:00+00:00 BTC = 30160.5
2022-05-18T00:00:00+00:00 no BTC rate found!
2022-05-19T00:00:00+00:00 no BTC rate found!
2022-05-20T00:00:00+00:00 no BTC rate found!
2022-05-21T00:00:00+00:00 no BTC rate found!
2022-05-22T00:00:00+00:00 BTC = 29339.5
2022-05-23T00:00:00+00:00 BTC = 30133.5
2022-05-24T00:00:00+00:00 no BTC rate found!
2022-05-25T00:00:00+00:00 no BTC rate found!
2022-05-26T00:00:00+00:00 BTC = 29085.5
2022-05-27T00:00:00+00:00 BTC = 28870.62
2022-05-28T00:00:00+00:00 BTC = 28769.67
2022-05-29T00:00:00+00:00 BTC = 29181.02
2022-05-30T00:00:00+00:00 BTC = 30592.5
2022-05-31T00:00:00+00:00 BTC = 31533.78
2022-06-01T00:00:00+00:00 BTC = 31451.5
2022-06-02T00:00:00+00:00 BTC = 29731.43
2022-06-03T00:00:00+00:00 BTC = 30489.83
2022-06-04T00:00:00+00:00 no BTC rate found!
2022-06-05T00:00:00+00:00 BTC = 29796.32
2022-06-06T00:00:00+00:00 BTC = 31246.5
2022-06-07T00:00:00+00:00 BTC = 29566.34
2022-06-08T00:00:00+00:00 BTC = 29893.31
2022-06-09T00:00:00+00:00 no BTC rate found!
2022-06-10T00:00:00+00:00 no BTC rate found!
2022-06-11T00:00:00+00:00 no BTC rate found!
2022-06-12T00:00:00+00:00 BTC = 27533.1
2022-06-13T00:00:00+00:00 BTC = 25423.5
2022-06-14T00:00:00+00:00 no BTC rate found!
2022-06-15T00:00:00+00:00 no BTC rate found!
2022-06-16T00:00:00+00:00 no BTC rate found!
2022-06-17T00:00:00+00:00 no BTC rate found!
2022-06-18T00:00:00+00:00 no BTC rate found!
2022-06-19T00:00:00+00:00 no BTC rate found!
2022-06-20T00:00:00+00:00 no BTC rate found!
2022-06-21T00:00:00+00:00 no BTC rate found!
2022-06-22T00:00:00+00:00 no BTC rate found!
2022-06-23T00:00:00+00:00 no BTC rate found!
2022-06-24T00:00:00+00:00 no BTC rate found!
2022-06-25T00:00:00+00:00 no BTC rate found!
2022-06-26T00:00:00+00:00 no BTC rate found!
2022-06-27T00:00:00+00:00 no BTC rate found!
2022-06-28T00:00:00+00:00 no BTC rate found!
2022-06-29T00:00:00+00:00 no BTC rate found!
2022-06-30T00:00:00+00:00 BTC = 19455.62
2022-07-01T00:00:00+00:00 BTC = 19488
2022-07-02T00:00:00+00:00 BTC = 19188.52
2022-07-03T00:00:00+00:00 BTC = 19115.52
2022-07-04T00:00:00+00:00 BTC = 19129
2022-07-05T00:00:00+00:00 BTC = 20205.61
2022-07-06T00:00:00+00:00 BTC = 19930.85
2022-07-07T00:00:00+00:00 no BTC rate found!
2022-07-08T00:00:00+00:00 no BTC rate found!
2022-07-09T00:00:00+00:00 no BTC rate found!
2022-07-10T00:00:00+00:00 BTC = 21296.01
2022-07-11T00:00:00+00:00 no BTC rate found!
2022-07-12T00:00:00+00:00 no BTC rate found!
2022-07-13T00:00:00+00:00 no BTC rate found!
2022-07-14T00:00:00+00:00 no BTC rate found!
2022-07-15T00:00:00+00:00 no BTC rate found!
2022-07-16T00:00:00+00:00 no BTC rate found!
2022-07-17T00:00:00+00:00 no BTC rate found!
2022-07-18T00:00:00+00:00 no BTC rate found!
2022-07-19T00:00:00+00:00 no BTC rate found!
2022-07-20T00:00:00+00:00 no BTC rate found!
2022-07-21T00:00:00+00:00 no BTC rate found!
2022-07-22T00:00:00+00:00 no BTC rate found!
2022-07-23T00:00:00+00:00 no BTC rate found!
2022-07-24T00:00:00+00:00 no BTC rate found!
<...etc...>

get_previous_price_list() exhibits the same behavior:

btc_rates = btc_converter.get_previous_price_list('USD', datetime(2022, 5, 1), datetime(2023, 11, 1))
>>> btc_rates
{'2022-05-01': 37923.8125, '2022-05-02': 38913.875, '2022-05-03': 38580.5, '2022-05-04': 38368.5, '2022-05-05': 39690.5, '2022-05-06': 36469.28, '2022-05-07'
: 35933.5, '2022-05-08': 34637.3075, '2022-05-09': 33528.5, '2022-05-10': 32050.5, '2022-05-11': 31474.35, '2022-05-12': 27127.9625, '2022-05-13': 30219.84, 
'2022-05-14': 29378.75, '2022-05-15': 29817.5, '2022-05-16': 30376.445, '2022-05-17': 30160.5, '2022-05-22': 29339.5, '2022-05-23': 30133.5, '2022-05-26': 29
085.5, '2022-05-27': 28870.625, '2022-05-28': 28769.675, '2022-05-29': 29181.0225, '2022-05-30': 30592.5, '2022-05-31': 31533.775, '2022-06-01': 31451.5, '20
22-06-02': 29731.4275, '2022-06-03': 30489.8275, '2022-06-05': 29796.3175, '2022-06-06': 31246.5, '2022-06-07': 29566.3367, '2022-06-08': 29893.315, '2022-06
-12': 27533.1017, '2022-06-13': 25423.5, '2022-06-30': 19455.625, '2022-07-01': 19488, '2022-07-02': 19188.5217, '2022-07-03': 19115.52, '2022-07-04': 19129,
 '2022-07-05': 20205.6075, '2022-07-06': 19930.845, '2022-07-10': 21296.005}
@michelcrypt4d4mus
Copy link
Author

should mention that get_latest_price(USD) works fine to get the most recent price. issue seems to be only with historical data points.

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