-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathdata_provider.py
79 lines (66 loc) · 2.48 KB
/
data_provider.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# -*- coding: utf-8 -*-
class DataProvider(object):
def __init__(self):
self.library = ''
def connect(self):
raise NotImplementedError
def disconnect(self):
raise NotImplementedError
def download_instrument(self, instrument, **kwagrs):
"""
Download and store historical data for all contracts for the given instrument
:param instrument: core.instrument.Instrument object
:param kwagrs: some providers may accept additional args, like start/end date, etc.
:return:
"""
raise NotImplementedError
def download_contract(self, instrument, cont_name, **kwargs):
"""
Download and store historical data for the given instrument and expiry
:param instrument: core.instrument.Instrument object
:param cont_name: contract label string (usually defined as expiry in format YYYYMM)
:param kwagrs: some providers may accept additional args, like start/end date, etc.
:return:
"""
raise NotImplementedError
def download_currency(self, currency, **kwargs):
"""
Download and store historical data for the currencies exchange rates
:param currency: core.currency.Currency object
:param kwagrs: some providers may accept additional args, like start/end date, etc.
:return:
"""
raise NotImplementedError
def download_table(self, **kwargs):
"""
General method to download data from provider
:param kwargs: database and symbol for Quandl, contract for IB, in general can be anything depending on prov
:return:
"""
raise NotImplementedError
def download_spot(self, spot):
"""
Download historical data for spot prices
:param spot: core.spot.Spot object
:return:
"""
raise NotImplementedError
def drop_symbol(self, **kwargs):
"""
Delete a symbol from the storage
"""
raise NotImplementedError
def drop_instrument(self, instrument):
"""
Delete the price data for the given instrument from the storage
:param instrument: core.trading.Instrument object
:return:
"""
raise NotImplementedError
def drop_currency(self, currency):
"""
Delete the exchange rate data for the given currency from the storage
:param instrument: core.currency.Currency object
:return:
"""
raise NotImplementedError