Sources define a start date and price types.

This commit is contained in:
Chris Berkhout 2021-05-24 21:26:39 +02:00
parent d0cad8d650
commit f69ecf8adb
4 changed files with 28 additions and 2 deletions

View file

@ -65,6 +65,8 @@ def cmd_source(args):
print_field("Name", source.name(), key_width, output_width)
print_field("Description", source.description(), key_width, output_width)
print_field("URL", source.source_url(), key_width, output_width, force=False)
print_field("Start", source.start(), key_width, output_width)
print_field("Types", ", ".join(source.types()), key_width, output_width)
print_field("Notes", source.notes(), key_width, output_width)

View file

@ -26,6 +26,14 @@ class CoinDesk:
def source_url():
return "https://www.coindesk.com/coindesk-api"
@staticmethod
def start():
return "2010-07-17"
@staticmethod
def types():
return []
@staticmethod
def notes():
return ""
@ -43,7 +51,7 @@ class CoinDesk:
def fetch(self, pair, type, start, end):
base, quote = pair.split("/")
min_start = "2010-07-17"
min_start = self.start()
if start < min_start:
exit(
f"start {start} too early. The CoinDesk BPI only covers data"

View file

@ -24,6 +24,14 @@ class CoinMarketCap:
def source_url():
return "https://coinmarketcap.com/"
@staticmethod
def start():
return "2013-04-28"
@staticmethod
def types():
return ["mid", "open", "high", "low", "close"]
@staticmethod
def notes():
return (

View file

@ -25,6 +25,14 @@ class ECB:
def source_url():
return "https://www.ecb.europa.eu/stats/exchange/eurofxref/html/index.en.html"
@staticmethod
def start():
return "1999-01-04"
@staticmethod
def types():
return []
@staticmethod
def notes():
return ""
@ -41,7 +49,7 @@ class ECB:
def fetch(self, pair, type, start, end):
base, quote = pair.split("/")
min_start = "1999-01-04"
min_start = self.start()
if start < min_start:
exit(f"start {start} too early. Minimum is {min_start}")