First version which runs end-to-end.

This commit is contained in:
Frederic Fortier
2017-08-17 01:40:03 -04:00
parent 55f898562c
commit 3949364d31
2 changed files with 15 additions and 4 deletions
@@ -10,6 +10,11 @@ class AssetFinderExchange(object):
@property
def sids(self):
"""
This seems to be used to pre-fetch assets.
I don't think that we need this for live-trading.
Leaving the list empty.
"""
return list()
def retrieve_all(self, sids, default_none=False):
+10 -4
View File
@@ -166,14 +166,14 @@ class Bitfinex(Exchange):
:return:
"""
response = self._request('balances', None)
positions = response.json()
if 'message' in positions:
balances = response.json()
if 'message' in balances:
raise ValueError(
'unable to fetch balance %s' % positions['message']
'unable to fetch balance %s' % balances['message']
)
base_position = None
for position in positions:
for position in balances:
if not base_position and position['type'] == 'exchange' \
and position['currency'] == self.base_currency:
base_position = position
@@ -227,6 +227,12 @@ class Bitfinex(Exchange):
@property
def positions(self):
response = self._request('positions', None)
positions = response.json()
if 'message' in positions:
raise ValueError(
'unable to fetch positions %s' % positions['message']
)
raise NotImplementedError('positions not implemented')
@property