Compare commits
No commits in common. "a6f9e74ee17de654791d7a6aa1044678bdc0a2f6" and "9dda0e8b4a01703b6478b1f165a3514e33acf830" have entirely different histories.
a6f9e74ee1
...
9dda0e8b4a
@ -16,9 +16,3 @@ def get_balance_hook(user_id, user_name, account_id, account_name, balance):
|
|||||||
"balance": balance,
|
"balance": balance,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def convert_open_trades(open_trades):
|
|
||||||
"""
|
|
||||||
Convert a list of open trades into a list of Trade-like objects.
|
|
||||||
"""
|
|
||||||
|
@ -151,17 +151,10 @@ class OANDAExchange(BaseExchange):
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
def close_all_positions(self):
|
def close_all_positions(self):
|
||||||
all_positions = self.get_all_positions()
|
# all_positions = self.get_all_positions()
|
||||||
responses = []
|
|
||||||
for position in all_positions:
|
# for position in all_positions["itemlist"]:
|
||||||
side = position["side"]
|
# print("POS ITER", position)
|
||||||
symbol = position["symbol"]
|
r = positions.PositionClose(accountID=self.account_id)
|
||||||
data = {
|
|
||||||
f"{side}Units": "ALL",
|
|
||||||
}
|
|
||||||
r = positions.PositionClose(
|
|
||||||
accountID=self.account_id, instrument=symbol, data=data
|
|
||||||
)
|
|
||||||
response = self.call(r)
|
response = self.call(r)
|
||||||
responses.append(response)
|
return response
|
||||||
return responses
|
|
||||||
|
@ -32,11 +32,6 @@ class ElasticMock:
|
|||||||
|
|
||||||
|
|
||||||
class LiveBase:
|
class LiveBase:
|
||||||
@classmethod
|
|
||||||
def tearDownClass(cls):
|
|
||||||
cls.account.client.close_all_positions()
|
|
||||||
super(LiveBase, cls).tearDownClass()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(LiveBase, cls).setUpClass()
|
super(LiveBase, cls).setUpClass()
|
||||||
|
@ -78,8 +78,3 @@ class LiveTradingTestCase(ElasticMock, LiveBase, TestCase):
|
|||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
self.fail("Could not find the trade in the list of open trades")
|
self.fail("Could not find the trade in the list of open trades")
|
||||||
|
|
||||||
def test_convert_open_trades(self):
|
|
||||||
"""
|
|
||||||
Test converting open trades response to Trade-like format.
|
|
||||||
"""
|
|
||||||
|
Loading…
Reference in New Issue
Block a user