Skip to content

Commit 735cbb8

Browse files
committed
Add AccountConfigurations entity and fix flake8 errors
1 parent 1e4583d commit 735cbb8

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

alpaca_trade_api/entity.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ class Account(Entity):
3939
pass
4040

4141

42+
class AccountConfigurations(Entity):
43+
pass
44+
45+
4246
class Asset(Entity):
4347
pass
4448

alpaca_trade_api/rest.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
get_api_version,
1111
)
1212
from .entity import (
13-
Account, Asset, Order, Position,
14-
BarSet, Clock, Calendar,
13+
Account, AccountConfigurations, Asset,
14+
Order, Position, BarSet, Clock, Calendar,
1515
)
1616
from . import polygon
1717

@@ -150,7 +150,7 @@ def get(self, path, data=None):
150150

151151
def post(self, path, data=None):
152152
return self._request('POST', path, data)
153-
153+
154154
def patch(self, path, data=None):
155155
return self._request('PATCH', path, data)
156156

@@ -171,9 +171,15 @@ def get_account(self):
171171
def get_account_configurations(self):
172172
'''Get account configs'''
173173
resp = self.get('/account/configurations')
174-
return Account(resp)
175-
176-
def update_account_configurations(self, no_shorting=None, dtbp_check=None, trade_confirm_email=None, suspend_trade=None):
174+
return AccountConfigurations(resp)
175+
176+
def update_account_configurations(
177+
self,
178+
no_shorting=None,
179+
dtbp_check=None,
180+
trade_confirm_email=None,
181+
suspend_trade=None
182+
):
177183
'''Update account configs'''
178184
params = {}
179185
if no_shorting is not None:
@@ -184,8 +190,8 @@ def update_account_configurations(self, no_shorting=None, dtbp_check=None, trade
184190
params['trade_confirm_email'] = trade_confirm_email
185191
if suspend_trade is not None:
186192
params['suspend_trade'] = suspend_trade
187-
resp = self.patch('/account/configurations',params)
188-
return Account(resp)
193+
resp = self.patch('/account/configurations', params)
194+
return AccountConfigurations(resp)
189195

190196
def list_orders(self, status=None, limit=None, after=None, until=None,
191197
direction=None, params=None):
@@ -242,7 +248,15 @@ def get_order(self, order_id):
242248
resp = self.get('/orders/{}'.format(order_id))
243249
return Order(resp)
244250

245-
def replace_order(self, order_id, qty=None, limit_price=None, stop_price=None, time_in_force=None, client_order_id=None):
251+
def replace_order(
252+
self,
253+
order_id,
254+
qty=None,
255+
limit_price=None,
256+
stop_price=None,
257+
time_in_force=None,
258+
client_order_id=None
259+
):
246260
params = {}
247261
if qty is not None:
248262
params['qty'] = qty

0 commit comments

Comments
 (0)