def test_top_100(self): top_100 = Current.top_100() no_cols = len(top_100.columns) self.assertEqual(no_cols, 9)
def test_bad_current(self): with self.assertRaises(AttributeError): return Current.get_current('kkk')
def test_global_info(self): glo_info = Current.global_info() no_keys = len(glo_info.keys()) self.assertEqual(no_keys, 5)
def test_get_current(self): btc_current = Current.get_current('btc') no_items = len(btc_current.index) self.assertEqual(no_items, 12)
def test_top_100(self): cur = Current(TestCoinsta.k, currency='usd') top_100 = cur.top_100() size_cols = len(top_100.columns) self.assertEqual(size_cols, 20)
def test_global_info(self): cur = Current(TestCoinsta.k) global_100 = cur.global_info() size = len(global_100) self.assertEqual(size, 11)
def test_get_current(self): cur = Current(TestCoinsta.k) cur_btc = cur.get_current('btc') size = len(cur_btc.keys()) self.assertEqual(size, 13)
import sys sys.path.insert(0, '') from datetime import date from coinsta.core import Historical, Current, HistoricalSnapshot cur = Current(api_key='YOUR-API-KEY-HERE', currency='eur') # Default is usd print(cur) # specify dates considered start = date(2018, 3, 1) end = date(2018, 6, 1) # get data coin_spec = Historical('btc', start=start, end=end) btc_data = coin_spec.get_data() print(btc_data.head()) # default alternative method for "-" formatted date strings alt_spec = Historical.from_strings('btc', '2018-3-1', '2018-6-1', hyphen=True) alt_btc = alt_spec.get_data() print(alt_btc.head()) # another alternative method for "/" formatted date strings other_spec = Historical.from_strings('btc', '2018/3/1', '2018/6/1', hyphen=False) another_btc = other_spec.get_data() print(another_btc.head())