<jupyter_start><jupyter_text>Call Coinbase API Prototype script to get historic of crypto prices from Coinbase API (Implemented on python script yet)<jupyter_code>import os
import json
# import coinbase
from datetime import date, datetime, timedelta
import urllib.parse
import urllib
import requests

MAX_REQUEST = 300

def date2coinbaseDate(t):
    return t.isoformat(timespec='seconds') + '+00:00'

date_end = datetime.now()
dt = timedelta(minutes=MAX_REQUEST)
date_start = date_end - dt

# Generate Coinase Url
params = {'start': date2coinbaseDate(date_start), 'end': date2coinbaseDate(date_end), 'granularity': 60}
crypto = 'ETH'
url = f"https://api.pro.coinbase.com/products/{crypto}-EUR/candles?\
{urllib.parse.urlencode(params)}"
url
# Request
r = requests.get(url)
succeed = str(r.status_code)[0]=='2'
if not succeed:
    raise ConnectionError(r.json()['message'])
data = r.json()<jupyter_output><empty_output><jupyter_text>Exctract lowest price<jupyter_code># Use second line that corresponds to lowest price
data_serie = {}
for d in data:
    data_serie[d[0]] = d[1]
print(data_serie)<jupyter_output>{1621939800: 1990.29, 1621939740: 1988.19, 1621939680: 1986, 1621939620: 1985.45, 1621939560: 1975.09, 1621939500: 1968.49, 1621939440: 1963.79, 1621939380: 1962.49, 1621939320: 1950, 1621939260: 1944.36, 1621939200: 1956.18, 1621939140: 1964.28, 1621939080: 1963.51, 1621939020: 1955.06, 1621938960: 1960, 1621938900: 1967, 1621938840: 1970, 1621938780: 1970.74, 1621938720: 1983, 1621938660: 2004.52, 1621938600: 2003.52, 1621938540: 2002.04, 1621938480: 1998.06, 1621938420: 1999.32, 1621938360: 2002.83, 1621938300: 2018.01, 1621938240: 2020.77, 1621938180: 2034.76, 1621938120: 2031.53, 1621938060: 2029.29, 1621938000: 2027.68, 1621937940: 2022.47, 1621937880: 2022.24, 1621937820: 2018.42, 1621937760: 2003.8, 1621937700: 2000.62, 1621937640: 2002.45, 1621937580: 2012.91, 1621937520: 2011.7, 1621937460: 2014.47, 1621937400: 2016.5, 1621937340: 2025.26, 1621937280: 2025.08, 1621937220: 2031.33, 1621937160: 2014.51, 1621937100: 2036.39, 1621937040: 2046.27, 1621936980: 2061.89, 1621936920: [...]
{'fraction_non_alphanumeric': 0.13238770685579196, 'fraction_numerical': 0.36832151300236404, 'mean_word_length': 6.2465753424657535, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '281408', 'license': 'MIT', 'n_tokens_mistral': 1400, 'n_tokens_neox': 798, 'n_words': 192, 'path': 'Python_Bot/_Obsolete/proto_get_data.ipynb', 'repo_name': 'DavidSzmul/CoinbaseBot', 'size': '2115'}